iraSenthil
iraSenthil

Reputation: 11577

What is the use of the Style tag between Button.Style and Style.Trigger?

What is the use of the Style tag between Button.Style and Style.Trigger? Is it because Style an attached property?

<Button.Style>                
    <Style >
        <Style.Triggers>
            <Trigger Property="Button.IsMouseOver" Value="True">
                <Trigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation From="1" To="15" Storyboard.TargetProperty="FontSize"></DoubleAnimation>
                        </Storyboard>
                    </BeginStoryboard>
                </Trigger.EnterActions>
            </Trigger>
        </Style.Triggers>
    </Style>
</Button.Style>

Upvotes: 0

Views: 219

Answers (1)

eulerfx
eulerfx

Reputation: 37739

This is what the XAML what look like in code:

var button = new Button();
button.Style = new Style();
button.Style.Triggers.Add(new Trigger() ...);

The tag <Button.Style> references a property on Button and with the <Style> tag you are setting the style property to an object of type Style. If you had a derived class for Style, such as MyStyle, then the XAML would look like this:

<Button.Style>                
    <local:MyStyle>
    </local:MyStyle>
</Button.Style>

Upvotes: 2

Related Questions