<UserControl x:Class="Hearthstone_Deck_Tracker.FlyoutControls.Options.Tracker.TrackerHotKeys"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:hotKeys="clr-namespace:Hearthstone_Deck_Tracker.Utility.HotKeys"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
             xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:lex="http://wpflocalizeextension.codeplex.com"
             lex:LocalizeDictionary.DesignCulture="en"
             lex:ResxLocalizationProvider.DefaultAssembly="HearthstoneDeckTracker"
             lex:ResxLocalizationProvider.DefaultDictionary="Strings"
             mc:Ignorable="d"
             d:DesignHeight="600" d:DesignWidth="300">
    <StackPanel>
        <StackPanel.Resources>
            <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="Keys">
                <ObjectDataProvider.MethodParameters>
                    <x:Type TypeName="forms:Keys" />
                </ObjectDataProvider.MethodParameters>
            </ObjectDataProvider>
            <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="Mods">
                <ObjectDataProvider.MethodParameters>
                    <x:Type TypeName="hotKeys:ModifierKeys" />
                </ObjectDataProvider.MethodParameters>
            </ObjectDataProvider>
            <hotKeys:HotKeyManager x:Key="HotKeyManager" />
            <hotKeys:PredefinedHotKeyActions x:Key="PredefinedHotKeyActions" />
        </StackPanel.Resources>
        <DataGrid Name="DataGridHotKeys" Height="200"
                  ItemsSource="{Binding Path=RegisteredHotKeysInfo, Source={StaticResource HotKeyManager}}"
                  AutoGenerateColumns="False" CanUserAddRows="False" CanUserReorderColumns="False"
                  CanUserDeleteRows="False" CanUserResizeColumns="False" CanUserResizeRows="False"
                  CanUserSortColumns="False" IsReadOnly="True">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{lex:Loc Options_Tracker_Hotkeys_Table_Mod}" Binding="{Binding Key.Mod}" />
                <DataGridTextColumn Header="{lex:Loc Options_Tracker_Hotkeys_Table_Key}" Binding="{Binding Key.Key}" />
                <DataGridTextColumn Header="{lex:Loc Options_Tracker_Hotkeys_Table_Action}" Binding="{Binding Value}" />
            </DataGrid.Columns>
        </DataGrid>
        <Button Margin="0,5" Content="{lex:Loc Options_Tracker_Hotkeys_Button_Delete}" Click="ButtonDelete_OnClick" />
        <GroupBox Header="{lex:LocTextUpper Options_Tracker_Hotkeys_LabelNew}">
            <StackPanel>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Label Content="{lex:Loc Options_Tracker_Hotkeys_Label_Mod}" DockPanel.Dock="Left" Grid.Column="0" Grid.Row="0" />
                    <ComboBox Name="ComboBoxMod" ItemsSource="{Binding Source={StaticResource Mods}}"
                              SelectedIndex="0" Margin="5,2" Grid.Column="1" Grid.Row="0"
                              SelectionChanged="ComboBoxMod_OnSelectionChanged" />
                    <Label Content="{lex:Loc Options_Tracker_Hotkeys_Label_Key}" DockPanel.Dock="Left" Grid.Column="0" Grid.Row="1" />
                    <TextBox Name="TextBoxKey" controls:TextBoxHelper.Watermark="{lex:Loc Options_Tracker_Hotkeys_Text_Key_Watermark}" Margin="5,2"
                             Grid.Column="1" Grid.Row="1" PreviewKeyDown="TextBoxKey_OnPreviewKeyDown" />
                    <Label Content="{lex:Loc Options_Tracker_Hotkeys_Label_Action}" Grid.Column="0" Grid.Row="2" />
                    <ComboBox Name="ComboBoxActions" Margin="5,2"
                              ItemsSource="{Binding Path=PredefinedActionNames, Source={StaticResource PredefinedHotKeyActions}}"
                              SelectedIndex="1" Grid.Column="1" Grid.Row="2">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Title}" ToolTip="{Binding Description}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                </Grid>
                <TextBlock Margin="0,5,0,0" TextWrapping="Wrap" FontStyle="Normal" FontWeight="SemiBold"
                           Text="{Binding Path=SelectedItem.Title, ElementName=ComboBoxActions, StringFormat={}{0}:}" />
                <TextBlock Text="{Binding Path=SelectedItem.Description, ElementName=ComboBoxActions}"
                           TextWrapping="Wrap" FontStyle="Italic" />
                <TextBlock TextWrapping="Wrap" Foreground="Red"
                           Text="{Binding Path=ErrorText, RelativeSource={RelativeSource AncestorType=UserControl}}" />
                <Button Content="{lex:Loc Options_Tracker_Hotkeys_Button_AddNew}" Margin="0,5,0,0" Click="ButtonAddNew_OnClick"
                        IsEnabled="{Binding Path=SelectedHotKeyIsValue, RelativeSource={RelativeSource AncestorType=UserControl}}" />
            </StackPanel>
        </GroupBox>
    </StackPanel>
</UserControl>
