<Window x:Class="HavenSoft.HexManiac.WPF.Windows.OptionDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:hshmwpfc="clr-namespace:HavenSoft.HexManiac.WPF.Controls"
        xmlns:hshmcvmt="clr-namespace:HavenSoft.HexManiac.Core.ViewModels.Tools;assembly=HexManiac.Core"
        xmlns:images="clr-namespace:HavenSoft.HexManiac.Core.ViewModels.Images;assembly=HexManiac.Core"
        Title="" Width="450" SizeToContent="Height" MaxHeight="800">
   <DockPanel Background="{DynamicResource Background}">
      <Button Content="Cancel" IsCancel="True" Margin="5" DockPanel.Dock="Bottom" HorizontalAlignment="Right"/>
      <ItemsControl Name="Options" DockPanel.Dock="Bottom" Grid.IsSharedSizeScope="True">
         <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
               <WrapPanel HorizontalAlignment="Center"/>
            </ItemsPanelTemplate>
         </ItemsControl.ItemsPanel>
         <ItemsControl.ItemTemplate>
            <DataTemplate>
               <Grid TextBlock.TextAlignment="Center" Margin="5">
                  <Grid.ColumnDefinitions>
                     <ColumnDefinition SharedSizeGroup="ButtonGroup"/>
                  </Grid.ColumnDefinitions>
                  <Button Padding="5" ToolTip="{Binding Description}" Click="OptionClicked">
                     <StackPanel>
                        <Decorator Visibility="{Binding HasVisual, Converter={StaticResource BoolToVisibility}}">
                           <hshmwpfc:PixelImage DataContext="{Binding Visual}" />
                        </Decorator>
                        <TextBlock>
                           <Run Text="{Binding Option}" FontSize="20" FontWeight="Bold"/>
                           <LineBreak/>
                           <Run Text="{Binding ShortDescription}" FontStyle="Italic" FontSize="10"/>
                        </TextBlock>
                     </StackPanel>
                  </Button>
               </Grid>
            </DataTemplate>
         </ItemsControl.ItemTemplate>
      </ItemsControl>
      <ItemsControl Name="AdditionalDetails" HorizontalAlignment="Center" DockPanel.Dock="Bottom">
         <ItemsControl.ItemTemplate>
            <DataTemplate>
               <ItemsControl ItemsSource="{Binding}" HorizontalAlignment="Center">
                  <ItemsControl.Resources>
                     <DataTemplate DataType="{x:Type images:ReadonlyPixelViewModel}">
                        <hshmwpfc:PixelImage SnapsToDevicePixels="True" Margin="5"/>
                     </DataTemplate>
                     <DataTemplate DataType="{x:Type hshmcvmt:FlagViewModel}">
                        <CheckBox Content="{Binding Name}" IsChecked="{Binding IsSet}" Margin="10,5"/>
                     </DataTemplate>
                     <DataTemplate DataType="{x:Type hshmcvmt:EnumViewModel}">
                        <ComboBox ItemsSource="{Binding Options}" SelectedIndex="{Binding Choice}"/>
                     </DataTemplate>
                  </ItemsControl.Resources>
                  <ItemsControl.ItemsPanel>
                     <ItemsPanelTemplate>
                        <WrapPanel />
                     </ItemsPanelTemplate>
                  </ItemsControl.ItemsPanel>
               </ItemsControl>
            </DataTemplate>
         </ItemsControl.ItemTemplate>
      </ItemsControl>
      <TextBox Name="Prompt" BorderThickness="0" Background="Transparent" IsReadOnly="True" HorizontalAlignment="Center" Margin="5" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"/>
   </DockPanel>
</Window>
