<Window x:Class="JC2MapViewer.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:JC2MapViewer"
    xmlns:bruTileWindows="clr-namespace:BruTile.UI.Windows;assembly=BruTile"
    Title="JC2MapViewer">
    <Window.Resources>
        <ResourceDictionary>
            <Style x:Key="TreeViewItemStyle" TargetType="TreeViewItem">
                <Setter Property="IsExpanded" Value="True" />
                <Setter Property="IsSelected" Value="{Binding IsInitiallySelected, Mode=OneTime}" />
                <Setter Property="KeyboardNavigation.AcceptsReturn" Value="True" />
                <Setter Property="local:VirtualToggleButton.IsVirtualToggleButton" Value="True" />
                <Setter Property="local:VirtualToggleButton.IsChecked" Value="{Binding IsChecked}" />
            </Style>
            <HierarchicalDataTemplate x:Key="CheckBoxItemTemplate" ItemsSource="{Binding Children, Mode=OneTime}">
                <StackPanel Orientation="Horizontal">
                    <CheckBox Focusable="False" IsChecked="{Binding IsChecked}" VerticalAlignment="Center" />
                    <TextBlock FontWeight="400" x:Name="Header">
                        <ContentPresenter Content="{Binding Text}" Margin="2,0" />
                    </TextBlock>
                </StackPanel>
                <HierarchicalDataTemplate.Triggers>
                    <DataTrigger Binding="{Binding IsInComplete}" Value="True">
                        <DataTrigger.Setters>
                            <Setter Property="FontWeight" Value="700" TargetName="Header" />
                        </DataTrigger.Setters>
                    </DataTrigger>
                </HierarchicalDataTemplate.Triggers>
            </HierarchicalDataTemplate>
        </ResourceDictionary>
    </Window.Resources>
    <Window.DataContext>
        <ObjectDataProvider MethodName="CreateChooser" ObjectType="{x:Type local:ChooserViewModel}" />
    </Window.DataContext>

    <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
        <bruTileWindows:MapControl x:Name="map" Background="#072530"
            VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
        </bruTileWindows:MapControl>
        <Border CornerRadius="8" Width="270" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="8" Background="#7f000000" BorderThickness="2" BorderBrush="#ffffff" Padding="8">
            <StackPanel>
                <Button x:Name="button1" Click="button1_Click">Load Save file...</Button>
                <TreeView x:Name="itemChooser" ItemContainerStyle="{StaticResource TreeViewItemStyle}" ItemsSource="{Binding Mode=OneTime}" ItemTemplate="{StaticResource CheckBoxItemTemplate}" />
                <Button x:Name="button2" Click="button2_Click">Refresh</Button>
                <ToggleButton x:Name="button3" Click="button3_Click">Toggle Settlements</ToggleButton>
            </StackPanel>
        </Border>
        <Border x:Name="errorBorder" BorderBrush="White" Opacity="0" Margin="20" Background="White" BorderThickness="10" CornerRadius="5" VerticalAlignment="Bottom" HorizontalAlignment="Right">
            <StackPanel Orientation="Horizontal" >
                <TextBlock Text="Error:  "/>
                <TextBlock x:Name="Error" Text="No Error"/>
            </StackPanel>
        </Border>
    </Grid>
</Window>
