<Page x:Class="CustomTriggerSample.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="using:CustomTriggerSample"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:triggers="using:CustomTriggerSample.Triggers"
      mc:Ignorable="d">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <VisualStateManager.VisualStateGroups>
            <!--
                For demo purposes the colors are changed depending on the current orientation of the device.
            -->
            <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Portrait">
                    <VisualState.StateTriggers>
                        <triggers:OrientationTrigger Orientation="Portrait" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="Rectangle.Fill" Value="Blue" />
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="Landscape">
                    <VisualState.StateTriggers>
                        <triggers:OrientationTrigger Orientation="Landscape" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="Rectangle.Fill" Value="Green" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Rectangle x:Name="Rectangle"
                   Width="100"
                   Height="100"
                   Fill="Red" />
    </Grid>
</Page>
