Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7417401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:41:44+00:00 2026-05-29T07:41:44+00:00

My tabitem is styled by a ResourceDictionary that has a VisualState named Flashing. I

  • 0

My tabitem is styled by a ResourceDictionary that has a VisualState named Flashing.
I want to do something like this, but its not working.

public static void FlashTab(TabItem tbi)
{
  bool thisReturnsFalse =   VisualStateManager.GoToState(tbi, "Flashing", true);
}

The XAML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Color x:Key="TabBrush0">#7F605F5F</Color>
    <Color x:Key="TabBrush01">#7F605F5F</Color>
    <Color x:Key="TabBrush02">#7F605F5F</Color>
    <Color x:Key="TabBrush03">#7F605F5F</Color>
    <Color x:Key="TabBrush04">#7F605F5F</Color>


    <Color x:Key="TabBrush1">#7F7E7E7E</Color>
    <Color x:Key="TabBrush2">#7FFDFDFD</Color>
    <Color x:Key="TabBrush3">#7FFFFFFF</Color>
    <Color x:Key="TabBrush4">#BFFFFFFF</Color>
    <Color x:Key="TabBrush5">#F2FFFFFF</Color>
    <Color x:Key="TabBrush6">#FF6096E5</Color>
    <Color x:Key="TabBrush7">#FF9B7C35</Color>
    <Color x:Key="TabBrush8">#FFB0BAA1</Color>
    <Color x:Key="TabBrush10">White</Color>

    <Color x:Key="Foreground">#FF000000</Color>

    <Color x:Key="MouseOverColor">Purple</Color>
    <Color x:Key="SelectedColor">Blue</Color>

    <SolidColorBrush x:Key="ForegroundBrush" Color="{DynamicResource Foreground}" />




    <Style TargetType="{x:Type TabItem}"  >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid Margin="1,0,1,0" >
                        <VisualStateManager.VisualStateGroups>

                            <VisualStateGroup x:Name="CommonStates">

                                <VisualState x:Name="Normal"/>


                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InnerRectangleMouseOver">
                                            <EasingDoubleKeyFrame KeyTime="0" Value=".2"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="InnerRectangleSelected">
                                            <EasingDoubleKeyFrame KeyTime="0" Value=".2"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>


                                <VisualState x:Name="Flashing" >
                                    <Storyboard>
                                        <DoubleAnimation 
                                            Storyboard.TargetName="GlassCube"
                                            Storyboard.TargetProperty="Opacity"
                                            From="0.0"
                                            To="1.0"                     
                                            Duration="0:0:0.33"
                                            AutoReverse="True"
                                            RepeatBehavior="Forever"/>
                                    </Storyboard>
                                </VisualState>


                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>


                        </VisualStateManager.VisualStateGroups>

                        <Rectangle x:Name="InnerRectangleMouseOver" Margin="1,1,1,1" RadiusY="5" RadiusX="5" StrokeThickness="3" Opacity="0">
                            <Rectangle.Effect>
                                <BlurEffect/>
                            </Rectangle.Effect>

                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                                    <GradientStop Color="{DynamicResource MouseOverColor}" Offset="0.228"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>

                        <Rectangle x:Name="InnerRectangleSelected" Margin="1,1,1,1" RadiusY="5" RadiusX="5" StrokeThickness="3" Opacity="0">
                            <Rectangle.Effect>
                                <BlurEffect/>
                            </Rectangle.Effect>

                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                                    <GradientStop Color="{DynamicResource SelectedColor}" Offset="0.228"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>






                        <Rectangle x:Name="InnerRectangle" Margin="1,1,1,1" RadiusY="5" RadiusX="5" StrokeThickness="3" >
                            <Rectangle.Effect>
                                <BlurEffect/>
                            </Rectangle.Effect>
                            <Rectangle.Stroke>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="{DynamicResource Brush1}" Offset="1"/>
                                    <GradientStop Color="{DynamicResource Brush0}"/>
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                                    <GradientStop Color="{DynamicResource Brush13}" Offset="0.228"/>
                                    <GradientStop Color="{DynamicResource Brush7}"/>
                                    <GradientStop Color="{DynamicResource Brush7}" Offset="0.823"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>


                        <Rectangle x:Name="GlassCube" Margin="1,1,1,1" RadiusY="5" RadiusX="5" StrokeThickness="3" Opacity="1">
                            <Rectangle.Stroke>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="{DynamicResource Brush4}"/>
                                    <GradientStop Color="{DynamicResource Brush4}"/>
                                    <GradientStop Color="{DynamicResource Brush6}" Offset="0.254"/>
                                    <GradientStop Color="{DynamicResource Brush5}" Offset="0.401"/>
                                </LinearGradientBrush>
                            </Rectangle.Stroke>
                            <Rectangle.OpacityMask>
                                <RadialGradientBrush>
                                    <GradientStop Color="{DynamicResource Brush11}" Offset="0"/>
                                    <GradientStop Color="{DynamicResource Brush13}" Offset="1"/>
                                </RadialGradientBrush>
                            </Rectangle.OpacityMask>
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="{DynamicResource Brush12}"/>
                                    <GradientStop Color="{DynamicResource Brush7}" Offset="0.47"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>

                        <ContentPresenter HorizontalAlignment="Center" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" ContentSource="Header" >
                            <TextBlock.Foreground>
                                <SolidColorBrush Color="{DynamicResource Foreground}"/>
                            </TextBlock.Foreground>
                        </ContentPresenter>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



</ResourceDictionary>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:41:45+00:00Added an answer on May 29, 2026 at 7:41 am

    The TabItem will flash when you merge the ResourceDictionary into the Window.Resources of the TabControl’s parent window (the ResourceDictionary is in ResourceDictionary.xaml here):

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    

    and when you fix the OpacityMask of the GlassCuberectangle. I’ve commented it out and it happily flashes:

    <Rectangle x:Name="GlassCube" Margin="1,1,1,1" RadiusY="5" RadiusX="5" StrokeThickness="3" Opacity="1">
        <Rectangle.Stroke>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="{DynamicResource TabBrush4}"/>
                <GradientStop Color="{DynamicResource TabBrush4}"/>
                <GradientStop Color="{DynamicResource TabBrush6}" Offset="0.254"/>
                <GradientStop Color="{DynamicResource TabBrush5}" Offset="0.401"/>
            </LinearGradientBrush>
        </Rectangle.Stroke>
        <!--<Rectangle.OpacityMask>
            <RadialGradientBrush>
                <GradientStop Color="{DynamicResource TabBrush11}" Offset="0"/>
                <GradientStop Color="{DynamicResource TabBrush13}" Offset="1"/>
            </RadialGradientBrush>
        </Rectangle.OpacityMask>-->
        <Rectangle.Fill>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="{DynamicResource TabBrush12}"/>
                <GradientStop Color="{DynamicResource TabBrush7}" Offset="0.47"/>
            </LinearGradientBrush>
        </Rectangle.Fill>
    </Rectangle>
    

    EDIT: There is one more thing to mention concerning the keys of the color resources. You define them with keys TabBrush1, TabBrush2 etc. but when you use them in Color="{DynamicResource ...}", you always use keys Brush1, Brush2 etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to loop through the controls within a TabItem. my xaml is something
I have a WPF TabControl that has a couple of buttons in the TabItem
I can set the background of each TabItem with TabItem.Background, but when that tab
I have a TabControl which looks like this: <TabControl> <TabItem> <TabItem.Header> <StackPanel Orientation=Horizontal> <Canvas
hi everyone i have a xaml code like this <Style x:Key = {x:Type TabItem}
I have a custom control that is derived from TabItem , and I want
I have a TabItem style, which has VisualStates. <VisualState x:Name=MouseOver> <!-- Tab turns bronze
I have a template like this: <Style TargetType={x:Type TabItem}> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType={x:Type
I currently have a custom TabItem which has a custom header, which is defined
Here is the code that cause me problem since few hours: TabItem newTab =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.