locked
Blinking of the text RRS feed

  • Question

  • How to make a text blink in a textblock and goes off?

    Thanks in advance.

    Regards 

    Manideep

    Friday, August 22, 2014 7:52 AM

Answers

  • You could animate the Opacity property of the TextBlock to make it blink:

    <TextBlock x:Name="textBlock" Text="Blinking!">
                <TextBlock.Triggers>
                    <EventTrigger RoutedEvent="TextBlock.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    Storyboard.TargetName="textBlock"
                                    Storyboard.TargetProperty="Opacity"
                                        To="0" Duration="0:0:0.5" 
                                        AutoReverse="True" RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </TextBlock.Triggers>
            </TextBlock>
    

    Saturday, August 23, 2014 10:23 AM
  • There's no property that does that.  You could set the text to null and then back to the text repeatedly.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, August 22, 2014 7:06 PM
    Moderator

All replies

  • There's no property that does that.  You could set the text to null and then back to the text repeatedly.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, August 22, 2014 7:06 PM
    Moderator
  • You could animate the Opacity property of the TextBlock to make it blink:

    <TextBlock x:Name="textBlock" Text="Blinking!">
                <TextBlock.Triggers>
                    <EventTrigger RoutedEvent="TextBlock.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation
                                    Storyboard.TargetName="textBlock"
                                    Storyboard.TargetProperty="Opacity"
                                        To="0" Duration="0:0:0.5" 
                                        AutoReverse="True" RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </TextBlock.Triggers>
            </TextBlock>
    

    Saturday, August 23, 2014 10:23 AM