문제

I am getting the following error when trying to execute a button clcik event from xaml

<Button x:Name="myButton" Content="Surface History"                    
                HorizontalAlignment="Right">
            <Button.Triggers>
                <EventTrigger RoutedEvent="Button.Click">
                    <BeginStoryboard>
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MyText" 
                                                           Storyboard.TargetProperty="Text">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Hello" />
                            </ObjectAnimationUsingKeyFrames>

                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Button.Triggers>
        </Button>
        <TextBox Name="MyText" Text="Hi"/>

Text Storyboard.TargetProperty path contains nonanimatable property Text.

도움이 되었습니까?

해결책

Text property is Non Animatable dependency property. While creating the dependency property for Text, the UIMetaData IsAnimationProhibited property is set to true which prohibits the Text property to animate.

So Text property cannot be animated. You need to manually set the text from Timer to get this behaviour.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top