Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
AnswerRe: DateTime.ParseExact Won't Work PinPopular
musefan17-Mar-11 7:13
musefan17-Mar-11 7:13 
GeneralRe: DateTime.ParseExact Won't Work Pin
Kevin Marois17-Mar-11 7:14
professionalKevin Marois17-Mar-11 7:14 
GeneralRe: DateTime.ParseExact Won't Work Pin
musefan17-Mar-11 7:16
musefan17-Mar-11 7:16 
GeneralRe: DateTime.ParseExact Won't Work Pin
Pete O'Hanlon17-Mar-11 7:18
mvePete O'Hanlon17-Mar-11 7:18 
GeneralRe: DateTime.ParseExact Won't Work Pin
musefan17-Mar-11 7:22
musefan17-Mar-11 7:22 
GeneralRe: DateTime.ParseExact Won't Work Pin
Luc Pattyn17-Mar-11 7:18
sitebuilderLuc Pattyn17-Mar-11 7:18 
AnswerRe: DateTime.ParseExact Won't Work Pin
Pete O'Hanlon17-Mar-11 7:17
mvePete O'Hanlon17-Mar-11 7:17 
QuestionWPF: Binding Storyboard.RepeatBehavior property Pin
Lutosław16-Mar-11 13:40
Lutosław16-Mar-11 13:40 
Hello!

I wish to have an icon (Path) which scales forever until some background operation is finished. I managed to bind a DataTrigger to my dependency property InProgress. However, I want the animation to repeat so I bound RepeatBehavior to InProgress as well. Here I get an exception "'Set property 'System.Windows.FrameworkElement.Style' threw an exception.' Line number '241' and line position '22'.". The inner one is: "Cannot freeze this Storyboard timeline tree for use across threads."
<Path.Style>
    <Style TargetType="Path">
        <Style.Triggers>
            <DataTrigger Binding="{Binding InProgress}" Value="True"  >
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard AutoReverse="True"
 RepeatBehavior="{Binding Path=InProgress, Converter={x:Static Converters:BooleanToRepeatBehaviourConverter.Instance}}" >                                                
                            <DoubleAnimation To="0.125" Duration="0:0:0.12"
 Storyboard.TargetProperty="(LayoutTransform).(ScaleTransform.ScaleX)" />
                            <DoubleAnimation To="0.125" Duration="0:0:0.12" 
Storyboard.TargetProperty="(LayoutTransform).(ScaleTransform.ScaleY)" />
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</Path.Style>

The exception started to occur after binding the RepeatBehavior. Before doing that, the animation displayed correctly but only once. Note that I have been using the InProgress property for binding before and it worked. The converter:
public class BooleanToRepeatBehaviourConverter : IValueConverter
{
    private static readonly IValueConverter instance = new BooleanToRepeatBehaviourConverter();

    public static IValueConverter Instance
    {
        get { return instance; }
    }

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return (bool) value
                    ? RepeatBehavior.Forever
                    : new RepeatBehavior(0);
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

How to solve the problem?

Thanks in advance!
Greetings - Jacek

GeneralRe: WPF: Binding Storyboard.RepeatBehavior property Pin
thatraja16-Mar-11 17:23
professionalthatraja16-Mar-11 17:23 
GeneralMessage Removed Pin
16-Mar-11 22:02
Lutosław16-Mar-11 22:02 
GeneralMessage Removed Pin
16-Mar-11 23:38
mvePete O'Hanlon16-Mar-11 23:38 
GeneralMessage Removed Pin
17-Mar-11 0:21
professionalDoru_C17-Mar-11 0:21 
GeneralRe: WPF: Binding Storyboard.RepeatBehavior property Pin
Pete O'Hanlon17-Mar-11 0:44
mvePete O'Hanlon17-Mar-11 0:44 
GeneralMy vote of 1 PinPopular
Keith Barrow17-Mar-11 2:14
professionalKeith Barrow17-Mar-11 2:14 
GeneralRe: My vote of 1 Pin
OriginalGriff17-Mar-11 5:02
mveOriginalGriff17-Mar-11 5:02 
AnswerRe: WPF: Binding Storyboard.RepeatBehavior property Pin
Lutosław16-Mar-11 22:07
Lutosław16-Mar-11 22:07 
AnswerRe: WPF: Binding Storyboard.RepeatBehavior property Pin
Pete O'Hanlon17-Mar-11 4:46
mvePete O'Hanlon17-Mar-11 4:46 
QuestionUpdate an MDI Child Form TreeView() with other MDI Child Form Pin
Gerben Schmidt16-Mar-11 9:40
Gerben Schmidt16-Mar-11 9:40 
AnswerRe: Update an MDI Child Form TreeView() with other MDI Child Form Pin
OriginalGriff16-Mar-11 21:46
mveOriginalGriff16-Mar-11 21:46 
GeneralRe: Update an MDI Child Form TreeView() with other MDI Child Form Pin
Gerben Schmidt17-Mar-11 8:47
Gerben Schmidt17-Mar-11 8:47 
Questiondouble to string without point [SOLVED] Pin
Pierre besquent16-Mar-11 6:38
Pierre besquent16-Mar-11 6:38 
AnswerRe: double to string without point Pin
Dave Kreskowiak16-Mar-11 6:51
mveDave Kreskowiak16-Mar-11 6:51 
JokeRe: double to string without point Pin
fjdiewornncalwe16-Mar-11 17:17
professionalfjdiewornncalwe16-Mar-11 17:17 
GeneralRe: double to string without point Pin
Dave Kreskowiak16-Mar-11 17:52
mveDave Kreskowiak16-Mar-11 17:52 
GeneralRe: double to string without point Pin
fjdiewornncalwe17-Mar-11 3:25
professionalfjdiewornncalwe17-Mar-11 3:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.