<UserControl x:Class="CalculatorApp.CalculatorProgrammerRadixOperators"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Windows10version1803="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract, 7)"
             xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)"
             xmlns:common="using:CalculatorApp.Common"
             xmlns:controls="using:CalculatorApp.Controls"
             xmlns:converters="using:CalculatorApp.Converters"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="using:CalculatorApp"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:triggers="using:CalculatorApp.Views.StateTriggers"
             x:Name="ControlRoot"
             d:DesignHeight="395"
             d:DesignWidth="315"
             XYFocusKeyboardNavigation="Enabled"
             mc:Ignorable="d">
    <UserControl.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <converters:BooleanToVisibilityNegationConverter x:Key="BooleanToVisibilityNegationConverter"/>
    </UserControl.Resources>

    <Grid x:Name="ProgRadixOps">
        <Grid.RowDefinitions>
            <RowDefinition x:Name="OperatorPanelRow" Height="Auto"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="GutterLeft" Width="0"/>
            <ColumnDefinition x:Name="C0" Width="1*"/>
            <ColumnDefinition x:Name="C1" Width="1*"/>
            <ColumnDefinition x:Name="C2" Width="1*"/>
            <ColumnDefinition x:Name="C3" Width="1*"/>
            <ColumnDefinition x:Name="C4" Width="1*"/>
            <ColumnDefinition x:Name="GutterRight" Width="0"/>
        </Grid.ColumnDefinitions>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ErrorVisualStates">
                <VisualState x:Name="NoErrorLayout"/>
                <VisualState x:Name="ErrorLayout">
                    <VisualState.Setters>
                        <Setter Target="RolButton.IsEnabled" Value="False"/>
                        <Setter Target="RorButton.IsEnabled" Value="False"/>
                        <Setter Target="LshButton.IsEnabled" Value="False"/>
                        <Setter Target="RshButton.IsEnabled" Value="False"/>
                        <Setter Target="OrButton.IsEnabled" Value="False"/>
                        <Setter Target="XorButton.IsEnabled" Value="False"/>
                        <Setter Target="NotButton.IsEnabled" Value="False"/>
                        <Setter Target="AndButton.IsEnabled" Value="False"/>

                        <Setter Target="ModButton.IsEnabled" Value="False"/>

                        <Setter Target="DivideButton.IsEnabled" Value="False"/>
                        <Setter Target="MultiplyButton.IsEnabled" Value="False"/>
                        <Setter Target="MinusButton.IsEnabled" Value="False"/>
                        <Setter Target="PlusButton.IsEnabled" Value="False"/>

                        <Setter Target="OpenParenthesisButton.IsEnabled" Value="False"/>
                        <Setter Target="CloseParenthesisButton.IsEnabled" Value="False"/>
                        <Setter Target="NegateButton.IsEnabled" Value="False"/>
                        <Setter Target="BitShiftButton.IsEnabled" Value="False"/>
                        <Setter Target="BitwiseButton.IsEnabled" Value="False"/>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup>
                <VisualState x:Name="Large">
                    <VisualState.StateTriggers>
                        <triggers:ControlSizeTrigger MinWidth="1053"
                                                     MinHeight="729"
                                                     Source="{x:Bind ProgRadixOps}"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle38}"/>
                        <Setter Target="AButton.Style" Value="{StaticResource NumericButtonStyle38}"/>
                        <Setter Target="BButton.Style" Value="{StaticResource NumericButtonStyle38}"/>
                        <Setter Target="CButton.Style" Value="{StaticResource NumericButtonStyle38}"/>
                        <Setter Target="DButton.Style" Value="{StaticResource NumericButtonStyle38}"/>
                        <Setter Target="EButton.Style" Value="{StaticResource NumericButtonStyle38}"/>
                        <Setter Target="FButton.Style" Value="{StaticResource NumericButtonStyle38}"/>

                        <Setter Target="ModButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="DivideButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="MinusButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="PlusButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="EqualButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="ClearButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="NegateButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="OpenParenthesisButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="CloseParenthesisButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>

                        <Setter Target="AndButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="OrButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="XorButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="NandButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="NorButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="RolButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="RorButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="RolCarryButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="RorCarryButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="LshButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="RshButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="LshLogicalButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="RshLogicalButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>
                        <Setter Target="NotButton.FontSize" Value="{StaticResource CalcButtonCaptionSize}"/>

                        <Setter Target="OperatorPanelRow.MinHeight" Value="{StaticResource OperatorPanelButtonRowSizeLarge}"/>

                        <Setter Target="BitwiseButton.ChevronFontSize" Value="{ThemeResource OperatorPanelChevronFontSizeLarge}"/>
                        <Setter Target="BitwiseButton.GlyphFontSize" Value="{ThemeResource OperatorPanelGlyphFontSizeLarge}"/>
                        <Setter Target="BitwiseButton.FontSize" Value="{ThemeResource OperatorPanelFontSizeLarge}"/>

                        <Setter Target="BitShiftButton.ChevronFontSize" Value="{ThemeResource OperatorPanelChevronFontSizeLarge}"/>
                        <Setter Target="BitShiftButton.GlyphFontSize" Value="{ThemeResource OperatorPanelGlyphFontSizeLarge}"/>
                        <Setter Target="BitShiftButton.FontSize" Value="{ThemeResource OperatorPanelFontSizeLarge}"/>

                        <Setter Target="BitwiseGrid.MinWidth" Value="387"/>
                        <Setter Target="BitwiseGrid.MinHeight" Value="192"/>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="Medium">
                    <VisualState.StateTriggers>
                        <triggers:ControlSizeTrigger MinWidth="630"
                                                     MinHeight="437"
                                                     Source="{x:Bind ProgRadixOps}"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle24}"/>
                        <Setter Target="AButton.Style" Value="{StaticResource NumericButtonStyle24}"/>
                        <Setter Target="BButton.Style" Value="{StaticResource NumericButtonStyle24}"/>
                        <Setter Target="CButton.Style" Value="{StaticResource NumericButtonStyle24}"/>
                        <Setter Target="DButton.Style" Value="{StaticResource NumericButtonStyle24}"/>
                        <Setter Target="EButton.Style" Value="{StaticResource NumericButtonStyle24}"/>
                        <Setter Target="FButton.Style" Value="{StaticResource NumericButtonStyle24}"/>

                        <Setter Target="ModButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="DivideButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="MinusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PlusButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="EqualButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ClearButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="NegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSizeLarge}"/>
                        <Setter Target="OpenParenthesisButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="CloseParenthesisButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>

                        <Setter Target="AndButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="OrButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="XorButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="NandButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="NorButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="RolButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="RorButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="RolCarryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="RorCarryButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="LshButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="RshButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="LshLogicalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="RshLogicalButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="NotButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>

                        <Setter Target="OperatorPanelRow.MinHeight" Value="{StaticResource OperatorPanelButtonRowSizeMedium}"/>

                        <Setter Target="BitwiseButton.ChevronFontSize" Value="{ThemeResource OperatorPanelChevronFontSizeMedium}"/>
                        <Setter Target="BitwiseButton.GlyphFontSize" Value="{ThemeResource OperatorPanelGlyphFontSizeMedium}"/>
                        <Setter Target="BitwiseButton.FontSize" Value="{ThemeResource OperatorPanelFontSizeMedium}"/>

                        <Setter Target="BitShiftButton.ChevronFontSize" Value="{ThemeResource OperatorPanelChevronFontSizeMedium}"/>
                        <Setter Target="BitShiftButton.GlyphFontSize" Value="{ThemeResource OperatorPanelGlyphFontSizeMedium}"/>
                        <Setter Target="BitShiftButton.FontSize" Value="{ThemeResource OperatorPanelFontSizeMedium}"/>

                        <Setter Target="BitwiseGrid.MinWidth" Value="416"/>
                        <Setter Target="BitwiseGrid.MinHeight" Value="144"/>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="Small">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="{StaticResource AppMinWindowHeight}" MinWindowWidth="{StaticResource AppMinWindowWidth}"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle18}"/>
                        <Setter Target="AButton.Style" Value="{StaticResource NumericButtonStyle14}"/>
                        <Setter Target="BButton.Style" Value="{StaticResource NumericButtonStyle14}"/>
                        <Setter Target="CButton.Style" Value="{StaticResource NumericButtonStyle14}"/>
                        <Setter Target="DButton.Style" Value="{StaticResource NumericButtonStyle14}"/>
                        <Setter Target="EButton.Style" Value="{StaticResource NumericButtonStyle14}"/>
                        <Setter Target="FButton.Style" Value="{StaticResource NumericButtonStyle14}"/>

                        <Setter Target="ModButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="DivideButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="MultiplyButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="MinusButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="PlusButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="EqualButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="ClearButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="ClearEntryButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="BackSpaceButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="NegateButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="OpenParenthesisButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="CloseParenthesisButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>

                        <Setter Target="AndButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="OrButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="XorButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="NandButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="NorButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="RolButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="RorButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="RolCarryButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="RorCarryButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="LshButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="RshButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="LshLogicalButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="RshLogicalButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>
                        <Setter Target="NotButton.FontSize" Value="{StaticResource CalcOperatorCaptionSize}"/>

                        <Setter Target="OperatorPanelRow.MinHeight" Value="{StaticResource OperatorPanelButtonRowSizeSmall}"/>

                        <Setter Target="BitwiseButton.ChevronFontSize" Value="{ThemeResource OperatorPanelChevronFontSizeSmall}"/>
                        <Setter Target="BitwiseButton.GlyphFontSize" Value="{ThemeResource OperatorPanelGlyphFontSizeSmall}"/>
                        <Setter Target="BitwiseButton.FontSize" Value="{ThemeResource OperatorPanelFontSizeSmall}"/>

                        <Setter Target="BitShiftButton.ChevronFontSize" Value="{ThemeResource OperatorPanelChevronFontSizeSmall}"/>
                        <Setter Target="BitShiftButton.GlyphFontSize" Value="{ThemeResource OperatorPanelGlyphFontSizeSmall}"/>
                        <Setter Target="BitShiftButton.FontSize" Value="{ThemeResource OperatorPanelFontSizeSmall}"/>

                        <Setter Target="BitwiseGrid.MinWidth" Value="194"/>
                        <Setter Target="BitwiseGrid.MinHeight" Value="96"/>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <controls:OperatorPanelListView x:Uid="ProgrammerOperatorPanel"
                                        Grid.ColumnSpan="6"
                                        Background="{ThemeResource AppOperatorPanelBackground}"
                                        AutomationProperties.HeadingLevel="Level1">

            <controls:OperatorPanelButton x:Name="BitwiseButton"
                                          x:Uid="bitwiseButton"
                                          Style="{StaticResource OperatorPanelButtonStyle}"
                                          AutomationProperties.AutomationId="bitwiseButton"
                                          Glyph="&#xF895;">
                <controls:OperatorPanelButton.FlyoutMenu>
                    <Flyout x:Name="BitwiseFlyout"
                            Windows10version1803:Placement="Bottom"
                            Windows10version1809:AreOpenCloseAnimationsEnabled="False"
                            Windows10version1809:Placement="BottomEdgeAlignedLeft"
                            FlyoutPresenterStyle="{ThemeResource OperatorPanelFlyoutStyle}">
                        <Grid x:Name="BitwiseGrid"
                              MinWidth="258"
                              MinHeight="96"
                              XYFocusKeyboardNavigation="Enabled">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="1*"/>
                                <RowDefinition Height="1*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1*"/>
                                <ColumnDefinition Width="1*"/>
                                <ColumnDefinition Width="1*"/>
                            </Grid.ColumnDefinitions>
                            <!--
                                Because of the way we handle keyboard shortcuts, the IsEnabled property must be bound to a button outside the flyout.
                                This is because the content from within the Flyout do not inherit the IsEnabled property of the flyout parent,
                                causing the shortcut keys to be used when the control would normally be disabled.
                            -->
                            <controls:CalculatorButton x:Name="AndButton"
                                                       x:Uid="andButton"
                                                       Style="{StaticResource OperatorButtonStyle}"
                                                       FontSize="12"
                                                       AutomationProperties.AutomationId="andButton"
                                                       ButtonId="And"
                                                       Click="FlyoutButton_Clicked"
                                                       Command="{x:Bind Model.ButtonPressed}"
                                                       Content="AND"
                                                       IsEnabled="{x:Bind BitwiseButton.IsEnabled, Mode=OneWay}"/>

                            <controls:CalculatorButton x:Name="OrButton"
                                                       x:Uid="orButton"
                                                       Grid.Column="1"
                                                       Style="{StaticResource OperatorButtonStyle}"
                                                       FontSize="12"
                                                       AutomationProperties.AutomationId="orButton"
                                                       ButtonId="Or"
                                                       Click="FlyoutButton_Clicked"
                                                       Command="{x:Bind Model.ButtonPressed}"
                                                       Content="OR"
                                                       IsEnabled="{x:Bind BitwiseButton.IsEnabled, Mode=OneWay}"/>

                            <controls:CalculatorButton x:Name="NotButton"
                                                       x:Uid="notButton"
                                                       Grid.Column="2"
                                                       Style="{StaticResource OperatorButtonStyle}"
                                                       FontSize="12"
                                                       AutomationProperties.AutomationId="notButton"
                                                       ButtonId="Not"
                                                       Click="FlyoutButton_Clicked"
                                                       Command="{x:Bind Model.ButtonPressed}"
                                                       Content="NOT"
                                                       IsEnabled="{x:Bind BitwiseButton.IsEnabled, Mode=OneWay}"/>

                            <controls:CalculatorButton x:Name="XorButton"
                                                       x:Uid="xorButton"
                                                       Grid.Row="1"
                                                       Grid.Column="2"
                                                       Style="{StaticResource OperatorButtonStyle}"
                                                       FontSize="12"
                                                       AutomationProperties.AutomationId="xorButton"
                                                       ButtonId="Xor"
                                                       Click="FlyoutButton_Clicked"
                                                       Command="{x:Bind Model.ButtonPressed}"
                                                       Content="XOR"
                                                       IsEnabled="{x:Bind BitwiseButton.IsEnabled, Mode=OneWay}"/>

                            <controls:CalculatorButton x:Name="NandButton"
                                                       x:Uid="nandButton"
                                                       Grid.Row="1"
                                                       Style="{StaticResource OperatorButtonStyle}"
                                                       FontSize="12"
                                                       AutomationProperties.AutomationId="nandButton"
                                                       ButtonId="Nand"
                                                       Click="FlyoutButton_Clicked"
                                                       Command="{x:Bind Model.ButtonPressed}"
                                                       Content="NAND"
                                                       IsEnabled="{x:Bind BitwiseButton.IsEnabled, Mode=OneWay}"/>

                            <controls:CalculatorButton x:Name="NorButton"
                                                       x:Uid="norButton"
                                                       Grid.Row="1"
                                                       Grid.Column="1"
                                                       Style="{StaticResource OperatorButtonStyle}"
                                                       FontSize="12"
                                                       AutomationProperties.AutomationId="norButton"
                                                       ButtonId="Nor"
                                                       Click="FlyoutButton_Clicked"
                                                       Command="{x:Bind Model.ButtonPressed}"
                                                       Content="NOR"
                                                       IsEnabled="{x:Bind BitwiseButton.IsEnabled, Mode=OneWay}"/>
                        </Grid>
                    </Flyout>
                </controls:OperatorPanelButton.FlyoutMenu>
            </controls:OperatorPanelButton>
            <controls:OperatorPanelButton x:Name="BitShiftButton"
                                          x:Uid="bitShiftButton"
                                          Style="{StaticResource OperatorPanelButtonStyle}"
                                          AutomationProperties.AutomationId="bitShiftButton"
                                          Glyph="&#xE301;">
                <controls:OperatorPanelButton.FlyoutMenu>
                    <Flyout x:Name="BitShiftFlyout"
                            Windows10version1809:AreOpenCloseAnimationsEnabled="False"
                            FlyoutPresenterStyle="{ThemeResource OperatorPanelFlyoutStyle}"
                            Placement="Bottom">
                        <StackPanel MaxWidth="192" Padding="12">
                            <RadioButton x:Name="ArithmeticShiftButton"
                                         x:Uid="arithmeticShiftButton"
                                         AutomationProperties.AutomationId="arithmeticShiftButton"
                                         Checked="BitshiftFlyout_Checked"
                                         IsChecked="True"/>
                            <RadioButton x:Name="LogicalShiftButton"
                                         x:Uid="logicalShiftButton"
                                         AutomationProperties.AutomationId="logicalShiftButton"
                                         Checked="BitshiftFlyout_Checked"/>
                            <RadioButton x:Name="RotateCircularButton"
                                         x:Uid="rotateCircularButton"
                                         AutomationProperties.AutomationId="rotateCircularButton"
                                         Checked="BitshiftFlyout_Checked"/>
                            <RadioButton x:Name="RotateCarryShiftButton"
                                         x:Uid="rotateCarryShiftButton"
                                         AutomationProperties.AutomationId="rotateCarryShiftButton"
                                         Checked="BitshiftFlyout_Checked"/>
                        </StackPanel>
                    </Flyout>
                </controls:OperatorPanelButton.FlyoutMenu>
            </controls:OperatorPanelButton>
        </controls:OperatorPanelListView>

        <Grid x:Uid="ProgrammerOperators"
              Grid.Row="1"
              Grid.Column="2"
              Grid.ColumnSpan="2"
              AutomationProperties.HeadingLevel="Level1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <controls:CalculatorButton x:Name="RolButton"
                                       x:Uid="rolButton"
                                       Grid.Column="0"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       x:DeferLoadStrategy="Lazy"
                                       AutomationProperties.AutomationId="rolButton"
                                       ButtonId="Rol"
                                       Content="&#xF88E;"
                                       Visibility="Collapsed"/>
            <controls:CalculatorButton x:Name="RorButton"
                                       x:Uid="rorButton"
                                       Grid.Column="1"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       x:DeferLoadStrategy="Lazy"
                                       AutomationProperties.AutomationId="rorButton"
                                       ButtonId="Ror"
                                       Content="&#xF88F;"
                                       Visibility="Collapsed"/>

            <controls:CalculatorButton x:Name="RolCarryButton"
                                       x:Uid="rolCarryButton"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       x:DeferLoadStrategy="Lazy"
                                       AutomationProperties.AutomationId="rolButton"
                                       ButtonId="RolC"
                                       Content="&#xF88E;"
                                       Visibility="Collapsed"/>

            <controls:CalculatorButton x:Name="RorCarryButton"
                                       x:Uid="rorCarryButton"
                                       Grid.Column="1"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       x:DeferLoadStrategy="Lazy"
                                       AutomationProperties.AutomationId="rorCarryButton"
                                       ButtonId="RorC"
                                       Content="&#xF88F;"
                                       Visibility="Collapsed"/>

            <controls:CalculatorButton x:Name="LshButton"
                                       x:Uid="lshButton"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="lshButton"
                                       ButtonId="Lsh"
                                       Content="&#xF88E;"/>
            <controls:CalculatorButton x:Name="RshButton"
                                       x:Uid="rshButton"
                                       Grid.Column="1"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="rshButton"
                                       ButtonId="Rsh"
                                       Content="&#xF88F;"/>

            <controls:CalculatorButton x:Name="LshLogicalButton"
                                       x:Uid="LshLogicalButton"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       x:DeferLoadStrategy="Lazy"
                                       AutomationProperties.AutomationId="lshLogicalButton"
                                       ButtonId="Lsh"
                                       Content="&#xF88E;"
                                       Visibility="Collapsed"/>
            <controls:CalculatorButton x:Name="RshLogicalButton"
                                       x:Uid="rshLogicalButton"
                                       Grid.Column="1"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       x:DeferLoadStrategy="Lazy"
                                       AutomationProperties.AutomationId="rshLogicalButton"
                                       ButtonId="RshL"
                                       Content="&#xF88F;"
                                       Visibility="Collapsed"/>
        </Grid>

        <Grid x:Uid="DisplayControls"
              Grid.Row="1"
              Grid.Column="4"
              Grid.ColumnSpan="2"
              AutomationProperties.HeadingLevel="Level1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <controls:CalculatorButton x:Name="ClearButton"
                                       x:Uid="clearButton"
                                       Style="{StaticResource OperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="clearButton"
                                       ButtonId="Clear"
                                       Content="C"
                                       Visibility="{x:Bind Model.IsInputEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"/>

            <controls:CalculatorButton x:Name="ClearEntryButton"
                                       x:Uid="clearEntryButton"
                                       Style="{StaticResource OperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="clearEntryButton"
                                       ButtonId="ClearEntry"
                                       Content="CE"
                                       Visibility="{x:Bind Model.IsInputEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>

            <controls:CalculatorButton x:Name="BackSpaceButton"
                                       x:Uid="backSpaceButton"
                                       Grid.Column="1"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="backSpaceButton"
                                       ButtonId="Backspace"
                                       Content="&#xE94F;"/>
        </Grid>

        <controls:CalculatorButton x:Name="OpenParenthesisButton"
                                   x:Uid="openParenthesisButton"
                                   Grid.Row="2"
                                   Grid.Column="2"
                                   Style="{StaticResource ParenthesisCalcButtonStyle}"
                                   FontSize="18"
                                   AutomationProperties.AutomationId="openParenthesisButton"
                                   ButtonId="OpenParenthesis"
                                   Content="("
                                   GotFocus="OpenParenthesisButton_GotFocus"
                                   Tag="{x:Bind ParenthesisCountToString(Model.OpenParenthesisCount), Mode=OneWay}"/>

        <controls:CalculatorButton x:Name="CloseParenthesisButton"
                                   x:Uid="closeParenthesisButton"
                                   Grid.Row="2"
                                   Grid.Column="3"
                                   Style="{StaticResource OperatorButtonStyle}"
                                   FontSize="18"
                                   AutomationProperties.AutomationId="closeParenthesisButton"
                                   ButtonId="CloseParenthesis"
                                   Content=")"/>

        <controls:CalculatorButton x:Name="ModButton"
                                   x:Uid="modButton"
                                   Grid.Row="2"
                                   Grid.Column="4"
                                   Style="{StaticResource OperatorButtonStyle}"
                                   FontSize="12"
                                   AutomationProperties.AutomationId="modButton"
                                   ButtonId="Mod"
                                   Content="%"/>

        <Grid x:Uid="StandardOperators"
              Grid.Row="2"
              Grid.RowSpan="5"
              Grid.Column="5"
              AutomationProperties.HeadingLevel="Level1">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <controls:CalculatorButton x:Name="DivideButton"
                                       x:Uid="divideButton"
                                       Grid.Row="0"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="divideButton"
                                       ButtonId="Divide"
                                       Content="&#xE94A;"/>

            <controls:CalculatorButton x:Name="MultiplyButton"
                                       x:Uid="multiplyButton"
                                       Grid.Row="1"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="multiplyButton"
                                       ButtonId="Multiply"
                                       Content="&#xE947;"/>

            <controls:CalculatorButton x:Name="MinusButton"
                                       x:Uid="minusButton"
                                       Grid.Row="2"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="minusButton"
                                       ButtonId="Subtract"
                                       Content="&#xE949;"/>

            <controls:CalculatorButton x:Name="PlusButton"
                                       x:Uid="plusButton"
                                       Grid.Row="3"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="plusButton"
                                       ButtonId="Add"
                                       Content="&#xE948;"/>

            <controls:CalculatorButton x:Name="EqualButton"
                                       x:Uid="equalButton"
                                       Grid.Row="4"
                                       Style="{StaticResource AccentEmphasizedCalcButtonStyle}"
                                       FontSize="12"
                                       AutomationProperties.AutomationId="equalButton"
                                       ButtonId="Equals"
                                       Content="&#xE94E;"/>
        </Grid>

        <Grid x:Uid="NumberPad"
              Grid.Row="1"
              Grid.RowSpan="6"
              Grid.Column="1"
              Grid.ColumnSpan="5"
              AutomationProperties.AutomationId="NumberPad"
              AutomationProperties.HeadingLevel="Level1">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <controls:CalculatorButton x:Name="AButton"
                                       x:Uid="aButton"
                                       Grid.Row="0"
                                       Grid.Column="0"
                                       Style="{StaticResource NumericButtonStyle12}"
                                       AutomationProperties.AutomationId="aButton"
                                       ButtonId="A"
                                       Content="A"
                                       IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>

            <controls:CalculatorButton x:Name="BButton"
                                       x:Uid="bButton"
                                       Grid.Row="1"
                                       Grid.Column="0"
                                       Style="{StaticResource NumericButtonStyle12}"
                                       AutomationProperties.AutomationId="bButton"
                                       ButtonId="B"
                                       Content="B"
                                       IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>

            <controls:CalculatorButton x:Name="CButton"
                                       x:Uid="cButton"
                                       Grid.Row="2"
                                       Grid.Column="0"
                                       Style="{StaticResource NumericButtonStyle12}"
                                       AutomationProperties.AutomationId="cButton"
                                       ButtonId="C"
                                       Content="C"
                                       IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>

            <controls:CalculatorButton x:Name="DButton"
                                       x:Uid="dButton"
                                       Grid.Row="3"
                                       Grid.Column="0"
                                       Style="{StaticResource NumericButtonStyle12}"
                                       AutomationProperties.AutomationId="dButton"
                                       ButtonId="D"
                                       Content="D"
                                       IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>

            <controls:CalculatorButton x:Name="EButton"
                                       x:Uid="eButton"
                                       Grid.Row="4"
                                       Grid.Column="0"
                                       Style="{StaticResource NumericButtonStyle12}"
                                       AutomationProperties.AutomationId="eButton"
                                       ButtonId="E"
                                       Content="E"
                                       IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>

            <controls:CalculatorButton x:Name="FButton"
                                       x:Uid="fButton"
                                       Grid.Row="5"
                                       Grid.Column="0"
                                       Style="{StaticResource NumericButtonStyle12}"
                                       AutomationProperties.AutomationId="fButton"
                                       ButtonId="F"
                                       Content="F"
                                       IsEnabled="{x:Bind Model.AreHEXButtonsEnabled, Mode=OneWay}"/>

            <local:NumberPad x:Name="NumberPad"
                             Grid.Row="2"
                             Grid.RowSpan="4"
                             Grid.Column="1"
                             Grid.ColumnSpan="3"
                             ButtonStyle="{StaticResource NumericButtonStyle18}"
                             CurrentRadixType="{x:Bind Model.CurrentRadixType, Mode=OneWay}"/>
        </Grid>

        <controls:CalculatorButton x:Name="NegateButton"
                                   x:Uid="negateButton"
                                   Grid.Row="6"
                                   Grid.Column="2"
                                   Style="{StaticResource SymbolOperatorKeypadButtonStyle}"
                                   FontSize="12"
                                   FontWeight="Normal"
                                   AutomationProperties.AutomationId="negateButton"
                                   ButtonId="Negate"
                                   Content="&#xF898;"/>
    </Grid>
</UserControl>
