<Window x:Class="HavenSoft.HexManiac.WPF.Windows.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:hsg3hv="clr-namespace:HavenSoft.HexManiac.WPF.Controls"
      xmlns:hshmcvm="clr-namespace:HavenSoft.HexManiac.Core.ViewModels;assembly=HexManiac.Core"
      xmlns:mapvm="clr-namespace:HavenSoft.HexManiac.Core.ViewModels.Map;assembly=HexManiac.Core"
      xmlns:hsv="clr-namespace:HavenSoft.HexManiac.WPF.Resources"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
      Icon="..\Resources\AppIcon.ico"
      PreviewMouseDown="RunDeferredActions"
      Title="Hex Maniac Advance" Height="480" MinHeight="300" Width="1105" MinWidth="400" AllowDrop="True" Background="{DynamicResource Backlight}">
   <Window.Resources>
      <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
   </Window.Resources>
   <Window.InputBindings>
      <KeyBinding Key="N" Modifiers="Ctrl" Command="{Binding New}" />
      <KeyBinding Key="O" Modifiers="Ctrl" Command="{Binding Open}" />
      <KeyBinding Key="T" Modifiers="Ctrl" Command="{Binding DuplicateCurrentTab}" />
      <KeyBinding Key="S" Modifiers="Ctrl" Command="{Binding Save}" />
      <KeyBinding Key="S" Modifiers="Ctrl+Shift" Command="{Binding SaveAs}" />
      <KeyBinding Key="A" Modifiers="Ctrl+Shift" Command="{Binding SaveAll}" />
      <KeyBinding Key="E" Modifiers="Ctrl" Command="{Binding ExportBackup}" />
      <KeyBinding Key="A" Modifiers="Ctrl" Command="{Binding SelectAll}" />
      <KeyBinding Key="F5" Command="{Binding RunFile}" CommandParameter="{DynamicResource FileSystem}"/>
      <KeyBinding Key="W" Modifiers="Ctrl" Command="{Binding Close}" CommandParameter="{DynamicResource FileSystem}" />

      <KeyBinding Key="Z" Modifiers="Ctrl" Command="{Binding Undo}" />
      <KeyBinding Key="Z" Modifiers="Ctrl+Shift" Command="{Binding Redo}" />
      <KeyBinding Key="Y" Modifiers="Ctrl" Command="{Binding Redo}" />
      <KeyBinding Key="X" Modifiers="Ctrl" Command="{Binding Cut}" />
      <KeyBinding Key="C" Modifiers="Ctrl" Command="{Binding Copy}" />
      <KeyBinding Key="C" Modifiers="Ctrl+Shift" Command="{Binding DeepCopy}" />
      <KeyBinding Key="V" Modifiers="Ctrl" Command="{Binding Paste}" />
      <KeyBinding Key="B" Modifiers="Ctrl" Command="{Binding Paste}" />
      <KeyBinding Key="D" Modifiers="Ctrl+Shift" Command="{Binding DiffSinceLastSave}" />
      <KeyBinding Key="Delete" Command="{Binding Delete}" />
      <KeyBinding Key="F" Modifiers="Ctrl" Command="{Binding ShowFind}">
         <KeyBinding.CommandParameter>
            <sys:Boolean>true</sys:Boolean>
         </KeyBinding.CommandParameter>
      </KeyBinding>
      <KeyBinding Key="F3" Command="{Binding FindNext}" CommandParameter="{Binding Text, ElementName=FindBox}"/>
      <KeyBinding Key="F3" Modifiers="Shift" Command="{Binding FindPrevious}" CommandParameter="{Binding Text, ElementName=FindBox}"/>
      <KeyBinding Key="G" Modifiers="Ctrl" Command="{Binding GotoViewModel.ShowGoto}">
         <KeyBinding.CommandParameter>
            <sys:Boolean>true</sys:Boolean>
         </KeyBinding.CommandParameter>
      </KeyBinding>
      <KeyBinding Key="OemMinus" Modifiers="Ctrl" Command="{Binding Back}" />
      <KeyBinding Key="OemMinus" Modifiers="Ctrl+Shift" Command="{Binding Forward}" />

      <KeyBinding Key="R" Modifiers="Ctrl" Command="{Binding ToggleShowAutomationPanelCommand}" />
      <KeyBinding Key="M" Modifiers="Ctrl" Command="{Binding ToggleMatrix}" />
      <KeyBinding Key="H" Modifiers="Ctrl" Command="{Binding ShowHexConverter}">
         <KeyBinding.CommandParameter>
            <sys:Boolean>true</sys:Boolean>
         </KeyBinding.CommandParameter>
      </KeyBinding>

      <KeyBinding Key="Esc" Command="{Binding ClearError}"/>
      <KeyBinding Key="Esc" Command="{Binding GotoViewModel.ShowGoto}">
         <KeyBinding.CommandParameter>
            <sys:Boolean>false</sys:Boolean>
         </KeyBinding.CommandParameter>
      </KeyBinding>

      <KeyBinding Gesture="{hsv:MultiKeyGesture Ctrl+D, T}" Command="{Binding DisplayAsText}"/>
      <KeyBinding Gesture="{hsv:MultiKeyGesture Ctrl+D, E}" Command="{Binding DisplayAsEventScript}"/>
      <KeyBinding Gesture="{hsv:MultiKeyGesture Ctrl+D, S}" Command="{Binding DisplayAsSprite}"/>
      <KeyBinding Gesture="{hsv:MultiKeyGesture Ctrl+D, C}" Command="{Binding DisplayAsColorPalette}"/>
   </Window.InputBindings>
   <Window.CommandBindings>
      <CommandBinding Command="NavigateJournal" Executed="ExecuteAnimation"/>
   </Window.CommandBindings>
   <Grid Name="ContentPanel">
      <DockPanel>
         <DockPanel DockPanel.Dock="Top" Background="{DynamicResource Background}">
            <DockPanel.Resources>
               <Style TargetType="Panel" x:Key="AnimateOnVisibilityChanged">
                  <Setter Property="HorizontalAlignment" Value="Right"/>
                  <Setter Property="DockPanel.Dock" Value="Right"/>
                  <Setter Property="Background" Value="{DynamicResource Backlight}"/>
               </Style>
            </DockPanel.Resources>
            <!-- Menu -->
            <Menu DockPanel.Dock="Left">
               <MenuItem Header="_File">
                  <MenuItem Header="_New" Command="{Binding New}" InputGestureText="Ctrl+N">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon New}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="_Open" Command="{Binding Open}" InputGestureText="Ctrl+O">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Open}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="Open Recent" ItemsSource="{Binding RecentFileViewModels}" IsEnabled="{Binding RecentFileMenuEnabled}">
                     <MenuItem.ItemContainerStyle>
                        <Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
                           <Setter Property="Header" Value="{Binding ShortName}"/>
                           <Setter Property="Command" Value="{Binding Open}"/>
                        </Style>
                     </MenuItem.ItemContainerStyle>
                  </MenuItem>
                  <MenuItem Header="Duplicate Current Tab" Command="{Binding DuplicateCurrentTab}" InputGestureText="Ctrl+T"/>
                  <Separator />
                  <MenuItem Header="_Save" Command="{Binding Save}" InputGestureText="Ctrl+S">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Save}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="Save _As" Command="{Binding SaveAs}" InputGestureText="Ctrl+Shift+S" />
                  <MenuItem Header="Save A_ll" Command="{Binding SaveAll}" InputGestureText="Ctrl+Shift+A" />
                  <MenuItem Header="_Export Backup" Command="{Binding ExportBackup}" InputGestureText="Ctrl+E" />
                  <Separator />
                  <MenuItem Header="Calculate Common _Hashes" Command="{hsv:MethodCommand CalculateHashes}" />
                  <MenuItem Header="_Run" Command="{Binding RunFile}" InputGestureText="F5" CommandParameter="{DynamicResource FileSystem}"/>
                  <Separator />
                  <MenuItem Header="_Close Current Tab" Command="{Binding Close}" CommandParameter="{DynamicResource FileSystem}" InputGestureText="Ctrl+W" />
                  <MenuItem Header="E_xit" Click="ExitClicked" InputGestureText="Alt+F4">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Exit}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
               </MenuItem>
               <MenuItem Header="_Edit">
                  <MenuItem Header="_Undo" Command="{Binding Undo}" InputGestureText="Ctrl+Z">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon UndoArrow}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="_Redo" Command="{Binding Redo}" InputGestureText="Ctrl+Y">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon RedoArrow}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <Separator />
                  <MenuItem Header="Display As...">
                     <MenuItem Header="Text" Command="{Binding DisplayAsText}" InputGestureText="Ctrl+D, T"/>
                     <MenuItem Header="Event Script" Command="{Binding DisplayAsEventScript}" InputGestureText="Ctrl+D, E"/>
                     <MenuItem Header="Sprite" Command="{Binding DisplayAsSprite}" InputGestureText="Ctrl+D, S"/>
                     <MenuItem Header="Color Palette" Command="{Binding DisplayAsColorPalette}" InputGestureText="Ctrl+D, C"/>
                  </MenuItem>
                  <MenuItem Header="Cu_t" Command="{Binding Cut}" InputGestureText="Ctrl+X"/>
                  <MenuItem Height="26" Header="_Copy" Command="{Binding Copy}" InputGestureText="Ctrl+C">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Copy}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="D_eep Copy" Command="{Binding DeepCopy}" InputGestureText="Ctrl+Shift+C"/>
                  <MenuItem Height="26" Header="_Paste / Replace" Command="{Binding Paste}" InputGestureText="Ctrl+V or Ctrl+B">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Paste}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="_Delete" Command="{Binding Delete}" InputGestureText="Del"/>
                  <MenuItem Header="_Select All" Command="{Binding SelectAll}" InputGestureText="Ctrl+A"/>
                  <Separator />
                  <MenuItem Header="_Find" Command="{Binding ShowFind}" InputGestureText="Ctrl+F">
                     <MenuItem.CommandParameter>
                        <sys:Boolean>true</sys:Boolean>
                     </MenuItem.CommandParameter>
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Search}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="Find _Next" Command="{Binding FindNext}" CommandParameter="{Binding Text, ElementName=FindBox}" InputGestureText="F3"/>
                  <MenuItem Header="Find _Previous" Command="{Binding FindPrevious}" CommandParameter="{Binding Text, ElementName=FindBox}" InputGestureText="Shift+F3"/>
                  <MenuItem Header="_Goto" Command="{Binding GotoViewModel.ShowGoto}" InputGestureText="Ctrl+G">
                     <MenuItem.CommandParameter>
                        <sys:Boolean>true</sys:Boolean>
                     </MenuItem.CommandParameter>
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Home}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="Go _Back" Command="{Binding Back}" InputGestureText="Ctrl+-"/>
                  <MenuItem Header="Go _Forward" Command="{Binding Forward}" InputGestureText="Ctrl+Shift+-"/>
                  <MenuItem Header="Show Hex Converter" Command="{Binding ShowHexConverter}" InputGestureText="Ctrl+H">
                     <MenuItem.CommandParameter>
                        <sys:Boolean>true</sys:Boolean>
                     </MenuItem.CommandParameter>
                  </MenuItem>
               </MenuItem>
               <MenuItem Header="_View">
                  <MenuItem Header="Diff">
                     <MenuItem Header="_Diff Since Last Save" Command="{Binding DiffSinceLastSave}" InputGestureText="Ctrl+Shift+D"/>
                     <MenuItem Header="Diff selected tab with left neighbor" Command="{Binding DiffLeft}" />
                     <MenuItem Header="Diff selected tab with right neighbor" Command="{Binding DiffRight}" />
                     <Separator />
                     <MenuItem Header="Exclude Pointer-only changes from diffs" IsCheckable="True" IsChecked="{Binding HideDiffPointerChanges}" />
                  </MenuItem>
                  <Separator/>
                  <MenuItem Header="Show _Matrix Grid" IsCheckable="True" IsChecked="{Binding ShowMatrix}" InputGestureText="Ctrl+M"/>
                  <MenuItem Header="_Animate when Scrolling" IsCheckable="True" IsChecked="{Binding AnimateScroll}"/>
                  <MenuItem Header="Use Table Entry Headers" IsCheckable="True" IsChecked="{Binding UseTableEntryHeaders}">
                     <MenuItem.ToolTip>
                        <ToolTip BorderThickness="0" Background="{DynamicResource Backlight}">
                           <TextBlock Text="Replaces raw address with a name when possible."/>
                        </ToolTip>
                     </MenuItem.ToolTip>
                  </MenuItem>
                  <MenuItem Header="Enable Single Table Focus" IsCheckable="True" IsChecked="{Binding AllowSingleTableMode}">
                     <MenuItem.ToolTip>
                        <ToolTip BorderThickness="0" Background="{DynamicResource Backlight}">
                           <TextBlock Text="Limit the scrollable area to a single table after a goto."/>
                        </ToolTip>
                     </MenuItem.ToolTip>
                  </MenuItem>
                  <Separator/>
                  <MenuItem Header="Reset _Zoom" Command="{Binding ResetZoom}">
                     <MenuItem.ToolTip>
                        <ToolTip BorderThickness="0" Background="{DynamicResource Backlight}">
                           <TextBlock Text="You can increase or decrease the size of the text in the cells using Ctrl+Scroll."/>
                        </ToolTip>
                     </MenuItem.ToolTip>
                  </MenuItem>
                  <MenuItem Header="Reset _Alignment" Command="{Binding ResetAlignment}" />
                  <MenuItem Header="C_ustomize Theme" Click="ShowThemeSelector"/>
                  <MenuItem Header="_Clear Error" Command="{Binding ClearError}" InputGestureText="Esc"/>
               </MenuItem>
               <MenuItem Header="Developer" Visibility="{Binding ShowDeveloperMenu, Converter={StaticResource BoolToVisibility}}">
                  <MenuItem Header="Copy Aligned Address" Command="{Binding CopyAlignedAddress}" CommandParameter="{DynamicResource FileSystem}"/>
                  <Separator />
                  <MenuItem Header="Assert" Click="DeveloperRaiseAssert"/>
                  <MenuItem Header="Throw ArgumentOutOfRangeException" Click="DeveloperThrowArgumentOutOfRangeException"/>
                  <MenuItem Header="Throw AggregateException" Click="DeveloperThrowAggregateException"/>
                  <MenuItem Header="Write Debug" Click="DeveloperWriteDebug"/>
                  <MenuItem Header="Write Trace" Click="DeveloperWriteTrace"/>
                  <MenuItem Header="Update Documentation Files" Click="DeveloperUpdateDocs"/>
                  <MenuItem Header="Run Garbage Collection" Click="DeveloperRunGarbageCollection"/>
                  <Separator />
                  <MenuItem Header="Force Metadata Reload" Click="DeveloperReloadMetadata" />
               </MenuItem>
               <MenuItem Header="Utilities">
                  <MenuItem Name="QuickEditsPokedex" Header="Pokedex" />
                  <MenuItem Name="QuickEditsExpansion" Header="Expand" />
                  <MenuItem Name="QuickEditsMisc" Header="Misc" />
                  <MenuItem Header="Scripts" Command="{Binding LaunchScriptsLocation}" />
               </MenuItem>
               <MenuItem Header="_Tools">
                  <MenuItem Header="_Hide All Tools" Command="{Binding Tools.HideCommand}"/>
                  <Separator/>
                  <MenuItem Header="Toggle _Table Tool" Command="{Binding Tools.TableToolCommand}"/>
                  <MenuItem Header="Toggle Te_xt Tool" Command="{Binding Tools.StringToolCommand}"/>
                  <MenuItem Header="Toggle _Image Tool" Command="{Binding Tools.SpriteToolCommand}"/>
                  <MenuItem Header="Toggle _Code Tool" Command="{Binding Tools.CodeToolCommand}"/>
                  <MenuItem Header="Show _Hex Converter" Command="{Binding ShowHexConverter}" InputGestureText="Ctrl+H">
                     <MenuItem.CommandParameter>
                        <sys:Boolean>true</sys:Boolean>
                     </MenuItem.CommandParameter>
                  </MenuItem>
                  <MenuItem Header="Toggle _Automation Tool" IsCheckable="True" IsChecked="{Binding ShowAutomationPanel}" InputGestureText="Ctrl+R" />
                  <Separator/>
                  <MenuItem Header="_Spartan Mode" IsCheckable="True" IsChecked="{Binding SpartanMode}">
                     <MenuItem.ToolTip>
                        <ToolTip>
                           <TextBlock>
                              Spartan Mode runs faster and uses less memory,
                              <LineBreak/>
                              but disables optional ease-of-use features.
                           </TextBlock>
                        </ToolTip>
                     </MenuItem.ToolTip>
                  </MenuItem>
               </MenuItem>
               <MenuItem Header="_Help">
                  <MenuItem Header="_Update" IsEnabled="{Binding IsNewVersionAvailable}" Click="UpdateClick" MouseMove="AcknowledgeAccentItem" Tag="NewVersionAcknowledged">
                     <MenuItem.ToolTip>
                        <ToolTip>
                           <ToolTip.Content>
                              <TextBlock>
                                 Takes you to the releases page so you
                                 <LineBreak/>
                                 can download the new version.
                              </TextBlock>
                           </ToolTip.Content>
                        </ToolTip>
                     </MenuItem.ToolTip>
                     <MenuItem.Style>
                        <Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
                           <Style.Triggers>
                              <MultiDataTrigger>
                                 <MultiDataTrigger.Conditions>
                                    <Condition Binding="{Binding NewVersionAcknowledged}" Value="False"/>
                                    <Condition Binding="{Binding IsNewVersionAvailable}" Value="True"/>
                                 </MultiDataTrigger.Conditions>
                                 <MultiDataTrigger.Setters>
                                    <Setter Property="Background" Value="{DynamicResource Accent}"/>
                                 </MultiDataTrigger.Setters>
                              </MultiDataTrigger>
                           </Style.Triggers>
                        </Style>
                     </MenuItem.Style>
                  </MenuItem>
                  <MenuItem Header="_Wiki" Click="WebLink" CommandParameter="https://github.com/haven1433/HexManiacAdvance/wiki" />
                  <MenuItem Header="_Tutorials" Click="WebLink" MouseMove="AcknowledgeAccentItem" Tag="TutorialsAcknowledged" CommandParameter="https://github.com/haven1433/HexManiacAdvance/wiki/Tutorials" />
                  <MenuItem Header="_Event Script Reference" Click="WebLink" CommandParameter="https://github.com/haven1433/HexManiacAdvance/wiki/Everything-You-Need-for-Event-Scripting-in-HexManiacAdvance" />
                  <MenuItem Header="_Online Reference Content">
                     <MenuItem Header="Ruby">
                        <MenuItem Header="List of Script Variables" Click="WebLink" CommandParameter="https://github.com/pret/pokeruby/blob/master/include/constants/vars.h" />
                        <MenuItem Header="List of Script Flags" Click="WebLink" CommandParameter="https://github.com/pret/pokeruby/blob/master/include/constants/flags.h" />
                        <MenuItem Header="List of All Symbols" Click="WebLink" CommandParameter="https://raw.githubusercontent.com/pret/pokeruby/symbols/pokeruby.sym" />
                        <MenuItem Header="Battle Outcome Constants" Click="WebLink" CommandParameter="https://github.com/pret/pokeruby/blob/master/include/constants/battle.h#L67" />
                     </MenuItem>
                     <MenuItem Header="FireRed">
                        <MenuItem Header="List of Script Variables" Click="WebLink" CommandParameter="https://github.com/pret/pokefirered/blob/master/include/constants/vars.h" />
                        <MenuItem Header="List of Script Flags" Click="WebLink" CommandParameter="https://github.com/pret/pokefirered/blob/master/include/constants/flags.h" />
                        <MenuItem Header="List of All Symbols" Click="WebLink" CommandParameter="https://raw.githubusercontent.com/pret/pokefirered/symbols/pokefirered.sym" />
                        <MenuItem Header="Battle Outcome Constants" Click="WebLink" CommandParameter="https://github.com/pret/pokefirered/blob/master/include/constants/battle.h#L75" />
                     </MenuItem>
                     <MenuItem Header="Emerald">
                        <MenuItem Header="List of Script Variables" Click="WebLink" CommandParameter="https://github.com/pret/pokeemerald/blob/master/include/constants/vars.h" />
                        <MenuItem Header="List of Script Flags" Click="WebLink" CommandParameter="https://github.com/pret/pokeemerald/blob/master/include/constants/flags.h" />
                        <MenuItem Header="List of All Symbols" Click="WebLink" CommandParameter="https://raw.githubusercontent.com/pret/pokeemerald/symbols/pokeemerald.sym" />
                        <MenuItem Header="Battle Outcome Constants" Click="WebLink" CommandParameter="https://github.com/pret/pokeemerald/blob/c32fbf594aec382e3bd58a6651e1e382c5105e4b/include/constants/battle.h#L88" />
                     </MenuItem>
                  </MenuItem>
                  <MenuItem Header="_Report an Issue" Click="WebLink" CommandParameter="https://github.com/haven1433/HexManiacAdvance/issues" />
                  <MenuItem Header="_Discord" Click="WebLink" CommandParameter="https://discord.gg/x9eQuBg">
                     <MenuItem.Icon>
                        <Path Data="{hsv:Icon Discord}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                     </MenuItem.Icon>
                  </MenuItem>
                  <MenuItem Header="A_ssist Development">
                     <MenuItem Header="_Copy Anchor Reference" Command="{Binding CopyAnchorReference}" CommandParameter="{DynamicResource FileSystem}"/>
                  </MenuItem>
                  <MenuItem Header="_About" Click="AboutClick"/>
               </MenuItem>
            </Menu>
            <!-- Find -->
            <StackPanel Name="FindPanel" Orientation="Horizontal" DockPanel.Dock="Right" Visibility="{Binding FindControlVisible, Converter={StaticResource BoolToVisibility}}">
               <TextBlock Text="Find :" Margin="10,0" />
               <ToggleButton Width="18" IsChecked="{Binding SearchAllFiles}">
                  <Path Data="{hsv:Icon Multiple}" Stretch="Uniform">
                     <Path.Style>
                        <Style TargetType="Path">
                           <Setter Property="Stroke" Value="{DynamicResource Secondary}" />
                           <Style.Triggers>
                              <DataTrigger Binding="{Binding SearchAllFiles}" Value="True">
                                 <Setter Property="Stroke" Value="{DynamicResource Primary}" />
                              </DataTrigger>
                           </Style.Triggers>
                        </Style>
                     </Path.Style>
                  </Path>
                  <ToggleButton.ToolTip>
                     <ToolTip>
                        <StackPanel>
                           <TextBlock>Search All Files</TextBlock>
                           <TextBlock FontStyle="Italic">
                              <TextBlock.Style>
                                 <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                    <Setter Property="Text" Value="On: Look for matches in all open tabs"/>
                                    <Style.Triggers>
                                       <DataTrigger Binding="{Binding SearchAllFiles}" Value="False">
                                          <Setter Property="Text" Value="Off: Look for matches only in active tab"/>
                                       </DataTrigger>
                                    </Style.Triggers>
                                 </Style>
                              </TextBlock.Style>
                           </TextBlock>
                        </StackPanel>
                     </ToolTip>
                  </ToggleButton.ToolTip>
               </ToggleButton>
               <ToggleButton Width="18" IsChecked="{Binding MatchExactCase}">
                  <ToggleButton.ToolTip>
                     <ToolTip>
                        <StackPanel>
                           <TextBlock>Match Exact Case</TextBlock>
                           <TextBlock FontStyle="Italic">
                              <TextBlock.Style>
                                 <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                    <Setter Property="Text" Value="Off: 'abc' can find 'ABC'"/>
                                    <Style.Triggers>
                                       <DataTrigger Binding="{Binding MatchExactCase}" Value="True">
                                          <Setter Property="Text" Value="On: 'abc' will not find 'ABC'"/>
                                       </DataTrigger>
                                    </Style.Triggers>
                                 </Style>
                              </TextBlock.Style>
                           </TextBlock>
                        </StackPanel>
                     </ToolTip>
                  </ToggleButton.ToolTip>
                  <TextBlock Text="Aa">
                     <TextBlock.Style>
                        <Style TargetType="TextBlock">
                           <Setter Property="Foreground" Value="{DynamicResource Secondary}" />
                           <Style.Triggers>
                              <DataTrigger Binding="{Binding MatchExactCase}" Value="True">
                                 <Setter Property="Foreground" Value="{DynamicResource Primary}" />
                              </DataTrigger>
                           </Style.Triggers>
                        </Style>
                     </TextBlock.Style>
                  </TextBlock>
               </ToggleButton>
               <TextBox Name="FindBox" MinWidth="200" IsVisibleChanged="EditBoxVisibilityChanged" Text="{Binding FindText, UpdateSourceTrigger=PropertyChanged}">
                  <TextBox.InputBindings>
                     <KeyBinding Key="Esc" Command="{Binding ShowFind}">
                        <KeyBinding.CommandParameter>
                           <sys:Boolean>false</sys:Boolean>
                        </KeyBinding.CommandParameter>
                     </KeyBinding>
                     <KeyBinding Key="Return" Command="{Binding Find}" CommandParameter="{Binding Text, ElementName=FindBox}"/>
                  </TextBox.InputBindings>
               </TextBox>
            </StackPanel>
            <!-- Hex Converter -->
            <StackPanel Name="HexConverter" Orientation="Horizontal" DockPanel.Dock="Right" Visibility="{Binding HexConverterVisible, Converter={StaticResource BoolToVisibility}}">
               <TextBlock Text="Hex :" Margin="10,0" />
               <TextBox Name="HexBox" MinWidth="100" IsVisibleChanged="EditBoxVisibilityChanged" Text="{Binding HexText, UpdateSourceTrigger=PropertyChanged}">
                  <TextBox.InputBindings>
                     <KeyBinding Key="Esc" Command="{Binding ShowHexConverter}">
                        <KeyBinding.CommandParameter>
                           <sys:Boolean>false</sys:Boolean>
                        </KeyBinding.CommandParameter>
                     </KeyBinding>
                  </TextBox.InputBindings>
               </TextBox>
               <TextBlock Text="Decimal :" Margin="10,0" />
               <TextBox Name="DecBox" MinWidth="100" IsVisibleChanged="EditBoxVisibilityChanged" Text="{Binding DecText, UpdateSourceTrigger=PropertyChanged}">
                  <TextBox.InputBindings>
                     <KeyBinding Key="Esc" Command="{Binding ShowHexConverter}">
                        <KeyBinding.CommandParameter>
                           <sys:Boolean>false</sys:Boolean>
                        </KeyBinding.CommandParameter>
                     </KeyBinding>
                  </TextBox.InputBindings>
               </TextBox>
            </StackPanel>
            <!-- Message -->
            <StackPanel Name="MessagePanel" Visibility="{Binding ShowMessage, Converter={StaticResource BoolToVisibility}}" Style="{StaticResource AnimateOnVisibilityChanged}" Orientation="Horizontal">
               <StackPanel.InputBindings>
                  <MouseBinding MouseAction="MiddleClick" Command="{Binding ClearMessage}"/>
               </StackPanel.InputBindings>
               <StackPanel.ContextMenu>
                  <ContextMenu>
                     <MenuItem Header="Copy Message" Command="{hsv:MethodCommand CopyMessage}" />
                  </ContextMenu>
               </StackPanel.ContextMenu>
               <TextBlock Margin="10,0" VerticalAlignment="Center" Text="{Binding InformationMessage}" Foreground="{DynamicResource Accent}"/>
               <Button Command="{Binding ClearMessage}" Width="15">
                  <Path Data="{hsv:Icon Exit}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
               </Button>
            </StackPanel>
            <!-- Error -->
            <Grid Name="ErrorPanel" Visibility="{Binding ShowError, Converter={StaticResource BoolToVisibility}}" Style="{StaticResource AnimateOnVisibilityChanged}">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition/>
                  <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>
               <Grid.InputBindings>
                  <MouseBinding MouseAction="MiddleClick" Command="{Binding ClearError}"/>
               </Grid.InputBindings>
               <Grid.ContextMenu>
                  <ContextMenu>
                     <MenuItem Header="Copy Error" Command="{hsv:MethodCommand CopyError}" />
                  </ContextMenu>
               </Grid.ContextMenu>
               <TextBlock Margin="10,0" VerticalAlignment="Center" Text="{Binding ErrorMessage}" TextWrapping="Wrap" TextAlignment="Right" Foreground="{DynamicResource Error}"/>
               <Button Command="{Binding ClearError}" Width="15" Grid.Column="1">
                  <Path Data="{hsv:Icon Exit}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
               </Button>
               <Border BorderThickness="1" IsHitTestVisible="False" Grid.ColumnSpan="2" BorderBrush="{DynamicResource Error}" />
            </Grid>
         </DockPanel>
         <StackPanel DockPanel.Dock="Top" Background="{DynamicResource Background}" HorizontalAlignment="Stretch" Orientation="Horizontal">
            <StackPanel.Resources>
               <Style TargetType="Path">
                  <Setter Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ButtonBase}}}"/>
                  <Setter Property="Stretch" Value="Uniform"/>
               </Style>
               <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                  <Setter Property="Background" Value="{DynamicResource Background}"/>
                  <Setter Property="Width" Value="28"/>
                  <Setter Property="Height" Value="28"/>
                  <Setter Property="Margin" Value="1"/>
               </Style>
               <Style TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
                  <Setter Property="Width" Value="30"/>
               </Style>
            </StackPanel.Resources>
            <Button ToolTip="Navigate Back (Ctrl + (-))" Command="{Binding Back}">
               <Path Data="{hsv:Icon LeftArrow}"/>
            </Button>
            <Button ToolTip="Navigate Forward (Ctrl+Shift + (-))" Command="{Binding Forward}">
               <Path Data="{hsv:Icon RightArrow}"/>
            </Button>
            <Rectangle Width="5"/>
            <Button Command="{Binding Save}">
               <Button.Style>
                  <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                     <Setter Property="ToolTip" Value="Save (Ctrl+S)"/>
                     <Style.Triggers>
                        <Trigger Property="IsEnabled" Value="True">
                           <Setter Property="Foreground" Value="{DynamicResource Accent}"/>
                        </Trigger>
                        <DataTrigger Binding="{Binding IsMetadataOnlyChange}" Value="True">
                           <Setter Property="Foreground" Value="{DynamicResource Primary}"/>
                           <Setter Property="ToolTip">
                              <Setter.Value>
                                 <TextBlock>
                                    Save (Ctrl+S)
                                    <LineBreak/>
                                    <Italic FontSize="10">(Only metadata changes)</Italic>
                                 </TextBlock>
                              </Setter.Value>
                           </Setter>
                        </DataTrigger>
                     </Style.Triggers>
                  </Style>
               </Button.Style>
               <Path Data="{hsv:Icon Save}"/>
            </Button>
            <Rectangle Width="5"/>
            <Button ToolTip="Undo (Ctrl+Z)" Command="{Binding Undo}">
               <Path Data="{hsv:Icon UndoArrow}"/>
            </Button>
            <Button ToolTip="Redo (Ctrl+Y)" Command="{Binding Redo}">
               <Path Data="{hsv:Icon RedoArrow}"/>
            </Button>
            <Rectangle Width="5"/>
            <Button ToolTip="Show Goto Menu (Ctrl+G)" Command="{Binding GotoViewModel.ShowGoto}">
               <Button.Style>
                  <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                     <Style.Triggers>
                        <DataTrigger Binding="{Binding GotoViewModel.ControlVisible}" Value="True">
                           <Setter Property="Foreground" Value="{DynamicResource Accent}"/>
                        </DataTrigger>
                     </Style.Triggers>
                  </Style>
               </Button.Style>
               <Path Data="{hsv:Icon Home}"/>
            </Button>
            <Button ToolTip="Find (Ctrl+F)" Command="{Binding ShowFind}">
               <Button.Style>
                  <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                     <Style.Triggers>
                        <DataTrigger Binding="{Binding FindControlVisible}" Value="True">
                           <Setter Property="Foreground" Value="{DynamicResource Accent}"/>
                        </DataTrigger>
                     </Style.Triggers>
                  </Style>
               </Button.Style>
               <Path Data="{hsv:Icon Search}"/>
            </Button>
            <Rectangle Width="5"/>
            <Button ToolTip="Launch Saved File (F5)" Command="{Binding RunFile}" CommandParameter="{DynamicResource FileSystem}">
               <Button.Style>
                  <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                     <Style.Triggers>
                        <Trigger Property="IsEnabled" Value="True">
                           <Setter Property="Foreground" Value="{DynamicResource Stream2}"/>
                        </Trigger>
                     </Style.Triggers>
                  </Style>
               </Button.Style>
               <Path Data="M0,0 L5,5 0,10 Z"/>
            </Button>
            <Rectangle Width="5"/>

            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5,0,0,0" Height="18" Visibility="{Binding ShowWidthOptions, Converter={StaticResource BoolToVisibility}}">
               <TextBlock Foreground="{DynamicResource Secondary}" Text="Row Width:"/>
               <TextBox Text="{Binding SelectedTab.PreferredWidth, UpdateSourceTrigger=PropertyChanged}" Width="30" HorizontalContentAlignment="Right" Margin="5,0"/>
               <ToggleButton IsChecked="{Binding SelectedTab.StretchData}" ToolTip="Stretch Cells to fill available space.">
                  <ToggleButton.Content>
                     <Path Data="{hsv:Icon ArrowsLeftRight}"/>
                  </ToggleButton.Content>
               </ToggleButton>
               <ToggleButton IsChecked="{Binding SelectedTab.AutoAdjustDataWidth}" VerticalContentAlignment="Center" ToolTip="Adjust Width after Goto">
                  <ToggleButton.Content>
                     <TextBlock Text="Auto" VerticalAlignment="Bottom" Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ToggleButton}}}"/>
                  </ToggleButton.Content>
               </ToggleButton>
               <ToggleButton IsChecked="{Binding SelectedTab.AllowMultipleElementsPerLine}" ToolTip="Allow Multiple Rows per Line.">
                  <ToggleButton.Content>
                     <Path Data="{hsv:Icon MultiList}"/>
                  </ToggleButton.Content>
               </ToggleButton>
            </StackPanel>
         </StackPanel>
         <Border DockPanel.Dock="Top" Height="1" Background="{DynamicResource Backlight}"/>
         <Grid Background="{DynamicResource Background}">
            <hsg3hv:StartScreen>
               <hsg3hv:StartScreen.Style>
                  <Style TargetType="FrameworkElement">
                     <Setter Property="Visibility" Value="Collapsed"/>
                     <Style.Triggers>
                        <DataTrigger Binding="{Binding ElementName=Tabs, Path=SelectedIndex}" Value="-1">
                           <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                     </Style.Triggers>
                  </Style>
               </hsg3hv:StartScreen.Style>
            </hsg3hv:StartScreen>
            <Grid Name="TabContainer">
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*"/>
                  <ColumnDefinition Width="0"/>
                  <ColumnDefinition Width="0"/>
               </Grid.ColumnDefinitions>
               <TabControl Name="Tabs" ItemsSource="{Binding}" SelectedIndex="{Binding SelectedIndex}">
                  <TabControl.Style>
                     <Style TargetType="TabControl" BasedOn="{StaticResource {x:Type TabControl}}">
                        <Style.Triggers>
                           <Trigger Property="SelectedIndex" Value="-1">
                              <Setter Property="Visibility" Value="Collapsed"/>
                           </Trigger>
                        </Style.Triggers>
                     </Style>
                  </TabControl.Style>
                  <TabControl.InputBindings>
                     <KeyBinding Key="Esc" Command="{Binding HideSearchControls}"/>
                  </TabControl.InputBindings>
                  <TabControl.ItemTemplate>
                     <DataTemplate>
                        <Grid>
                           <Grid.ColumnDefinitions>
                              <ColumnDefinition Width="*" />
                              <ColumnDefinition Width="Auto" />
                           </Grid.ColumnDefinitions>
                           <Grid.ToolTip>
                              <ToolTip BorderThickness="0" Background="{DynamicResource Backlight}">
                                 <TextBlock Text="{Binding FullFileName}"/>
                              </ToolTip>
                           </Grid.ToolTip>
                           <Grid.ContextMenu>
                              <ContextMenu>
                                 <MenuItem Header="Show in File Explorer" Command="{hsv:MethodCommand LaunchFileLocation}" CommandParameter="{DynamicResource FileSystem}" />
                                 <MenuItem Header="Duplicate Tab" InputGestureText="Ctrl+T" Command="{hsv:MethodCommand Duplicate}"/>
                                 <MenuItem Header="Diff with Left" Command="{Binding DiffLeft}" />
                                 <MenuItem Header="Diff with Right" Command="{Binding DiffRight}" />
                                 <Separator/>
                                 <MenuItem Header="Make IPS Patch, this -> Right" Command="{hsv:MethodCommand IpsPatchRight}"/>
                                 <MenuItem Header="Make UPS Patch, this -> Right" Command="{hsv:MethodCommand UpsPatchRight}"/>
                              </ContextMenu>
                           </Grid.ContextMenu>
                           <TextBlock Name="TabTextBlock" Background="Transparent" Text="{Binding Name}" Foreground="{DynamicResource Primary}" MouseDown="TabMouseDown" MouseMove="TabMouseMove" MouseUp="TabMouseUp">
                              <TextBlock.InputBindings>
                                 <MouseBinding MouseAction="MiddleClick" Command="{Binding Close}" CommandParameter="{DynamicResource FileSystem}"/>
                              </TextBlock.InputBindings>
                           </TextBlock>
                           <Button Command="{Binding Close}" CommandParameter="{DynamicResource FileSystem}" Width="15" Margin="5,0,0,0" Background="{DynamicResource Background}" BorderBrush="{DynamicResource Background}"
                                   Grid.Column="1" 
                                   VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
                              <Path Data="{hsv:Icon Exit}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                           </Button>
                        </Grid>
                     </DataTemplate>
                  </TabControl.ItemTemplate>
                  <TabControl.ContentTemplate>
                     <DataTemplate>
                        <ContentControl Content="{Binding}">
                           <ContentControl.Resources>
                              <DataTemplate DataType="{x:Type hshmcvm:ViewPort}">
                                 <hsg3hv:TabView
                                          FocusElement="FocusTabElement"
                                          AnimateScroll="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.AnimateScroll}"
                                          ZoomLevel="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ZoomLevel}"/>
                              </DataTemplate>
                              <DataTemplate DataType="{x:Type hshmcvm:SearchResultsViewPort}">
                                 <hsg3hv:TabView
                                          AnimateScroll="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.AnimateScroll}"
                                          ZoomLevel="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ZoomLevel}"/>
                              </DataTemplate>
                              <DataTemplate DataType="{x:Type hshmcvm:DiffViewPort}">
                                 <hsg3hv:TabView
                                          AnimateScroll="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.AnimateScroll}"
                                          ZoomLevel="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ZoomLevel}"/>
                              </DataTemplate>
                              <DataTemplate DataType="{x:Type hshmcvm:DexReorderTab}">
                                 <hsg3hv:DexReorderView />
                              </DataTemplate>
                              <DataTemplate DataType="{x:Type hshmcvm:ImageEditorViewModel}">
                                 <hsg3hv:ImageEditorView />
                              </DataTemplate>
                              <DataTemplate DataType="{x:Type mapvm:MapEditorViewModel}">
                                 <hsg3hv:MapTab FocusElement="FocusTabElement" x:Name="MapTab" />
                              </DataTemplate>
                           </ContentControl.Resources>
                        </ContentControl>
                     </DataTemplate>
                  </TabControl.ContentTemplate>
               </TabControl>
               <GridSplitter Name="PythonToolSplitter" Grid.Column="1" HorizontalAlignment="Stretch" Background="{DynamicResource Backlight}" Width="4"/>
               <DockPanel Grid.Column="2">
                  <hsg3hv:PythonPanel x:Name="PythonTool" DataContext="{Binding PythonTool}"/>
               </DockPanel>
            </Grid>
            <Rectangle Fill="{DynamicResource Background}" Name="GotoBackground" Visibility="{Binding GotoViewModel.ControlVisible, Converter={StaticResource BoolToVisibility}}"/>
            <!-- Goto Panel -->
            <ScrollViewer Name="GotoPanel" VerticalScrollBarVisibility="Auto" Visibility="{Binding GotoViewModel.ControlVisible, Converter={StaticResource BoolToVisibility}}">
               <ScrollViewer.InputBindings>
                  <KeyBinding Key="Esc" Command="{Binding GotoViewModel.ShowGoto}">
                     <KeyBinding.CommandParameter>
                        <sys:Boolean>false</sys:Boolean>
                     </KeyBinding.CommandParameter>
                  </KeyBinding>
                  <KeyBinding Key="Return" Command="{Binding GotoViewModel.Goto}"/>
               </ScrollViewer.InputBindings>
               <Grid>
                  <Grid.RowDefinitions>
                     <RowDefinition Height="*"/>
                     <RowDefinition Height="Auto"/>
                     <RowDefinition Height="*"/>
                     <RowDefinition Height="Auto"/>
                     <RowDefinition Height="*"/>
                  </Grid.RowDefinitions>
                  <StackPanel Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
                     <Grid HorizontalAlignment="Stretch" Width="400">
                        <Path Data="{hsv:Icon Home}" Opacity=".5" Fill="{DynamicResource Secondary}" Stretch="Uniform" Width="20" Height="20" HorizontalAlignment="Left"/>
                        <TextBlock FontSize="20" Text="Goto:" HorizontalAlignment="Center"/>
                        <Button Background="{DynamicResource Background}" BorderBrush="{DynamicResource Secondary}" Command="{Binding GotoViewModel.ShowGoto}" Padding="4"
                                 ToolTip="Close (esc)"
                                 DockPanel.Dock="Right" Width="20" Height="20" VerticalAlignment="Top" HorizontalAlignment="Right" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
                           <Button.CommandParameter>
                              <sys:Boolean>false</sys:Boolean>
                           </Button.CommandParameter>
                           <Path Data="{hsv:Icon Exit}" Fill="{DynamicResource Secondary}" Stretch="Uniform"/>
                        </Button>
                     </Grid>
                     <Grid>
                        <TextBlock Text="Loading..." FontSize="20" Foreground="{StaticResource Secondary}" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding GotoViewModel.Loading, Converter={StaticResource BoolToVisibility}}"/>
                        <ItemsControl ItemsSource="{Binding GotoViewModel.Shortcuts}" HorizontalAlignment="Center">
                           <ItemsControl.ItemsPanel>
                              <ItemsPanelTemplate>
                                 <WrapPanel/>
                              </ItemsPanelTemplate>
                           </ItemsControl.ItemsPanel>
                           <ItemsControl.ItemTemplate>
                              <DataTemplate>
                                 <Button FontWeight="Bold" Name="ShortcutButton" Command="{hsv:MethodCommand Goto}" BorderBrush="{DynamicResource Primary}"
                                         Visibility="{Binding Visible, Converter={StaticResource BoolToVisibility}}">
                                    <Button.Style>
                                       <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                                          <Setter Property="Width" Value="100"/>
                                          <Setter Property="Height" Value="100"/>
                                          <Setter Property="Padding" Value="10"/>
                                          <Setter Property="Margin" Value="10"/>
                                          <Style.Triggers>
                                             <DataTrigger Binding="{Binding SmallMode}" Value="True">
                                                <Setter Property="Width" Value="50"/>
                                                <Setter Property="Height" Value="50"/>
                                                <Setter Property="Padding" Value="2"/>
                                                <Setter Property="Margin" Value="5"/> 
                                             </DataTrigger>
                                          </Style.Triggers>
                                       </Style>
                                    </Button.Style>
                                    <DockPanel>
                                       <Viewbox DockPanel.Dock="Bottom" StretchDirection="DownOnly" HorizontalAlignment="Center">
                                          <TextBlock Text="{Binding DisplayText}"/>
                                       </Viewbox>
                                       <Viewbox Stretch="Uniform" MinWidth="32" MinHeight="32">
                                          <hsg3hv:PixelImage DataContext="{Binding Image}" UseTrueTransparency="True"/>
                                       </Viewbox>
                                    </DockPanel>
                                 </Button>
                              </DataTemplate>
                           </ItemsControl.ItemTemplate>
                        </ItemsControl>
                     </Grid>
                  </StackPanel>
                  <TextBlock HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,10,0" Text="Explore More..." Grid.Row="2" FontSize="20" Foreground="{DynamicResource Secondary}"/>
                  <StackPanel Grid.Row="3" VerticalAlignment="Center">
                     <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                        <Grid>
                           <hsg3hv:AngleTextBox x:Name="GotoBox" FontSize="30" MinHeight="44" MinWidth="400" Direction="Out"
                                 TextBinding="{Binding GotoViewModel.Text, UpdateSourceTrigger=PropertyChanged}"
                                 IsVisibleChanged="EditBoxVisibilityChanged">
                              <hsg3hv:AngleTextBox.InputBindings>
                                 <KeyBinding Key="Esc" Command="{Binding GotoViewModel.ShowGoto}">
                                    <KeyBinding.CommandParameter>
                                       <sys:Boolean>false</sys:Boolean>
                                    </KeyBinding.CommandParameter>
                                 </KeyBinding>
                                 <KeyBinding Key="Return" Command="{Binding GotoViewModel.Goto}"/>
                              </hsg3hv:AngleTextBox.InputBindings>
                           </hsg3hv:AngleTextBox>
                           <TextBlock IsHitTestVisible="False" Foreground="{DynamicResource Secondary}" FontStyle="Italic" FontSize="25" VerticalAlignment="Bottom" Margin="10,3,10,3" Text="Search or type an Address">
                              <TextBlock.Style>
                                 <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                    <Style.Triggers>
                                       <DataTrigger Binding="{Binding GotoViewModel.Text}" Value="">
                                          <Setter Property="Visibility" Value="Visible"/>
                                       </DataTrigger>
                                    </Style.Triggers>
                                 </Style>
                              </TextBlock.Style>
                           </TextBlock>
                        </Grid>
                        <hsg3hv:AngleButton VerticalAlignment="Stretch" Padding="2,0" Direction="Right"
                           Command="{Binding GotoViewModel.Goto}" Background="{DynamicResource Accent}" HorizontalContentAlignment="Center">
                           <TextBlock Text="Best Match" MinWidth="60" />
                        </hsg3hv:AngleButton>
                     </StackPanel>
                     <ItemsControl MinHeight="100" ItemsSource="{Binding GotoViewModel.PrefixSelections}">
                        <ItemsControl.ItemTemplate>
                           <DataTemplate>
                              <StackPanel>
                                 <Rectangle HorizontalAlignment="Stretch" Height="1" Margin="0,3" Fill="{DynamicResource Secondary}" Width="{Binding ActualWidth, ElementName=GotoBox}"/>
                                 <ItemsControl ItemsSource="{Binding Tokens}" HorizontalAlignment="Center">
                                    <ItemsControl.ItemsPanel>
                                       <ItemsPanelTemplate>
                                          <UniformGrid Rows="{Binding Height}" Columns="{Binding Width}"/>
                                       </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                    <ItemsControl.ItemTemplate>
                                       <DataTemplate>
                                          <Border Margin="5" BorderThickness="1">
                                             <Border.Style>
                                                <Style TargetType="Border">
                                                   <Setter Property="BorderBrush" Value="Transparent"/>
                                                   <Style.Triggers>
                                                      <Trigger Property="IsMouseOver" Value="True">
                                                         <Setter Property="BorderBrush" Value="{DynamicResource Primary}"/>
                                                      </Trigger>
                                                      <MultiDataTrigger>
                                                         <MultiDataTrigger.Conditions>
                                                            <Condition Binding="{Binding IsSelected}" Value="True"/>
                                                            <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True"/>
                                                         </MultiDataTrigger.Conditions>
                                                         <Setter Property="BorderBrush" Value="{DynamicResource Accent}"/>
                                                      </MultiDataTrigger>
                                                   </Style.Triggers>
                                                </Style>
                                             </Border.Style>
                                             <Border BorderThickness="1">
                                                <Border.Style>
                                                   <Style TargetType="Border">
                                                      <Setter Property="BorderBrush" Value="{DynamicResource Primary}"/>
                                                      <Style.Triggers>
                                                         <DataTrigger Binding="{Binding IsSelected}" Value="True">
                                                            <Setter Property="BorderBrush" Value="{DynamicResource Accent}"/>
                                                         </DataTrigger>
                                                         <DataTrigger Binding="{Binding IsSelectable}" Value="False">
                                                            <Setter Property="ToolTipService.InitialShowDelay" Value="0" />
                                                            <Setter Property="ToolTip" Value="Too many options. Use the textbox above to filter results."/>
                                                         </DataTrigger>
                                                      </Style.Triggers>
                                                   </Style>
                                                </Border.Style>
                                                <Grid>
                                                   <ToggleButton
                                                      BorderThickness="0"
                                                      Content="{Binding Content}"
                                                      IsChecked="{Binding IsSelected}"
                                                      Padding="6"
                                                      FontSize="15"
                                                      IsEnabled="{Binding IsSelectable}">
                                                      <ToggleButton.Style>
                                                         <Style TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
                                                            <Setter Property="ToolTipService.InitialShowDelay" Value="0" />
                                                            <Setter Property="ToolTip">
                                                               <Setter.Value>
                                                                  <hsg3hv:HexContentToolTip DataContext="{Binding PlacementTarget.DataContext.HoverTip, RelativeSource={RelativeSource Self}}"/>
                                                               </Setter.Value>
                                                            </Setter>
                                                            <Style.Triggers>
                                                               <DataTrigger Binding="{Binding HoverTip}" Value="{x:Null}">
                                                                  <Setter Property="ToolTip" Value="{x:Null}"/>
                                                               </DataTrigger>
                                                            </Style.Triggers>
                                                         </Style>
                                                      </ToggleButton.Style>
                                                   </ToggleButton>
                                                   <Path Data="{hsv:Icon Chevron}" Fill="{DynamicResource Secondary}"
                                                         Stretch="Uniform" Width="10" Height="10" Margin="2" IsHitTestVisible="False"
                                                         HorizontalAlignment="Right" VerticalAlignment="Bottom">
                                                      <Path.Style>
                                                         <Style TargetType="Path">
                                                            <Style.Triggers>
                                                               <DataTrigger Binding="{Binding IsGoto}" Value="True">
                                                                  <Setter Property="Visibility" Value="Collapsed" />
                                                               </DataTrigger>
                                                            </Style.Triggers>
                                                         </Style>
                                                      </Path.Style>
                                                   </Path>
                                                </Grid>
                                             </Border>
                                          </Border>
                                       </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                 </ItemsControl>
                              </StackPanel>
                           </DataTemplate>
                        </ItemsControl.ItemTemplate>
                     </ItemsControl>
                  </StackPanel>
               </Grid>
            </ScrollViewer>
         </Grid>
      </DockPanel>
      <Border IsHitTestVisible="False" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="10"
         BorderBrush="{DynamicResource Background}" Visibility="{Binding ShowOverlayText, Converter={StaticResource BoolToVisibility}}">
         <TextBox IsReadOnly="True" FontSize="20" TextBlock.LineHeight="25"
            Background="{DynamicResource Background}" BorderBrush="{DynamicResource Accent}" Text="{Binding OverlayText}" />
      </Border>
      <Rectangle Name="FocusAnimationElement" StrokeThickness="3" Stroke="{DynamicResource Accent}" Visibility="Visible" HorizontalAlignment="Right" VerticalAlignment="Top"/>
   </Grid>
</Window>
