Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.76 KB

visualstate_setters.md

File metadata and controls

49 lines (37 loc) · 1.76 KB
-api-id -api-type
P:Windows.UI.Xaml.VisualState.Setters
winrt property

Windows.UI.Xaml.VisualState.Setters

-description

Gets a collection of Setter objects that define discrete property values that control the appearance of UIElements when this VisualState is applied.

-property-value

A collection of Setter objects. The default is an empty collection.

-remarks

Use this property to make discrete property value changes on multiple UI elements at one time when a VisualState is applied.

-examples

The following example shows how to use multiple Setter statements inside the VisualState.Setters property to apply multiple discrete property value changes on 2 different elements when a VisualState is applied.

<Page>
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="NarrowState">
                    <VisualState.Setters>
                        <Setter Target="myPanel.Orientation" Value="Vertical" />
                        <Setter Target="myPanel.Width" Value="380" />
                        <Setter Target="myTextBlock.MaxLines" Value="3" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <StackPanel x:Name="myPanel" Orientation="Horizontal">
            <TextBlock x:Name="myTextBlock" MaxLines="5" Style="{ThemeResource BodyTextBlockStyle}"/>
        </StackPanel>
    </Grid>
</Page>

-see-also