<Page
    x:Class="ImagingSamples.Crop"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ImagingSamples"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
	<Page.Resources>
		<SolidColorBrush Color="#66FFFFFF" x:Key="MaskBrush" />
	</Page.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition />
		</Grid.RowDefinitions>
		<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
            <Button x:Name="button1" x:Uid="/ImagingSamplesLib/Resources/LoadImage" Click="LoadImage" Margin="0 0 10 0" Width="180" HorizontalAlignment="Left" />
            <Button x:Name="button2" x:Uid="/ImagingSamplesLib/Resources/ExportSelection" Click="ExportImage" Grid.Column="1" Width="140" />
		</StackPanel>
		<Grid Name="imageGrid" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="*" />
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
				<ColumnDefinition Width="Auto" />
			</Grid.ColumnDefinitions>
			<Image Stretch="Uniform" Name="image" Grid.RowSpan="3" Grid.ColumnSpan="3"/>
			<Grid Name="topMask" Grid.ColumnSpan="2" Background="{StaticResource MaskBrush}" />
			<Grid Name="bottomMask" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2" Background="{StaticResource MaskBrush}" />
			<Grid Name="leftMask" Grid.RowSpan="2" Grid.Row="1" Background="{StaticResource MaskBrush}" />
			<Grid Name="rightMask" Grid.Column="2" Grid.RowSpan="2" Background="{StaticResource MaskBrush}" />
		</Grid>
        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's window size -->
            <VisualStateGroup>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="540" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                    </VisualState.Setters>
                </VisualState>

                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="button1.Width" Value="170" />
                        <Setter Target="button2.Width" Value="130" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
	</Grid>
</Page>
