<UserControl x:Class="DS4WinWPF.DS4Forms.ProfileEditor"
             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:local="clr-namespace:DS4WinWPF.DS4Forms"
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:lex="http://wpflocalizeextension.codeplex.com"
             lex:LocalizeDictionary.DesignCulture=""
             lex:ResxLocalizationProvider.DefaultAssembly="DS4Windows"
             lex:ResxLocalizationProvider.DefaultDictionary="Strings"
             mc:Ignorable="d" 
             d:DesignHeight="550" d:DesignWidth="1000">
    <DockPanel>
        <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,4,0,10">
            <TextBlock Text="{lex:LocText Profile, Suffix=:}" VerticalAlignment="Center" Margin="0,0,8,0"/>
            <TextBox x:Name="profileNameTxt" Text="" Width="160" VerticalContentAlignment="Center" />
            <Button x:Name="saveBtn" Content="{lex:Loc SaveProfile}" Margin="10,0,0,0" Click="SaveBtn_Click" />
            <Button x:Name="cancelBtn" Content="{lex:Loc Cancel}" Margin="10,0,0,0" Click="CancelBtn_Click" />
            <Button x:Name="keepSizeBtn" Margin="10,0,0,0" Click="KeepSizeBtn_Click">
                <StackPanel Orientation="Horizontal" Margin="0">
                    <Image x:Name="sizeImage" Source="/DS4Windows;component/Resources/size.png" Width="20" Height="20"/>
                    <TextBlock x:Name="sizeMsg" Text="Keep this window size after closing" Margin="4,0,0,0" VerticalAlignment="Center" />
                </StackPanel>

            </Button>
        </StackPanel>
        <TabControl x:Name="sidebarTabControl" Width="440" DockPanel.Dock="Left" SelectionChanged="SidebarTabControl_SelectionChanged">
            <TabItem Header="Controls">
                <DockPanel Width="440" LastChildFill="False">
                    <DockPanel.Background>
                        <SolidColorBrush Color="DimGray"/>
                    </DockPanel.Background>
                    <Canvas x:Name="conCanvas" Width="440" Height="240" Margin="0,10,0,0" DockPanel.Dock="Top" >
                        <Canvas.Resources>
                            <ContextMenu x:Key="presetMenu">
                                <MenuItem x:Name="controlNameItem" Header="Name" IsEnabled="False" />
                                <Separator />
                                <MenuItem Header="Default" Tag="0" Click="PresetMenuItem_Click" />
                                <MenuItem Header="DPad">
                                    <MenuItem Header="Normal" Tag="1" CommandParameter="0" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted" Tag="1" CommandParameter="1" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted X" Tag="1" CommandParameter="2" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted Y" Tag="1" CommandParameter="3" Click="PresetMenuItem_Click" />
                                </MenuItem>
                                <MenuItem Header="Left Stick">
                                    <MenuItem Header="Normal" Tag="2" CommandParameter="0" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted" Tag="2" CommandParameter="1" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted X" Tag="2" CommandParameter="2" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted Y" Tag="2" CommandParameter="3" Click="PresetMenuItem_Click" />
                                </MenuItem>
                                <MenuItem Header="Right Stick">
                                    <MenuItem Header="Normal" Tag="3" CommandParameter="0" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted" Tag="3" CommandParameter="1" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted X" Tag="3" CommandParameter="2" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted Y" Tag="3" CommandParameter="3" Click="PresetMenuItem_Click" />
                                </MenuItem>
                                <MenuItem Header="Face Buttons" Tag="4" Click="PresetMenuItem_Click" />
                                <MenuItem Header="WASD" Tag="5" Click="PresetMenuItem_Click" />
                                <MenuItem Header="Arrow Keys" Tag="6" Click="PresetMenuItem_Click" />
                                <MenuItem Header="Mouse">
                                    <MenuItem Header="Normal" Tag="7" CommandParameter="0" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted" Tag="7" CommandParameter="1" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted X" Tag="7" CommandParameter="2" Click="PresetMenuItem_Click" />
                                    <MenuItem Header="Inverted Y" Tag="7" CommandParameter="3" Click="PresetMenuItem_Click" />
                                </MenuItem>
                            </ContextMenu>
                        </Canvas.Resources>

                        <Image Source="/DS4Windows;component/Resources/DS4 Config.png" Width="440" Height="220" Stretch="Uniform"/>

                        <Image x:Name="picBoxHover" IsEnabled="False" Source="/DS4Windows;component/Resources/DS4-Config_RS.png" Height="48" Width="48" Canvas.Left="447" Canvas.Top="5" />
                        <Image x:Name="picBoxHover2" IsEnabled="False" Source="/DS4Windows;component/Resources/DS4-Config_RS.png" Height="48" Width="48" Canvas.Left="0" Canvas.Top="0" Stretch="Fill" />

                        <Button Content="Cross" x:Name="crossConBtn" Canvas.Left="330" Canvas.Top="125" Width="26" Height="26" Click="HoverConBtn_Click" Style="{StaticResource NoBGHoverBtn}" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Circle" x:Name="circleConBtn" Canvas.Left="357" Canvas.Top="99" Width="26" Height="26" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Square" x:Name="squareConBtn" Canvas.Left="300" Canvas.Top="98" Width="26" Height="26" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Triangle" x:Name="triangleConBtn" Canvas.Left="330" Canvas.Top="74" Width="26" Height="26" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />

                        <Button Content="L1" x:Name="l1ConBtn" Canvas.Left="75" Canvas.Top="22" Width="50" Height="18" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="R1" x:Name="r1ConBtn" Canvas.Left="317" Canvas.Top="22" Width="50" Height="18" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="L2" x:Name="l2ConBtn" Canvas.Left="78" Canvas.Top="0" Width="46" Height="20" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="R2" x:Name="r2ConBtn" Canvas.Left="316" Canvas.Top="0" Width="46" Height="20" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />

                        <Button Content="Share" x:Name="shareConBtn" Canvas.Left="134" Canvas.Top="63" Width="16" Height="24" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Options" x:Name="optionsConBtn" Canvas.Left="291" Canvas.Top="63" Width="16" Height="24" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Guide" x:Name="guideConBtn" Canvas.Left="211" Canvas.Top="144" Width="20" Height="20" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />

                        <Button Content="Left Touch" x:Name="leftTouchConBtn" Canvas.Left="158" Canvas.Top="69" Width="37" Height="51" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Multi Touch" x:Name="multiTouchConBtn" Canvas.Left="199" Canvas.Top="74" Width="41" Height="45" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Right Touch" x:Name="rightTouchConBtn" Canvas.Left="251" Canvas.Top="70" Width="32" Height="53" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />
                        <Button Content="Top Touch" x:Name="topTouchConBtn" Canvas.Left="157" Canvas.Top="46" Width="125" Height="23" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave" />

                        <Button Content="L3" x:Name="l3ConBtn" Canvas.Left="138" Canvas.Top="147" Width="42" Height="42" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="LSU" x:Name="lsuConBtn" Canvas.Left="150" Canvas.Top="140" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="LSR" x:Name="lsrConBtn" Canvas.Left="172" Canvas.Top="162" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="LSD" x:Name="lsdConBtn" Canvas.Left="150" Canvas.Top="180" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="LSL" x:Name="lslConBtn" Canvas.Left="126" Canvas.Top="162" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />

                        <Button Content="R3" x:Name="r3ConBtn" Canvas.Left="262" Canvas.Top="149" Width="42" Height="42" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="RSU" x:Name="rsuConBtn" Canvas.Left="275" Canvas.Top="142" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="RSR" x:Name="rsrConBtn" Canvas.Left="298" Canvas.Top="162" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="RSD" x:Name="rsdConBtn" Canvas.Left="275" Canvas.Top="180" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="RSL" x:Name="rslConBtn" Canvas.Left="248" Canvas.Top="162" Width="17" Height="15" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />

                        <Button Content="Up" x:Name="upConBtn" Canvas.Left="88" Canvas.Top="74" Width="20" Height="35" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="Right" x:Name="rightConBtn" Canvas.Left="103" Canvas.Top="103" Width="35" Height="20" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="Down" x:Name="downConBtn" Canvas.Left="88" Canvas.Top="114" Width="20" Height="35" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />
                        <Button Content="Left" x:Name="leftConBtn" Canvas.Left="56" Canvas.Top="103" Width="35" Height="20" Style="{StaticResource NoBGHoverBtn}" Click="HoverConBtn_Click" MouseEnter="ContBtn_MouseEnter" MouseLeave="ContBtn_MouseLeave"
                                MouseRightButtonUp="ConBtn_MouseRightButtonUp" />

                        <Label x:Name="highlightControlDisplayLb" Content="" Canvas.Left="150" Canvas.Top="208" MinWidth="150"
                               HorizontalContentAlignment="Center">
                            <Label.Foreground>
                                <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}"/>
                            </Label.Foreground>
                        </Label>

                        <Button x:Name="ds4LightbarColorBtn" Width="138" Height="12" Canvas.Left="150" Canvas.Top="28"
                                Background="{x:Null}" BorderBrush="{x:Null}" MouseEnter="Ds4LightbarColorBtn_MouseEnter" MouseLeave="Ds4LightbarColorBtn_MouseLeave" Click="Ds4LightbarColorBtn_Click">
                            <Button.Style>
                                <Style TargetType="{x:Type Button}">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type Button}">
                                                <Border Background="{TemplateBinding Background}">
                                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                                </Border>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="{x:Null}"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Button.Style>
                            <Rectangle x:Name="lightbarRect" Fill="{Binding LightbarBrush,FallbackValue=Green}" Width="{Binding Path=Width, ElementName=ds4LightbarColorBtn}"
                                       Height="{Binding Path=Height, ElementName=ds4LightbarColorBtn}">
                                <Rectangle.OpacityMask>
                                    <ImageBrush ImageSource="/DS4Windows;component/Resources/DS4 lightbar.png" />
                                </Rectangle.OpacityMask>
                            </Rectangle>
                        </Button>
                    </Canvas>

                    <StackPanel Orientation="Horizontal" Height="210" DockPanel.Dock="Bottom" Margin="10">
                        <StackPanel x:Name="touchpadSettingsPanel" Width="240" Background="White">
                            <GroupBox Header="Touchpad">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                                        <RadioButton x:Name="useTouchMouseRadio" Content="Use As Mouse" GroupName="tpMode" Click="UseTouchMouseRadio_Click" />
                                        <RadioButton x:Name="useTouchControlsRadio" Content="Use As Controls" GroupName="tpMode" Click="UseTouchControlsRadio_Click" Margin="10,0,0,0"
                                                     ToolTip="{lex:Loc Resources:UsingTPSwipes}" />
                                    </StackPanel>

                                    <StackPanel x:Name="useMousePanel" Margin="0,10,0,0" Visibility="Visible">
                                        <StackPanel Orientation="Horizontal">
                                            <StackPanel Orientation="Horizontal" Height="20">
                                                <CheckBox Content="{lex:Loc TouchSlide}" IsChecked="{Binding TouchSenExists}" />
                                                <xctk:IntegerUpDown d:IsHidden="True" MinWidth="40" Maximum="500" Value="{Binding TouchSens}" IsEnabled="{Binding TouchSenExists}"  />
                                            </StackPanel>

                                            <StackPanel Orientation="Horizontal" Height="20">
                                                <CheckBox Content="{lex:Loc TouchScroll}" IsChecked="{Binding TouchScrollExists}" />
                                                <xctk:IntegerUpDown Value="{Binding TouchScroll}" d:IsHidden="True" MinWidth="40" IsEnabled="{Binding TouchScrollExists}"  />
                                            </StackPanel>
                                        </StackPanel>

                                        <StackPanel Orientation="Horizontal">
                                            <StackPanel Orientation="Horizontal" Height="20">
                                                <CheckBox Content="{lex:Loc TouchTap}" IsChecked="{Binding TouchTapExists}" />
                                                <xctk:IntegerUpDown Value="{Binding TouchTap}" d:IsHidden="True" MinWidth="40" IsEnabled="{Binding TouchTapExists}"  />
                                            </StackPanel>

                                            <StackPanel Orientation="Horizontal" Height="20">
                                                <CheckBox Content="Double Tap" IsChecked="{Binding TouchDoubleTap}"
                                                          ToolTip="{lex:Loc Resources:TapAndHold}" />
                                            </StackPanel>
                                        </StackPanel>

                                        <StackPanel Orientation="Horizontal">
                                            <StackPanel Orientation="Horizontal" Height="20">
                                                <CheckBox Content="Jitter Compensation" IsChecked="{Binding TouchJitter}"
                                                          ToolTip="{lex:Loc Resources:Jitter}" />
                                            </StackPanel>

                                            <StackPanel Orientation="Vertical" MinWidth="80" Margin="10,0,0,0">
                                                <Label Content="Invert" Padding="0" />
                                                <ComboBox MinWidth="50" SelectedIndex="{Binding TouchInvertIndex}">
                                                    <ComboBoxItem Content="None" />
                                                    <ComboBoxItem Content="X" />
                                                    <ComboBoxItem Content="Y" />
                                                    <ComboBoxItem Content="X+Y" />
                                                </ComboBox>
                                            </StackPanel>
                                        </StackPanel>

                                        <StackPanel Orientation="Horizontal">
                                            <StackPanel Orientation="Horizontal" Height="20">
                                                <CheckBox Content="Lower Right as RMB" IsChecked="{Binding LowerRightTouchRMB}"
                                                          ToolTip="{lex:Loc Resources:BestUsedRightSide}" />
                                            </StackPanel>

                                            <StackPanel Orientation="Vertical" MinWidth="80" Margin="10,0,0,0">
                                                <Label Content="Disable Invert" Padding="0" />
                                                <Button x:Name="touchDisInvertBtn" Content="{Binding TouchDisInvertString,FallbackValue=None}" Click="TouchDisInvertBtn_Click">
                                                    <Button.ContextMenu>
                                                        <ContextMenu>
                                                            <MenuItem Header="Cross" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Circle" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Square" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Triangle" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="L1" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="L2" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="R1" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="R2" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Up" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Down" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Left" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Right" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="L3" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="R3" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Finger on Touchpad" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="2 Fingers on Touchpad" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Options" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="Share" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                            <MenuItem Header="PS" IsCheckable="True" Click="TouchDisInvertMenuItem_Click" />
                                                        </ContextMenu>
                                                    </Button.ContextMenu>
                                                </Button>
                                            </StackPanel>
                                        </StackPanel>

                                        <CheckBox Content="Start with Slide/Scroll Off" IsChecked="{Binding StartTouchpadOff}"
                                                  ToolTip="{lex:Loc Resources:TouchpadOffTip}" />
                                        <StackPanel Orientation="Horizontal">
                                            <CheckBox Content="Trackball" IsChecked="{Binding TouchTrackball}" />
                                            <Label Content="Friction:" Padding="0" Margin="20,0,0,0"/>
                                            <xctk:DoubleUpDown x:Name="frictionUD" d:IsHidden="True" IsEnabled="{Binding TouchTrackball}" Minimum="0.1" Maximum="10.0" Value="{Binding TouchTrackballFriction,FallbackValue=10}" ValueChanged="FrictionUD_ValueChanged" />
                                        </StackPanel>
                                    </StackPanel>

                                    <StackPanel x:Name="useControlsPanel" Margin="0,10,0,0" Visibility="Collapsed">
                                        <StackPanel Orientation="Horizontal">
                                            <Button x:Name="swipeUpBtn" Content="Swipe Up" Width="70" Tag="36" Click="SwipeControlsButton_Click" />
                                            <Label x:Name="swipeUpLb" Content="{Binding MappingName,FallbackValue=Unassigned}"  Margin="10,0,0,0"/>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                                            <Button x:Name="swipeDownBtn" Content="Swipe Down" Width="70" Tag="37" Click="SwipeControlsButton_Click" />
                                            <Label x:Name="swipeDownLb" Content="{Binding MappingName,FallbackValue=Unassigned}"  Margin="10,0,0,0"/>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                                            <Button x:Name="swipeLeftBtn" Content="Swipe Left" Width="70" Tag="34" Click="SwipeControlsButton_Click" />
                                            <Label x:Name="swipeLeftLb" Content="{Binding MappingName,FallbackValue=Unassigned}"  Margin="10,0,0,0"/>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                                            <Button x:Name="swipeRightBtn" Content="Swipe Right" Width="70" Tag="35" Click="SwipeControlsButton_Click" />
                                            <Label x:Name="swipeRightLb" Content="{Binding MappingName,FallbackValue=Unassigned}"  Margin="10,0,0,0"/>
                                        </StackPanel>
                                    </StackPanel>
                                </StackPanel>

                            </GroupBox>
                        </StackPanel>

                        <ListBox x:Name="mappingListBox" ItemsSource="{Binding Mappings}"
                                 SelectedIndex="{Binding SelectedIndex}" Width="170" Margin="10,0,0,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                 MouseDoubleClick="MappingListBox_MouseDoubleClick">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding ControlName,StringFormat='\{0\}: '}" />
                                        <TextBlock Text="{Binding MappingName}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                </DockPanel>
            </TabItem>
            <TabItem x:Name="specialActionsTab" Header="Special Actions">
                <DockPanel x:Name="specialActionDockPanel">
                    <DockPanel x:Name="baseSpeActPanel" DockPanel.Dock="Top">
                        <UniformGrid Rows="1" Columns="3" DockPanel.Dock="Top">
                            <Button x:Name="newActionBtn" Content="{lex:Loc NewAction}" Margin="0,0,5,0" Click="NewActionBtn_Click" />
                            <Button x:Name="editActionBtn" Content="{lex:Loc EditAction}" IsEnabled="{Binding ItemSelected}" Margin="5,0" Click="EditActionBtn_Click" />
                            <Button x:Name="removeActionBtn" Content="{lex:Loc RemoveAction}" IsEnabled="{Binding ItemSelected}" Margin="5,0,0,0" Click="RemoveActionBtn_Click" />
                        </UniformGrid>

                        <ListView x:Name="specialActionsLV" ItemsSource="{Binding ActionCol}" SelectedIndex="{Binding SpecialActionIndex}" DockPanel.Dock="Bottom" Margin="0,10,0,0">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Header="{lex:Loc Name}" Width="150">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <CheckBox IsChecked="{Binding Active}" Click="SpecialActionCheckBox_Click" />
                                                    <TextBlock Text="{Binding ActionName}" Margin="4,0,0,0" />
                                                </StackPanel>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="{lex:Loc Trigger}" DisplayMemberBinding="{Binding Controls}" Width="100" />
                                    <GridViewColumn Header="{lex:Loc Action}" DisplayMemberBinding="{Binding TypeName}" Width="200" />
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </DockPanel>
                </DockPanel>
            </TabItem>
            <TabItem x:Name="contReadingsTab" Header="Controller Readings">
                <local:ControllerReadingsControl x:Name="conReadingsUserCon" />
            </TabItem>
        </TabControl>

        <TabControl x:Name="profileSettingsTabCon" DockPanel.Dock="Right" Margin="10,0,0,0" Padding="6">
            <TabControl.Resources>
                <Thickness x:Key="spaceMargin" Bottom="8" />
            </TabControl.Resources>

            <TabItem Header="Axis Config">
                <TabItem.Resources>
                    <Thickness x:Key="spaceMargin" Left="10" Bottom="6" />
                    <Style x:Key="gridRowHeight" TargetType="{x:Type RowDefinition}">
                        <Setter Property="Height" Value="30" />
                    </Style>
                </TabItem.Resources>
                <ScrollViewer>
                    <StackPanel>
                        <GroupBox Header="LS &amp; RS">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}"/>
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                    <RowDefinition Style="{StaticResource gridRowHeight}" />
                                </Grid.RowDefinitions>

                                <TextBlock Text="LS" Grid.Column="1" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,0,0,8"/>
                                <TextBlock Text="RS" Grid.Column="2" HorizontalAlignment="Center" FontWeight="Bold" Margin="0,0,0,8"/>

                                <Label Content="Dead Zone:" Grid.Row="1" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding LSDeadZone}" FormatString="F2" MinWidth="50" Grid.Row="1" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding RSDeadZone}" FormatString="F2" MinWidth="50" Grid.Row="1" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Max Zone:" Grid.Row="2" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding LSMaxZone}" FormatString="F2" MinWidth="50" Grid.Row="2" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding RSMaxZone}" FormatString="F2" MinWidth="50" Grid.Row="2" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Anti-dead Zone:" Grid.Row="3" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding LSAntiDeadZone}" FormatString="F2" MinWidth="50" Grid.Row="3" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding RSAntiDeadZone}" FormatString="F2" MinWidth="50" Grid.Row="3" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Max Output:" Grid.Row="4" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding LSMaxOutput}" FormatString="F2" MinWidth="50" Grid.Row="4" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding RSMaxOutput}" FormatString="F2" MinWidth="50" Grid.Row="4" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Sensitivity:" Grid.Row="5" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding LSSens}" MinWidth="50" Grid.Row="5" Grid.Column="1" Maximum="5.0" Minimum="0.5" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding RSSens}" MinWidth="50" Grid.Row="5" Grid.Column="2" Maximum="5.0" Minimum="0.5" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Output Curve:" Grid.Row="6" Grid.Column="0" />
                                <ComboBox Grid.Row="6" Grid.Column="1" SelectedIndex="{Binding LSOutputCurveIndex}"
                                          Margin="{StaticResource spaceMargin}">
                                    <ComboBoxItem Content="Linear" />
                                    <ComboBoxItem Content="Enhanced Precision" />
                                    <ComboBoxItem Content="Quadratic" />
                                    <ComboBoxItem Content="Cubic" />
                                    <ComboBoxItem Content="Easeout Quad" />
                                    <ComboBoxItem Content="Easeout Cubic" />
                                    <ComboBoxItem Content="Custom" />
                                </ComboBox>
                                <ComboBox Grid.Row="6" Grid.Column="2" SelectedIndex="{Binding RSOutputCurveIndex}"
                                          Margin="{StaticResource spaceMargin}">
                                    <ComboBoxItem Content="Linear" />
                                    <ComboBoxItem Content="Enhanced Precision" />
                                    <ComboBoxItem Content="Quadratic" />
                                    <ComboBoxItem Content="Cubic" />
                                    <ComboBoxItem Content="Easeout Quad" />
                                    <ComboBoxItem Content="Easeout Cubic" />
                                    <ComboBoxItem Content="Custom" />
                                </ComboBox>

                                <DockPanel Grid.Row="7" Grid.Column="1" IsEnabled="{Binding LSCustomCurveSelected}">
                                    <Button x:Name="lsCustomEditorBtn" Content="..." Tag="LS" Width="20" DockPanel.Dock="Right" Click="CustomEditorBtn_Click"
                                            Margin="{StaticResource spaceMargin}" />
                                    <TextBox Text="{Binding LSCustomCurve,UpdateSourceTrigger=LostFocus,FallbackValue='0.00, 0.00, 1.00, 1.00'}" DockPanel.Dock="Left"
                                             Margin="{StaticResource spaceMargin}" />
                                </DockPanel>
                                <DockPanel Grid.Row="7" Grid.Column="2" IsEnabled="{Binding RSCustomCurveSelected}">
                                    <Button x:Name="rsCustomEditorBtn" Content="..." Tag="RS" Width="20" DockPanel.Dock="Right" Click="CustomEditorBtn_Click"
                                            Margin="{StaticResource spaceMargin}" />
                                    <TextBox Text="{Binding RSCustomCurve,UpdateSourceTrigger=LostFocus,FallbackValue='0.00, 0.00, 1.00, 1.00'}" DockPanel.Dock="Left"
                                             Margin="{StaticResource spaceMargin}" />
                                </DockPanel>

                                <Label Content="Square Stick:" Grid.Row="8" Grid.Column="0" />
                                <StackPanel Orientation="Horizontal" Grid.Row="8" Grid.Column="1" HorizontalAlignment="Right">
                                    <CheckBox IsChecked="{Binding LSSquareStick}" Margin="{StaticResource spaceMargin}" />
                                    <xctk:DoubleUpDown d:IsHidden="True" FormatString="F1" Value="{Binding LSSquareRoundness,FallbackValue=5}"
                                                       MinWidth="100" Minimum="0.0" Maximum="5.0" Increment="1.0" IsEnabled="{Binding LSSquareStick}"
                                                       Margin="{StaticResource spaceMargin}" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Grid.Row="8" Grid.Column="2" HorizontalAlignment="Right">
                                    <CheckBox IsChecked="{Binding RSSquareStick}" Margin="{StaticResource spaceMargin}" />
                                    <xctk:DoubleUpDown d:IsHidden="True" FormatString="F1" Value="{Binding RSSquareRoundness,FallbackValue=5}"
                                                       MinWidth="100" Minimum="0.0" Maximum="5.0" Increment="1.0" IsEnabled="{Binding RSSquareStick}"
                                                       Margin="{StaticResource spaceMargin}" />
                                </StackPanel>

                                <Label Content="Curve (Input):" Grid.Row="9" Grid.Column="0" />
                                <StackPanel Orientation="Horizontal" Grid.Row="9" Grid.Column="1" HorizontalAlignment="Right">
                                    <xctk:DoubleUpDown d:IsHidden="True" MinWidth="100" Value="{Binding LSCurve}" Minimum="0" Maximum="100"
                                                       Margin="{StaticResource spaceMargin}" />
                                    <Label Content="%" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Grid.Row="9" Grid.Column="2" HorizontalAlignment="Right">
                                    <xctk:DoubleUpDown d:IsHidden="True" MinWidth="100" Value="{Binding RSCurve}" Minimum="0" Maximum="100" />
                                    <Label Content="%" />
                                </StackPanel>

                                <Label Content="Rotation:" Grid.Row="10" Grid.Column="0" />
                                <DockPanel Grid.Row="10" Grid.Column="1">
                                    <TextBlock Text="&#xb0;" DockPanel.Dock="Right" FontSize="18" Margin="{StaticResource spaceMargin}" />
                                    <xctk:IntegerUpDown d:IsHidden="True" Value="{Binding LSRotation}"
                                                    Minimum="-180" Maximum="180"
                                                    Margin="{StaticResource spaceMargin}" />
                                </DockPanel>

                                <DockPanel Grid.Row="10" Grid.Column="2">
                                    <TextBlock Text="&#xb0;" DockPanel.Dock="Right" FontSize="18" Margin="{StaticResource spaceMargin}" />
                                    <xctk:IntegerUpDown d:IsHidden="True" Value="{Binding RSRotation}"
                                                    Minimum="-180" Maximum="180"
                                                    Margin="{StaticResource spaceMargin}" />
                                </DockPanel>
                            </Grid>
                        </GroupBox>

                        <GroupBox Header="L2 &amp; R2">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Text="L2" Grid.Column="1" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,0,0,8" />
                                <TextBlock Text="R2" Grid.Column="2" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,0,0,8" />

                                <Label Content="Dead Zone:" Grid.Row="1" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding L2DeadZone}" MinWidth="50" Grid.Row="1" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding R2DeadZone}" MinWidth="50" Grid.Row="1" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Max Zone:" Grid.Row="2" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding L2MaxZone}" MinWidth="50" Grid.Row="2" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding R2MaxZone}" MinWidth="50" Grid.Row="2" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Anti-dead Zone:" Grid.Row="3" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding L2AntiDeadZone}" MinWidth="50" Grid.Row="3" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding R2AntiDeadZone}" MinWidth="50" Grid.Row="3" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Max Output:" Grid.Row="4" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding L2MaxOutput}" MinWidth="50" Grid.Row="4" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding R2MaxOutput}" MinWidth="50" Grid.Row="4" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Sensitivity:" Grid.Row="5" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding L2Sens}" MinWidth="50" Grid.Row="5" Grid.Column="1" Maximum="10.0" Minimum="0.1" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding R2Sens}" MinWidth="50" Grid.Row="5" Grid.Column="2" Maximum="10.0" Minimum="0.1" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Output Curve:" Grid.Row="6" Grid.Column="0" />
                                <ComboBox Grid.Row="6" Grid.Column="1" SelectedIndex="{Binding L2OutputCurveIndex}"
                                          Margin="{StaticResource spaceMargin}">
                                    <ComboBoxItem Content="Linear" />
                                    <ComboBoxItem Content="Enhanced Precision" />
                                    <ComboBoxItem Content="Quadratic" />
                                    <ComboBoxItem Content="Cubic" />
                                    <ComboBoxItem Content="Easeout Quad" />
                                    <ComboBoxItem Content="Easeout Cubic" />
                                    <ComboBoxItem Content="Custom" />
                                </ComboBox>
                                <ComboBox Grid.Row="6" Grid.Column="2" SelectedIndex="{Binding R2OutputCurveIndex}"
                                          Margin="{StaticResource spaceMargin}">
                                    <ComboBoxItem Content="Linear" />
                                    <ComboBoxItem Content="Enhanced Precision" />
                                    <ComboBoxItem Content="Quadratic" />
                                    <ComboBoxItem Content="Cubic" />
                                    <ComboBoxItem Content="Easeout Quad" />
                                    <ComboBoxItem Content="Easeout Cubic" />
                                    <ComboBoxItem Content="Custom" />
                                </ComboBox>

                                <DockPanel Grid.Row="7" Grid.Column="1" IsEnabled="{Binding L2CustomCurveSelected}">
                                    <Button x:Name="l2CustomEditorBtn" Content="..." Tag="L2" Width="20" DockPanel.Dock="Right" Click="CustomEditorBtn_Click"
                                            Margin="{StaticResource spaceMargin}" />
                                    <TextBox Text="{Binding L2CustomCurve,FallbackValue='0.00, 0.00, 1.00, 1.00'}" DockPanel.Dock="Left"
                                             Margin="{StaticResource spaceMargin}" />
                                </DockPanel>
                                <DockPanel Grid.Row="7" Grid.Column="2"  IsEnabled="{Binding R2CustomCurveSelected}">
                                    <Button x:Name="r2CustomEditorBtn" Content="..." Tag="R2" Width="20" DockPanel.Dock="Right" Click="CustomEditorBtn_Click"
                                            Margin="{StaticResource spaceMargin}" />
                                    <TextBox Text="{Binding R2CustomCurve,FallbackValue='0.00, 0.00, 1.00, 1.00'}" DockPanel.Dock="Left"
                                             Margin="{StaticResource spaceMargin}" />
                                </DockPanel>
                            </Grid>
                        </GroupBox>

                        <GroupBox Header="SixAxis">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                    <RowDefinition Style="{StaticResource gridRowHeight}"></RowDefinition>
                                </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Text="X" Grid.Column="1" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,0,0,8" />
                                <TextBlock Text="Z" Grid.Column="2"  FontWeight="Bold" HorizontalAlignment="Center" Margin="0,0,0,8" />

                                <Label Content="Dead Zone:" Grid.Row="1" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SXDeadZone}" MinWidth="50" Grid.Row="1" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SZDeadZone}" MinWidth="50" Grid.Row="1" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Max Zone:" Grid.Row="2" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SXMaxZone}" MinWidth="50" Grid.Row="2" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SZMaxZone}" MinWidth="50" Grid.Row="2" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Anti-dead Zone:" Grid.Row="3" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SXAntiDeadZone}" MinWidth="50" Grid.Row="3" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SZAntiDeadZone}" MinWidth="50" Grid.Row="3" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Sensitivity:" Grid.Row="4" Grid.Column="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SXSens}" MinWidth="50" Grid.Row="4" Grid.Column="1" Maximum="5.0" Minimum="0.5" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />
                                <xctk:DoubleUpDown d:IsHidden="True" FormatString="F2" Value="{Binding SZSens}" MinWidth="50" Grid.Row="4" Grid.Column="2" Maximum="5.0" Minimum="0.5" Increment="0.1"
                                                   Margin="{StaticResource spaceMargin}" />

                                <Label Content="Output Curve:" Grid.Row="5" Grid.Column="0" />
                                <ComboBox Grid.Row="5" Grid.Column="1" SelectedIndex="{Binding SXOutputCurveIndex}"
                                          Margin="{StaticResource spaceMargin}">
                                    <ComboBoxItem Content="Linear" />
                                    <ComboBoxItem Content="Enhanced Precision" />
                                    <ComboBoxItem Content="Quadratic" />
                                    <ComboBoxItem Content="Cubic" />
                                    <ComboBoxItem Content="Easeout Quad" />
                                    <ComboBoxItem Content="Easeout Cubic" />
                                    <ComboBoxItem Content="Custom" />
                                </ComboBox>
                                <ComboBox Grid.Row="5" Grid.Column="2" SelectedIndex="{Binding SZOutputCurveIndex}"
                                          Margin="{StaticResource spaceMargin}">
                                    <ComboBoxItem Content="Linear" />
                                    <ComboBoxItem Content="Enhanced Precision" />
                                    <ComboBoxItem Content="Quadratic" />
                                    <ComboBoxItem Content="Cubic" />
                                    <ComboBoxItem Content="Easeout Quad" />
                                    <ComboBoxItem Content="Easeout Cubic" />
                                    <ComboBoxItem Content="Custom" />
                                </ComboBox>

                                <DockPanel Grid.Row="6" Grid.Column="1" IsEnabled="{Binding SXCustomCurveSelected}">
                                    <Button x:Name="sxCustomEditorBtn" Content="..." Tag="SX" Width="20" DockPanel.Dock="Right" Click="CustomEditorBtn_Click"
                                            Margin="{StaticResource spaceMargin}" />
                                    <TextBox Text="{Binding SXCustomCurve,FallbackValue='0.00, 0.00, 1.00, 1.00'}" DockPanel.Dock="Left"
                                             Margin="{StaticResource spaceMargin}" />
                                </DockPanel>
                                <DockPanel Grid.Row="6" Grid.Column="2" IsEnabled="{Binding SZCustomCurveSelected}">
                                    <Button x:Name="szCustomEditorBtn" Content="..." Tag="SZ" Width="20" DockPanel.Dock="Right" Click="CustomEditorBtn_Click"
                                           Margin="{StaticResource spaceMargin}" />
                                    <TextBox Text="{Binding SZCustomCurve,FallbackValue='0.00, 0.00, 1.00, 1.00'}" DockPanel.Dock="Left"
                                             Margin="{StaticResource spaceMargin}" />
                                </DockPanel>
                            </Grid>
                        </GroupBox>
                    </StackPanel>
                </ScrollViewer>
            </TabItem>

            <TabItem Header="Lightbar">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Mode:" />
                        <ComboBox x:Name="lightbarModeCombo" Width="160" SelectedIndex="{Binding LightbarModeIndex, FallbackValue=0}"
                                  VerticalContentAlignment="Center" Margin="10,0,0,0">
                            <ComboBoxItem Content="Normal" />
                            <ComboBoxItem Content="Passthru" />
                        </ComboBox>
                    </StackPanel>
                    <StackPanel Visibility="{Binding DS4WinLightVisible,Mode=OneWay}">
                        <StackPanel Orientation="Horizontal">
                            <GroupBox x:Name="colorGB" Header="{lex:Loc Color}" Padding="4">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Content="R" />
                                        <Slider Value="{Binding MainColorR}" Minimum="0" Maximum="255" ToolTip="{Binding MainColorR}" MinWidth="100" Background="{Binding MainColorRString, FallbackValue=Red}"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Content="G" />
                                        <Slider Value="{Binding MainColorG}" MinWidth="100" Minimum="0" Maximum="255" ToolTip="{Binding MainColorG}" Background="{Binding MainColorGString, FallbackValue=Lime}"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Content="B" />
                                        <Slider Value="{Binding MainColorB}" MinWidth="100" Minimum="0" Maximum="255" ToolTip="{Binding MainColorB}" Background="{Binding MainColorBString, FallbackValue=Blue}"/>
                                    </StackPanel>
                                </StackPanel>
                            </GroupBox>

                            <GroupBox x:Name="emptyColorGB" Header="Empty" Padding="4">
                                <StackPanel>

                                    <StackPanel Orientation="Horizontal">
                                        <Label Content="R" />
                                        <Slider Value="{Binding LowColorR}" MinWidth="100" Minimum="0" Maximum="255" ToolTip="{Binding LowColorR}" Background="{Binding LowColorRString, FallbackValue=Red}"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Content="G" />
                                        <Slider Value="{Binding LowColorG}" MinWidth="100" Minimum="0" Maximum="255" ToolTip="{Binding LowColorG}" Background="{Binding LowColorGString, FallbackValue=Lime}"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Content="B" />
                                        <Slider Value="{Binding LowColorB}" MinWidth="100" Minimum="0" Maximum="255" ToolTip="{Binding LowColorB}" Background="{Binding LowColorBString, FallbackValue=Blue}"/>
                                    </StackPanel>

                                    <Button x:Name="lowColorBtn" Width="10" Height="10" Background="{Binding LowColor}" HorizontalAlignment="Right" Margin="0,6,0,0" Click="LowColorBtn_Click" />
                                </StackPanel>
                            </GroupBox>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                            <ComboBox x:Name="flashTypeCombo" SelectedIndex="{Binding FlashTypeIndex,FallbackValue=0}">
                                <ComboBoxItem Content="Flash at"/>
                                <ComboBoxItem Content="Pulse at"/>
                            </ComboBox>
                            <xctk:IntegerUpDown d:IsHidden="True" Value="{Binding FlashAt,FallbackValue=0}" MinWidth="50"
                                            Minimum="-10" Maximum="100" Increment="10" />
                            <Label Content="%" />
                            <Button x:Name="flashColorBtn" Width="20" Height="20" Background="{Binding FlashColor,FallbackValue=Blue}"
                                ToolTip="{lex:Loc Resources:FlashAtTip}" Click="FlashColorBtn_Click" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                            <Label Content="While Charging:"/>
                            <ComboBox Margin="8,0,0,0" SelectedIndex="{Binding ChargingType,FallbackValue=0}">
                                <ComboBoxItem Content="Normal" />
                                <ComboBoxItem Content="Pulse" />
                                <ComboBoxItem Content="Rainbow" />
                                <ComboBoxItem Content="Color" />
                            </ComboBox>
                            <Button x:Name="chargingColorBtn" Width="20" Height="20" Background="{Binding ChargingColor,FallbackValue=Blue}"
                                Visibility="{Binding ChargingColorVisible}" Click="ChargingColorBtn_Click" Margin="20,0,0,0" />
                        </StackPanel>

                        <CheckBox x:Name="colorByBatteryPerCk" Content="Color by Battery %" IsChecked="{Binding ColorBatteryPercent}"
                              ToolTip="{lex:Loc Resources:LightByBatteryTip}" Click="ColorByBatteryPerCk_Click" Margin="0,10,0,0" />

                        <StackPanel Orientation="Horizontal" Height="60" Margin="0,10,0,0">
                            <Button x:Name="rainbowBtn" Height="20" Width="20"
                                ToolTip="{lex:Loc Resources:AlwaysRainbow}" Click="RainbowBtn_Click">
                                <Button.Content>
                                    <Image Source="/DS4Windows;component/Resources/rainbow.png" />
                                </Button.Content>
                            </Button>
                            <xctk:IntegerUpDown MinWidth="30" Height="30" Minimum="0" Maximum="60" Increment="1" Margin="8,0,0,0"
                                            Value="{Binding Rainbow,FallbackValue=5}" IsEnabled="{Binding RainbowExists}" />
                            <Label Content="secs/cycle" Padding="0" Margin="8,0,0,0" VerticalContentAlignment="Center" />
                            <StackPanel Margin="8,0,0,0">
                                <Label Content="Max Sat." />
                                <Slider Value="{Binding MaxSatRainbow,FallbackValue=100}" Minimum="0" Maximum="100" Width="100" IsEnabled="{Binding RainbowExists}" />
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </TabItem>

            <TabItem Header="Gyro">
                <StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,0,0,10">
                        <Label Content="Output Mode" />
                        <ComboBox x:Name="gyroOutModeCombo" Width="160" SelectedIndex="{Binding GyroOutModeIndex, FallbackValue=0}" VerticalContentAlignment="Center" Margin="10,0,0,0">
                            <ComboBoxItem Content="Controls" />
                            <ComboBoxItem Content="Mouse" />
                            <ComboBoxItem Content="Mouse Joystick" />
                        </ComboBox>
                    </StackPanel>

                    <StackPanel x:Name="gyroControlsPanel" Visibility="Visible">
                        <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
                            <Button x:Name="gyroZNBtn" Content="Tilt Up" Width="100" Tag="33" Click="TiltControlsButton_Click" />
                            <Label x:Name="gyroZNLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
                            <Button x:Name="gyroZPBtn" Content="Tilt Down" Width="100" Tag="32" Click="TiltControlsButton_Click" />
                            <Label x:Name="gyroZPLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
                            <Button x:Name="gyroXPBtn" Content="Tilt Left" Width="100" Tag="30" Click="TiltControlsButton_Click" />
                            <Label x:Name="gyroXLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
                            <Button x:Name="gyroXNBtn" Content="Tilt Right" Width="100" Tag="31" Click="TiltControlsButton_Click" />
                            <Label x:Name="gyroXNLb" Content="{Binding MappingName,FallbackValue=Unassigned}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
                            <Label Content="Steering wheel axis" />
                            <ComboBox Width="160" Margin="8,0,0,0" SelectedIndex="{Binding SASteeringWheelEmulationAxisIndex,FallbackValue=0}">
                                <ComboBoxItem Content="None" />
                                <ComboBoxItem Content="Left X-Axis" />
                                <ComboBoxItem Content="Left Y-Axis" />
                                <ComboBoxItem Content="Right X-Axis" />
                                <ComboBoxItem Content="Right Y-Axis" />
                                <ComboBoxItem Content="Trigger L+R Axis" />
                                <ComboBoxItem Content="VJoy1 X-Axis" />
                                <ComboBoxItem Content="VJoy1 Y-Axis" />
                                <ComboBoxItem Content="VJoy1 Z-Axis" />
                                <ComboBoxItem Content="VJoy2 X-Axis" />
                                <ComboBoxItem Content="VJoy2 Y-Axis" />
                                <ComboBoxItem Content="VJoy2 Z-Axis" />
                            </ComboBox>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
                            <Label Content="Steering wheel range" />
                            <ComboBox Margin="8,0,0,0" SelectedIndex="{Binding SASteeringWheelEmulationRangeIndex,FallbackValue=0}">
                                <ComboBoxItem Content="90" />
                                <ComboBoxItem Content="180" />
                                <ComboBoxItem Content="270" />
                                <ComboBoxItem Content="360" />
                                <ComboBoxItem Content="450" />
                                <ComboBoxItem Content="720" />
                                <ComboBoxItem Content="900" />
                                <ComboBoxItem Content="1080" />
                                <ComboBoxItem Content="1440" />
                            </ComboBox>
                            <Button x:Name="steeringWheelEmulationCalibrateBtn" Content="Calibrate" Margin="8,0,0,0"
                                    Click="SteeringWheelEmulationCalibrateBtn_Click" />
                        </StackPanel>
                    </StackPanel>

                    <StackPanel x:Name="gyroMousePanel" Visibility="Collapsed" Margin="{StaticResource spaceMargin}">
                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Triggers" />
                            <Button x:Name="gyroMouseTrigBtn" Content="{Binding GyroMouseTrigDisplay,FallbackValue=Always On}" MinWidth="160" Click="GyroMouseTrigBtn_Click" >
                                <Button.ContextMenu>
                                    <ContextMenu>
                                        <MenuItem Header="Cross" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Circle" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Square" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Triangle" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="L1" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="L2" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="R1" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="R2" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Up" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Down" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Left" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Right" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="L3" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="R3" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Finger on Touchpad" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="2 Fingers on Touchpad" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Options" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Share" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="PS" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                        <MenuItem Header="Always On" IsCheckable="True" Click="GyroMouseTrigMenuItem_Click" />
                                    </ContextMenu>
                                </Button.ContextMenu>
                            </Button>
                        </StackPanel>

                        <CheckBox Content="Turn Behavior - Turns Gyro" Margin="{StaticResource spaceMargin}"
                                  IsChecked="{Binding GyroMouseTurns}" ToolTip="{lex:Loc Resources:GyroTriggerBehavior}" />
                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Gyro Sensitivity:" />
                            <xctk:IntegerUpDown d:IsHidden="True" MinWidth="50" Margin="8,0,0,0" Value="{Binding GyroSensitivity}"
                                                Minimum="0" Maximum="500" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Vertical Scale:" />
                            <xctk:IntegerUpDown d:IsHidden="True" MinWidth="50" Margin="8,0,0,0" Value="{Binding GyroVertScale}"
                                                Minimum="0" Maximum="400" Increment="10" />
                            <Label Content="%" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <StackPanel>
                                <Label Content="Eval Cond." Margin="{StaticResource spaceMargin}" />
                                <ComboBox SelectedIndex="{Binding GyroMouseEvalCondIndex,FallbackValue=0}">
                                    <ComboBoxItem Content="And" />
                                    <ComboBoxItem Content="Or" />
                                </ComboBox>
                            </StackPanel>

                            <StackPanel Margin="20,0,0,0">
                                <Label Content="X Axis" Margin="{StaticResource spaceMargin}" />
                                <ComboBox SelectedIndex="{Binding GyroMouseXAxis,FallbackValue=0}">
                                    <ComboBoxItem Content="Yaw" />
                                    <ComboBoxItem Content="Roll" />
                                </ComboBox>
                            </StackPanel>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Invert" Padding="0"/>
                            <CheckBox Content="X" Margin="8,0,0,0" IsChecked="{Binding GyroMouseInvertX}" />
                            <CheckBox Content="Y" Margin="8,0,0,0" IsChecked="{Binding GyroMouseInvertY}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Height="30" Margin="{StaticResource spaceMargin}">
                            <CheckBox Content="Smoothing" IsChecked="{Binding GyroMouseSmooth}" />
                            <StackPanel Orientation="Horizontal" Margin="20,0,0,0">
                                <Label Content="Smooth Weight" Padding="0" />
                                <xctk:DoubleUpDown d:IsHidden="True" MinWidth="60" Margin="8,0,0,0"
                                                   Value="{Binding GyroMouseSmoothWeight}" Minimum="0.0" Maximum="1.0" Increment="0.1"
                                                   IsEnabled="{Binding GyroMouseSmooth}" />
                            </StackPanel>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Deadzone" />
                            <xctk:IntegerUpDown d:IsHidden="True" MinWidth="60" Margin="8,0,0,0"
                                                Value="{Binding GyroMouseDeadZone}" Minimum="0" Maximum="1000" />
                        </StackPanel>

                        <CheckBox Content="Toggle" IsChecked="{Binding GyroMouseToggle}" />
                    </StackPanel>

                    <StackPanel x:Name="gyroMouseJoystickPanel" Visibility="Collapsed">
                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Triggers" />
                            <Button x:Name="gyroMouseStickTrigBtn" Content="{Binding GyroMouseStickTrigDisplay,FallbackValue=Always On}" MinWidth="160"
                                    Margin="8,0,0,0" Click="GyroMouseStickTrigBtn_Click" >
                                <Button.ContextMenu>
                                    <ContextMenu>
                                        <MenuItem Header="Cross" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Circle" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Square" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Triangle" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="L1" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="L2" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="R1" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="R2" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Up" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Down" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Left" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Right" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="L3" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="R3" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Finger on Touchpad" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="2 Fingers on Touchpad" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Options" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Share" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="PS" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                        <MenuItem Header="Always On" IsCheckable="True" Click="GyroMouseStickTrigMenuItem_Click" />
                                    </ContextMenu>
                                </Button.ContextMenu>
                            </Button>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <CheckBox Content="Turn Behavior - Turns Gyro" IsChecked="{Binding GyroMouseStickTurns}"
                                      ToolTip="{lex:Loc Resources:GyroTriggerBehavior}" />
                            <CheckBox Content="Toggle" Margin="8,0,0,0" IsChecked="{Binding GyroMouseStickToggle}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Dead Zone" />
                            <xctk:IntegerUpDown d:IsHidden="True" Margin="8,0,0,0" Value="{Binding GyroMouseStickDeadZone}" MinWidth="60" />
                            <Label Content="Max Zone" Margin="8,0,0,0" />
                            <xctk:IntegerUpDown d:IsHidden="True" Margin="8,0,0,0" Value="{Binding GyroMouseStickMaxZone}" MinWidth="60" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Height="30" Margin="{StaticResource spaceMargin}">
                            <Label Content="Minimum X" />
                            <xctk:DoubleUpDown d:IsHidden="True" Margin="8,0,0,0" Value="{Binding GyroMouseStickAntiDeadX}" MinWidth="60"
                                               Minimum="0.0" Maximum="1.0" Increment="0.1" />
                            <Label Content="Minimum Y" Margin="8,0,0,0" />
                            <xctk:DoubleUpDown d:IsHidden="True" Margin="8,0,0,0" Value="{Binding GyroMouseStickAntiDeadY}" MinWidth="60"
                                               Minimum="0.0" Maximum="1.0" Increment="0.1" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Vertical Scale" />
                            <xctk:IntegerUpDown d:IsHidden="True" Margin="8,0,0,0" Value="{Binding GyroMouseStickVertScale}" MinWidth="60"
                                                Minimum="0" Maximum="400" Increment="10" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <Label Content="Eval Cond." />
                            <ComboBox SelectedIndex="{Binding GyroMouseStickEvalCondIndex,FallbackValue=0}" Margin="8,0,0,0">
                                <ComboBoxItem Content="And" />
                                <ComboBoxItem Content="Or" />
                            </ComboBox>

                            <Label Content="X-Axis" Margin="20,0,0,0" />
                            <ComboBox SelectedIndex="{Binding GyroMouseStickXAxis,FallbackValue=0}" Margin="8,0,0,0">
                                <ComboBoxItem Content="Yaw" />
                                <ComboBoxItem Content="Roll" />
                            </ComboBox>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Margin="{StaticResource spaceMargin}">
                            <CheckBox Content="Invert X" IsChecked="{Binding GyroMouseStickInvertX}"/>
                            <CheckBox Content="Invert Y" Margin="10,0,0,0" IsChecked="{Binding GyroMouseStickInvertY}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Height="30" Margin="{StaticResource spaceMargin}">
                            <CheckBox Content="Smoothing" IsChecked="{Binding GyroMouseStickSmooth}" />
                            <Label Content="Weight" Padding="0" Margin="20,0,0,0" />
                            <xctk:DoubleUpDown d:IsHidden="True" Margin="8,0,0,0" Value="{Binding GyroMousetickSmoothWeight}"
                                               Minimum="0.0" Maximum="1.0" Increment="0.1" MinWidth="60" IsEnabled="{Binding GyroMouseStickSmooth}" />
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </TabItem>

            <TabItem Header="Other">
                <StackPanel>
                    <GroupBox Header="{lex:Loc Rumble}" MinHeight="50" Margin="4,4,4,0" Padding="0,4,0,4">
                        <UniformGrid Rows="1" Columns="3">
                            <UniformGrid Columns="2" HorizontalAlignment="Left">
                                <DockPanel>
                                    <Label Content="%" DockPanel.Dock="Right" />
                                    <xctk:IntegerUpDown x:Name="RumbleBoostIUD" d:IsHidden="True" Value="{Binding RumbleBoost}" Minimum="0" Maximum="200" Increment="10"
                                                       MinWidth="50" DockPanel.Dock="Left" />
                                </DockPanel>

                                <DockPanel>
                                    <Label Content="{lex:Loc RumbleMaxSecs}" DockPanel.Dock="Right" />
                                    <xctk:IntegerUpDown x:Name="RumbleAutostopTimeIUD" d:IsHidden="True" Value="{Binding RumbleAutostopTime}" Minimum="0" Maximum="3600" Increment="1" ToolTip="{lex:Loc RumbleMaxSecsTip}"
                                                       MinWidth="50" DockPanel.Dock="Left"/>
                                </DockPanel>
                            </UniformGrid>

                            <Button x:Name="heavyRumbleTestBtn" Content="Test Heavy" Margin="10,0,0,0" Click="HeavyRumbleTestBtn_Click" />
                            <Button x:Name="lightRumbleTestBtn" Content="Test Light" Margin="10,0,0,0" Click="LightRumbleTestBtn_Click" />
                        </UniformGrid>
                    </GroupBox>
                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                        <Label Content="Use Controller" ToolTip="{lex:Loc Resources:UseControllerForMapping}" />
                        <xctk:IntegerUpDown x:Name="useControllerUD" d:IsHidden="True" Width="40" Margin="8,0,0,0"
                                            Value="0" Minimum="0" Maximum="4" IsEnabled="False"
                                            ToolTip="{lex:Loc Resources:UseControllerForMapping}" />
                        <CheckBox x:Name="useControllerReadoutCk" FlowDirection="RightToLeft" Content="for readout" VerticalAlignment="Center"
                                  Margin="8,0,0,0" IsChecked="{Binding UseControllerReadout}"
                                  ToolTip="{lex:Loc Resources:UseControllerForMapping}" Click="UseControllerReadoutCk_Click">
                            <CheckBox.Resources>
                                <Style TargetType="{x:Type Path}">
                                    <Setter Property="FlowDirection" Value="LeftToRight"/>
                                </Style>
                            </CheckBox.Resources>
                        </CheckBox>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Height="40" Margin="0,4,0,0">
                        <Label Content="Mouse Sensitivity" VerticalAlignment="Center" />
                        <xctk:IntegerUpDown d:IsHidden="True" MinWidth="50" Height="20"
                                            Value="{Binding ButtonMouseSensitivity,FallbackValue=25}"
                                            Minimum="0" Maximum="255" Increment="1" Margin="10,0,0,0" />
                        <TextBlock Text="{Binding OutputMouseSpeed,StringFormat='\{0} pps'}"
                                   MinWidth="50" VerticalAlignment="Center"  Margin="10,0,0,0" />
                    </StackPanel>
                    <CheckBox Content="Mouse Acceleration" IsChecked="{Binding MouseAcceleration}" Margin="0,6,0,0" />
                    <CheckBox Content="Enable Touchpad Toggle" IsChecked="{Binding EnableTouchpadToggle}" Margin="0,6,0,0"
                              ToolTip="{lex:Loc Resources:EnableTouchToggle}" />
                    <StackPanel Orientation="Horizontal" Margin="0,6,0,0">
                        <CheckBox x:Name="launchProgCk" Content="Launch program with profile" IsChecked="{Binding LaunchProgramExists}" IsEnabled="{Binding LaunchProgramExists}" />
                        <Button x:Name="launchProgBrowseBtn" Content="{Binding LaunchProgramName,FallbackValue={lex:Loc Browse}}" Click="LaunchProgBrowseBtn_Click" Width="80" Height="30" Margin="20,0,0,0" />
                        <Button x:Name="launchProgIconBtn" Width="20" Height="20" Margin="20,0,0,0" Focusable="False" >
                            <Button.Background>
                                <ImageBrush ImageSource="{Binding LaunchProgramIcon}" />
                            </Button.Background>
                        </Button>
                    </StackPanel>
                    <CheckBox Content="Use DInput only" IsChecked="{Binding DInputOnly}"
                              ToolTip="{lex:Loc Resources:DinputOnly}" Margin="0,6,0,0" />
                    <CheckBox Content="Flush HID" IsChecked="{Binding FlushHid}"
                              ToolTip="{lex:Loc Resources:FlushHIDTip}" Margin="0,6,0,0" />
                    <StackPanel Orientation="Horizontal" Height="30" Margin="0,6,0,0">
                        <CheckBox Content="Idle Disconnect" VerticalAlignment="Center" IsChecked="{Binding IdleDisconnectExists}" />
                        <xctk:IntegerUpDown x:Name="idleDisconnectUD" d:IsHidden="True" Value="{Binding IdleDisconnect,FallbackValue=5}"
                                            IsEnabled="{Binding IdleDisconnectExists}" MinWidth="50" Height="20" Minimum="0" Maximum="60" Margin="10,0,0,0" />
                        <Label Content="mins" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,6,0,0">
                        <Label Content="BT Poll Rate" ToolTip="{lex:Loc Resources:BtPollRate}" />
                        <ComboBox x:Name="btPollRateCombo" SelectedIndex="{Binding TempBTPollRateIndex,FallbackValue=4}" MinWidth="140"
                                  ToolTip="{lex:Loc Resources:BtPollRate}">
                            <ComboBoxItem Content="Max (1 ms)" />
                            <ComboBoxItem Content="1000 Hz (1 ms)" />
                            <ComboBoxItem Content="500 Hz (2 ms)" />
                            <ComboBoxItem Content="333 Hz (3 ms)" />
                            <ComboBoxItem Content="250 Hz (4 ms)" />
                            <ComboBoxItem Content="200 Hz (5 ms)" />
                            <ComboBoxItem Content="166 Hz (6 ms)" />
                            <ComboBoxItem Content="142 Hz (7 ms)" />
                            <ComboBoxItem Content="125 Hz (8 ms)" />
                            <ComboBoxItem Content="111 Hz (9 ms)" />
                            <ComboBoxItem Content="100 Hz (10 ms)" />
                            <ComboBoxItem Content="90 Hz (11 ms)" />
                            <ComboBoxItem Content="83 Hz (12 ms)" />
                            <ComboBoxItem Content="76 Hz (13 ms)" />
                            <ComboBoxItem Content="71 Hz (14 ms)" />
                            <ComboBoxItem Content="66 Hz (15 ms)" />
                            <ComboBoxItem Content="62 Hz (16 ms)" />
                        </ComboBox>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,6,0,0">
                        <Label Content="Controller" ToolTip="{lex:Loc Resources:OutContNotice}" />
                        <ComboBox x:Name="outConTypeCombo" SelectedIndex="{Binding TempControllerIndex,FallbackValue=0}" MinWidth="140"
                                  ToolTip="{lex:Loc Resources:OutContNotice}">
                            <ComboBoxItem Content="Xbox 360"/>
                            <ComboBoxItem Content="DualShock 4"/>
                        </ComboBox>
                    </StackPanel>
                </StackPanel>

            </TabItem>
        </TabControl>
    </DockPanel>
</UserControl>
