<UserControl x:Class="CalculatorApp.CalculatorScientificOperators"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             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:designdata="using:CalculatorApp.DesignData"
             xmlns:local="using:CalculatorApp"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             x:Name="ControlRoot"
             d:DesignHeight="400"
             d:DesignWidth="315"
             mc:Ignorable="d">
    <UserControl.Resources>
        <converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <converters:BooleanToVisibilityNegationConverter x:Key="BooleanToVisibilityNegationConverter"/>
    </UserControl.Resources>
    <Grid x:Name="ScientificOperators">
        <Grid.RowDefinitions>
            <RowDefinition x:Name="R0" Height="1*"/>
            <RowDefinition x:Name="R1" Height="0"/>
            <RowDefinition x:Name="R2" Height="1*"/>
            <RowDefinition x:Name="R3" Height="0"/>
            <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="0"/>
            <ColumnDefinition x:Name="C1" Width="0"/>
            <ColumnDefinition x:Name="C2" Width="0"/>
            <ColumnDefinition x:Name="C3" Width="0"/>
            <ColumnDefinition x:Name="C4" Width="1*"/>
            <ColumnDefinition x:Name="C5" Width="1*"/>
            <ColumnDefinition x:Name="C6" Width="1*"/>
            <ColumnDefinition x:Name="C7" Width="1*"/>
            <ColumnDefinition x:Name="C8" 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="XPower2Button.IsEnabled" Value="False"/>
                        <Setter Target="PowerButton.IsEnabled" Value="False"/>
                        <Setter Target="SinButton.IsEnabled" Value="False"/>
                        <Setter Target="CosButton.IsEnabled" Value="False"/>
                        <Setter Target="TanButton.IsEnabled" Value="False"/>
                        <Setter Target="SinhButton.IsEnabled" Value="False"/>
                        <Setter Target="CoshButton.IsEnabled" Value="False"/>
                        <Setter Target="TanhButton.IsEnabled" Value="False"/>

                        <Setter Target="XPower3Button.IsEnabled" Value="False"/>
                        <Setter Target="YSquareRootButton.IsEnabled" Value="False"/>
                        <Setter Target="InvsinButton.IsEnabled" Value="False"/>
                        <Setter Target="InvcosButton.IsEnabled" Value="False"/>
                        <Setter Target="InvtanButton.IsEnabled" Value="False"/>
                        <Setter Target="InvsinhButton.IsEnabled" Value="False"/>
                        <Setter Target="InvcoshButton.IsEnabled" Value="False"/>
                        <Setter Target="InvtanhButton.IsEnabled" Value="False"/>

                        <Setter Target="SquareRootButton.IsEnabled" Value="False"/>
                        <Setter Target="PowerOf10Button.IsEnabled" Value="False"/>
                        <Setter Target="LogBase10Button.IsEnabled" Value="False"/>
                        <Setter Target="ExpButton.IsEnabled" Value="False"/>
                        <Setter Target="ModButton.IsEnabled" Value="False"/>

                        <Setter Target="InvertButton.IsEnabled" Value="False"/>
                        <Setter Target="PowerOfEButton.IsEnabled" Value="False"/>
                        <Setter Target="LogBaseEButton.IsEnabled" Value="False"/>
                        <Setter Target="DmsButton.IsEnabled" Value="False"/>
                        <Setter Target="DegreesButton.IsEnabled" Value="False"/>

                        <Setter Target="ShiftButton.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="PiButton.IsEnabled" Value="False"/>
                        <Setter Target="FactorialButton.IsEnabled" Value="False"/>
                        <Setter Target="NegateButton.IsEnabled" Value="False"/>
                        <Setter Target="OpenParenthesisButton.IsEnabled" Value="False"/>
                        <Setter Target="CloseParenthesisButton.IsEnabled" Value="False"/>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="SizeLayouts">
                <VisualState x:Name="Portrait">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="R1.Height" Value="1*"/>
                        <Setter Target="R3.Height" Value="1*"/>
                        <Setter Target="OpR2.Height" Value="1*"/>
                        <Setter Target="OpR3.Height" Value="1*"/>
                        <Setter Target="Row1.Visibility" Value="Visible"/>
                        <Setter Target="Row2.Visibility" Value="Visible"/>
                        <Setter Target="InvRow1.(Grid.Row)" Value="1"/>
                        <Setter Target="Row2.(Grid.Row)" Value="2"/>
                        <Setter Target="InvRow2.(Grid.Row)" Value="3"/>
                        <Setter Target="InvRow1.Visibility" Value="Visible"/>
                        <Setter Target="InvRow2.Visibility" Value="Visible"/>

                        <Setter Target="NegateButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PiButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="FactorialButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="OpenParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="CloseParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="SinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="CosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="TanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="SinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="CoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="TanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>

                        <Setter Target="InvsinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvcosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvtanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvsinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvcoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvtanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PowerButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PowerOf10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="LogBase10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ExpButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ModButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="YSquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PowerOfEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="LogBaseEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="DmsButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="DegreesButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="XPower2Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="XPower3Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="SquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvertButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>

                        <Setter Target="ClearEntryButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ClearButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="BackSpaceButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="DivideButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="MultiplyButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="MinusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PlusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="EqualButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="NumberPad.ButtonStyle" Value="{ThemeResource NumericButtonStyle34}"/>
                    </VisualState.Setters>
                    <Storyboard Completed="WideLayout_Completed"/>
                </VisualState>
                <VisualState x:Name="WideL">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="768" MinWindowWidth="1200"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="R0.Height" Value="0"/>
                        <Setter Target="R2.Height" Value="0"/>
                        <Setter Target="C0.Width" Value="1*"/>
                        <Setter Target="C1.Width" Value="1*"/>
                        <Setter Target="C2.Width" Value="1*"/>
                        <Setter Target="C3.Width" Value="1*"/>
                        <Setter Target="ShiftButton.(Grid.Row)" Value="8"/>
                        <Setter Target="ShiftButton.(Grid.Column)" Value="1"/>
                        <Setter Target="ScientificFunctions.(Grid.Row)" Value="4"/>
                        <Setter Target="ScientificFunctions.(Grid.Column)" Value="1"/>
                        <Setter Target="OpR2.Height" Value="1*"/>
                        <Setter Target="OpR3.Height" Value="1*"/>
                        <Setter Target="Row1.Visibility" Value="Visible"/>
                        <Setter Target="Row2.Visibility" Value="Visible"/>
                        <Setter Target="InvRow1.(Grid.Row)" Value="1"/>
                        <Setter Target="Row2.(Grid.Row)" Value="2"/>
                        <Setter Target="InvRow2.(Grid.Row)" Value="3"/>
                        <Setter Target="InvRow1.Visibility" Value="Visible"/>
                        <Setter Target="InvRow2.Visibility" Value="Visible"/>

                        <Setter Target="NegateButton.(Grid.Row)" Value="8"/>
                        <Setter Target="NegateButton.(Grid.Column)" Value="6"/>
                        <Setter Target="PiButton.(Grid.Row)" Value="8"/>
                        <Setter Target="PiButton.(Grid.Column)" Value="2"/>
                        <Setter Target="FactorialButton.(Grid.Row)" Value="8"/>
                        <Setter Target="FactorialButton.(Grid.Column)" Value="3"/>
                        <Setter Target="OpenParenthesisButton.(Grid.Row)" Value="8"/>
                        <Setter Target="OpenParenthesisButton.(Grid.Column)" Value="4"/>
                        <Setter Target="CloseParenthesisButton.(Grid.Row)" Value="8"/>
                        <Setter Target="CloseParenthesisButton.(Grid.Column)" Value="5"/>

                        <Setter Target="NegateButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PiButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="FactorialButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="OpenParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="CloseParenthesisButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="SinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="CosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="TanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="SinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="CoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="TanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>

                        <Setter Target="InvsinButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvcosButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvtanButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvsinhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvcoshButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvtanhButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PowerButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PowerOf10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="LogBase10Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ExpButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ModButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="YSquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PowerOfEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="LogBaseEButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="DmsButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="DegreesButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="XPower2Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="XPower3Button.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="SquareRootButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="InvertButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>

                        <Setter Target="ClearEntryButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="ClearButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="BackSpaceButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="DivideButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="MultiplyButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="MinusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="PlusButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="EqualButton.FontSize" Value="{ThemeResource CalcStandardOperatorCaptionSize}"/>
                        <Setter Target="NumberPad.ButtonStyle" Value="{ThemeResource NumericButtonStyle34}"/>
                    </VisualState.Setters>
                    <Storyboard Completed="WideLayout_Completed"/>
                </VisualState>
                <VisualState x:Name="WideMINI">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="1024"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="R0.Height" Value="0"/>
                        <Setter Target="R2.Height" Value="0"/>
                        <Setter Target="C0.Width" Value="1*"/>
                        <Setter Target="C1.Width" Value="1*"/>
                        <Setter Target="C2.Width" Value="1*"/>
                        <Setter Target="C3.Width" Value="1*"/>
                        <Setter Target="ShiftButton.(Grid.Row)" Value="8"/>
                        <Setter Target="ShiftButton.(Grid.Column)" Value="1"/>
                        <Setter Target="ScientificFunctions.(Grid.Row)" Value="4"/>
                        <Setter Target="ScientificFunctions.(Grid.Column)" Value="1"/>
                        <Setter Target="OpR2.Height" Value="1*"/>
                        <Setter Target="OpR3.Height" Value="1*"/>
                        <Setter Target="Row1.Visibility" Value="Visible"/>
                        <Setter Target="Row2.Visibility" Value="Visible"/>
                        <Setter Target="InvRow1.(Grid.Row)" Value="1"/>
                        <Setter Target="Row2.(Grid.Row)" Value="2"/>
                        <Setter Target="InvRow2.(Grid.Row)" Value="3"/>
                        <Setter Target="InvRow1.Visibility" Value="Visible"/>
                        <Setter Target="InvRow2.Visibility" Value="Visible"/>

                        <Setter Target="NegateButton.(Grid.Row)" Value="8"/>
                        <Setter Target="NegateButton.(Grid.Column)" Value="6"/>
                        <Setter Target="PiButton.(Grid.Row)" Value="8"/>
                        <Setter Target="PiButton.(Grid.Column)" Value="2"/>
                        <Setter Target="FactorialButton.(Grid.Row)" Value="8"/>
                        <Setter Target="FactorialButton.(Grid.Column)" Value="3"/>
                        <Setter Target="OpenParenthesisButton.(Grid.Row)" Value="8"/>
                        <Setter Target="OpenParenthesisButton.(Grid.Column)" Value="4"/>
                        <Setter Target="CloseParenthesisButton.(Grid.Row)" Value="8"/>
                        <Setter Target="CloseParenthesisButton.(Grid.Column)" Value="5"/>
                    </VisualState.Setters>
                    <Storyboard Completed="WideLayout_Completed"/>
                </VisualState>
                <VisualState x:Name="Fill640x800">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="800" MinWindowWidth="640"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="R1.Height" Value="1*"/>
                        <Setter Target="R3.Height" Value="1*"/>
                        <Setter Target="OpR2.Height" Value="1*"/>
                        <Setter Target="OpR3.Height" Value="1*"/>
                        <Setter Target="Row1.Visibility" Value="Visible"/>
                        <Setter Target="Row2.Visibility" Value="Visible"/>
                        <Setter Target="InvRow1.(Grid.Row)" Value="1"/>
                        <Setter Target="Row2.(Grid.Row)" Value="2"/>
                        <Setter Target="InvRow2.(Grid.Row)" Value="3"/>
                        <Setter Target="InvRow1.Visibility" Value="Visible"/>
                        <Setter Target="InvRow2.Visibility" Value="Visible"/>
                    </VisualState.Setters>
                    <Storyboard Completed="WideLayout_Completed"/>
                </VisualState>
                <VisualState x:Name="Fill640x528">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="640"/>
                    </VisualState.StateTriggers>
                    <Storyboard Completed="ShortLayout_Completed"/>
                </VisualState>
                <VisualState x:Name="Snap320x800">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="800" MinWindowWidth="0"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="R1.Height" Value="1*"/>
                        <Setter Target="R3.Height" Value="1*"/>
                        <Setter Target="OpR2.Height" Value="1*"/>
                        <Setter Target="OpR3.Height" Value="1*"/>
                        <Setter Target="Row1.Visibility" Value="Visible"/>
                        <Setter Target="Row2.Visibility" Value="Visible"/>
                        <Setter Target="InvRow1.(Grid.Row)" Value="1"/>
                        <Setter Target="Row2.(Grid.Row)" Value="2"/>
                        <Setter Target="InvRow2.(Grid.Row)" Value="3"/>
                        <Setter Target="InvRow1.Visibility" Value="Visible"/>
                        <Setter Target="InvRow2.Visibility" Value="Visible"/>
                    </VisualState.Setters>
                    <Storyboard Completed="WideLayout_Completed"/>
                </VisualState>
                <VisualState x:Name="MinSizeLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="{StaticResource AppMinWindowHeight}" MinWindowWidth="{StaticResource AppMinWindowWidth}"/>
                    </VisualState.StateTriggers>
                    <Storyboard Completed="ShortLayout_Completed"/>
                </VisualState>
                <VisualState x:Name="DefaultLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="0"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="ShiftButton.Style" Value="{StaticResource CaptionToggleButtonSmallStyle}"/>
                    </VisualState.Setters>
                    <Storyboard Completed="ShortLayout_Completed"/>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <Grid x:Name="ScientificFunctions"
              x:Uid="ScientificFunctions"
              Grid.RowSpan="4"
              Grid.Column="5"
              Grid.ColumnSpan="5"
              AutomationProperties.HeadingLevel="Level1">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition x:Name="OpR2" Height="0"/>
                <RowDefinition x:Name="OpR3" Height="0"/>
            </Grid.RowDefinitions>

            <!-- Scientific Row 1 -->
            <Grid x:Name="Row1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>

                <controls:CalculatorButton x:Name="XPower2Button"
                                           x:Uid="xpower2Button"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="xpower2Button"
                                           ButtonId="XPower2"
                                           Content="&#xf7c8;"/>
                <controls:CalculatorButton x:Name="PowerButton"
                                           x:Uid="powerButton"
                                           Grid.Column="1"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="powerButton"
                                           ButtonId="XPowerY"
                                           Content="&#xf7ca;"/>
                <controls:CalculatorButton x:Name="SinButton"
                                           x:Uid="sinButton"
                                           Grid.Column="2"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="sinButton"
                                           ButtonId="Sin"
                                           Content="sin"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
                <controls:CalculatorButton x:Name="CosButton"
                                           x:Uid="cosButton"
                                           Grid.Column="3"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="cosButton"
                                           ButtonId="Cos"
                                           Content="cos"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
                <controls:CalculatorButton x:Name="TanButton"
                                           x:Uid="tanButton"
                                           Grid.Column="4"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="tanButton"
                                           ButtonId="Tan"
                                           Content="tan"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
                <controls:CalculatorButton x:Name="SinhButton"
                                           x:Uid="sinhButton"
                                           Grid.Column="2"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="sinhButton"
                                           ButtonId="Sinh"
                                           Content="sinh"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <controls:CalculatorButton x:Name="CoshButton"
                                           x:Uid="coshButton"
                                           Grid.Column="3"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="coshButton"
                                           ButtonId="Cosh"
                                           Content="cosh"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <controls:CalculatorButton x:Name="TanhButton"
                                           x:Uid="tanhButton"
                                           Grid.Column="4"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="tanhButton"
                                           ButtonId="Tanh"
                                           Content="tanh"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
            </Grid>

            <!-- Scientific INV Row 1 -->
            <Grid x:Name="InvRow1" Visibility="Collapsed">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition x:Name="CX0" Width="1*"/>
                    <ColumnDefinition x:Name="CX1" Width="1*"/>
                    <ColumnDefinition x:Name="CX2" Width="1*"/>
                    <ColumnDefinition x:Name="Cx3" Width="1*"/>
                    <ColumnDefinition x:Name="CX4" Width="1*"/>
                </Grid.ColumnDefinitions>

                <controls:CalculatorButton x:Name="XPower3Button"
                                           x:Uid="xpower3Button"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="xpower3Button"
                                           ButtonId="Cube"
                                           Content="&#xf7cb;"/>
                <controls:CalculatorButton x:Name="YSquareRootButton"
                                           x:Uid="ySquareRootButton"
                                           Grid.Column="1"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="ySquareRootButton"
                                           ButtonId="YRootX"
                                           Content="&#xf7cd;"/>
                <controls:CalculatorButton x:Name="InvsinButton"
                                           x:Uid="invsinButton"
                                           Grid.Column="2"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="invsinButton"
                                           ButtonId="InvSin"
                                           Content="sin⁻¹"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
                <controls:CalculatorButton x:Name="InvcosButton"
                                           x:Uid="invcosButton"
                                           Grid.Column="3"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="invcosButton"
                                           ButtonId="InvCos"
                                           Content="cos⁻¹"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
                <controls:CalculatorButton x:Name="InvtanButton"
                                           x:Uid="invtanButton"
                                           Grid.Column="4"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="invtanButton"
                                           ButtonId="InvTan"
                                           Content="tan⁻¹"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityNegationConverter}}"/>
                <controls:CalculatorButton x:Name="InvsinhButton"
                                           x:Uid="invsinhButton"
                                           Grid.Column="2"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="invsinhButton"
                                           ButtonId="InvSinh"
                                           Content="sinh⁻¹"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <controls:CalculatorButton x:Name="InvcoshButton"
                                           x:Uid="invcoshButton"
                                           Grid.Column="3"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="invcoshButton"
                                           ButtonId="InvCosh"
                                           Content="cosh⁻¹"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <controls:CalculatorButton x:Name="InvtanhButton"
                                           x:Uid="invtanhButton"
                                           Grid.Column="4"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="invtanhButton"
                                           ButtonId="InvTanh"
                                           Content="tanh⁻¹"
                                           Visibility="{Binding IsHyperbolicChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
            </Grid>

            <!-- Scientific Row 2 -->
            <Grid x:Name="Row2" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>

                <controls:CalculatorButton x:Name="SquareRootButton"
                                           x:Uid="squareRootButton"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="squareRootButton"
                                           ButtonId="Sqrt"
                                           Content="&#xF899;"/>
                <controls:CalculatorButton x:Name="PowerOf10Button"
                                           x:Uid="powerOf10Button"
                                           Grid.Column="1"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="powerOf10Button"
                                           ButtonId="TenPowerX"
                                           Content="&#xF7CC;"/>
                <controls:CalculatorButton x:Name="LogBase10Button"
                                           x:Uid="logBase10Button"
                                           Grid.Column="2"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="logBase10Button"
                                           ButtonId="LogBase10"
                                           Content="log"/>
                <controls:CalculatorButton x:Name="ExpButton"
                                           x:Uid="expButton"
                                           Grid.Column="3"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="expButton"
                                           ButtonId="Exp"
                                           Content="Exp"/>
                <controls:CalculatorButton x:Name="ModButton"
                                           x:Uid="modButton"
                                           Grid.Column="4"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="modButton"
                                           ButtonId="Mod"
                                           Content="Mod"/>
            </Grid>

            <!-- Scientific INV Row 2 -->
            <Grid x:Name="InvRow2"
                  Grid.Row="1"
                  Visibility="Collapsed">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>

                <controls:CalculatorButton x:Name="InvertButton"
                                           x:Uid="invertButton"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="invertButton"
                                           ButtonId="Invert"
                                           Content="&#xf7c9;"/>
                <controls:CalculatorButton x:Name="PowerOfEButton"
                                           x:Uid="powerOfEButton"
                                           Grid.Column="1"
                                           Style="{StaticResource SymbolOperatorButtonStyle}"
                                           AutomationProperties.AutomationId="powerOfEButton"
                                           ButtonId="EPowerX"
                                           Content="&#xf7ce;"/>
                <controls:CalculatorButton x:Name="LogBaseEButton"
                                           x:Uid="logBaseEButton"
                                           Grid.Column="2"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="logBaseEButton"
                                           ButtonId="LogBaseE"
                                           Content="ln"/>
                <controls:CalculatorButton x:Name="DmsButton"
                                           x:Uid="dmsButton"
                                           Grid.Column="3"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="dmsButton"
                                           ButtonId="DMS"
                                           Content="dms"/>
                <controls:CalculatorButton x:Name="DegreesButton"
                                           x:Uid="degreesButton"
                                           Grid.Column="4"
                                           Style="{StaticResource OperatorButtonStyle}"
                                           AutomationProperties.AutomationId="degreesButton"
                                           ButtonId="Degrees"
                                           Content="deg"/>
            </Grid>
        </Grid>

        <ToggleButton x:Name="ShiftButton"
                      x:Uid="shiftButton"
                      Grid.Row="4"
                      Grid.Column="5"
                      Style="{StaticResource CaptionToggleButtonStyle}"
                      FontFamily="{StaticResource CalculatorFontFamily}"
                      FontSize="20"
                      AutomationProperties.AutomationId="shiftButton"
                      Checked="shiftButton_Check"
                      Content="&#xF897;"
                      IsEnabled="{x:Bind IsShiftEnabled(IsWideLayout, IsErrorVisualState), Mode=OneWay}"
                      IsEnabledChanged="shiftButton_IsEnabledChanged"
                      Unchecked="shiftButton_Check"/>

        <Grid x:Name="StandardOperators"
              x:Uid="StandardOperators"
              Grid.Row="4"
              Grid.RowSpan="5"
              Grid.Column="9"
              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 AccentCalcButtonStyle}"
                                       AutomationProperties.AutomationId="divideButton"
                                       ButtonId="Divide"
                                       Content="&#xE94A;"/>
            <controls:CalculatorButton x:Name="MultiplyButton"
                                       x:Uid="multiplyButton"
                                       Grid.Row="1"
                                       Style="{StaticResource AccentCalcButtonStyle}"
                                       AutomationProperties.AutomationId="multiplyButton"
                                       ButtonId="Multiply"
                                       Content="&#xE947;"/>
            <controls:CalculatorButton x:Name="MinusButton"
                                       x:Uid="minusButton"
                                       Grid.Row="2"
                                       Style="{StaticResource AccentCalcButtonStyle}"
                                       AutomationProperties.AutomationId="minusButton"
                                       ButtonId="Subtract"
                                       Content="&#xE949;"/>
            <controls:CalculatorButton x:Name="PlusButton"
                                       x:Uid="plusButton"
                                       Grid.Row="3"
                                       Style="{StaticResource AccentCalcButtonStyle}"
                                       AutomationProperties.AutomationId="plusButton"
                                       ButtonId="Add"
                                       Content="&#xE948;"/>
            <controls:CalculatorButton x:Name="EqualButton"
                                       x:Uid="equalButton"
                                       Grid.Row="4"
                                       Style="{StaticResource AccentCalcButtonStyle}"
                                       AutomationProperties.AutomationId="equalButton"
                                       ButtonId="Equals"
                                       Content="&#xE94E;"/>
        </Grid>

        <Grid x:Name="DisplayControls"
              x:Uid="DisplayControls"
              Grid.Row="4"
              Grid.Column="6"
              Grid.ColumnSpan="3"
              AutomationProperties.HeadingLevel="Level1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <controls:CalculatorButton x:Name="ClearEntryButton"
                                       x:Uid="clearEntryButton"
                                       Style="{StaticResource OperatorButtonStyle}"
                                       FontSize="16"
                                       AutomationProperties.AutomationId="clearEntryButton"
                                       ButtonId="ClearEntry"
                                       Content="CE"/>
            <controls:CalculatorButton x:Name="ClearButton"
                                       x:Uid="clearButton"
                                       Grid.Column="1"
                                       Style="{StaticResource OperatorButtonStyle}"
                                       FontSize="16"
                                       AutomationProperties.AutomationId="clearButton"
                                       ButtonId="Clear"
                                       Content="C"/>
            <controls:CalculatorButton x:Name="BackSpaceButton"
                                       x:Uid="backSpaceButton"
                                       Grid.Column="2"
                                       Style="{StaticResource SymbolOperatorButtonStyle}"
                                       FontFamily="{StaticResource CalculatorFontFamily}"
                                       FontSize="16"
                                       AutomationProperties.AutomationId="backSpaceButton"
                                       ButtonId="Backspace"
                                       Content="&#xE94F;"/>
        </Grid>

        <controls:CalculatorButton x:Name="PiButton"
                                   x:Uid="piButton"
                                   Grid.Row="5"
                                   Grid.Column="5"
                                   Style="{StaticResource SymbolOperatorButtonStyle}"
                                   FontSize="14"
                                   AutomationProperties.AutomationId="piButton"
                                   ButtonId="Pi"
                                   Content="&#xf7cf;"/>
        <controls:CalculatorButton x:Name="FactorialButton"
                                   x:Uid="factorialButton"
                                   Grid.Row="6"
                                   Grid.Column="5"
                                   Style="{StaticResource OperatorButtonStyle}"
                                   FontSize="18"
                                   AutomationProperties.AutomationId="factorialButton"
                                   ButtonId="Factorial"
                                   Content="n!"/>
        <controls:CalculatorButton x:Name="NegateButton"
                                   x:Uid="negateButton"
                                   Grid.Row="7"
                                   Grid.Column="5"
                                   Style="{StaticResource SymbolOperatorButtonStyle}"
                                   FontSize="16"
                                   AutomationProperties.AutomationId="negateButton"
                                   ButtonId="Negate"
                                   Content="&#xF898;"
                                   IsEnabled="{x:Bind Model.IsNegateEnabled, Mode=OneWay}"/>
        <controls:CalculatorButton x:Name="OpenParenthesisButton"
                                   x:Uid="openParenthesisButton"
                                   Grid.Row="8"
                                   Grid.Column="5"
                                   Style="{StaticResource ParenthesisCalcButtonStyle}"
                                   FontSize="19"
                                   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="8"
                                   Grid.Column="6"
                                   Style="{StaticResource OperatorButtonStyle}"
                                   FontSize="19"
                                   AutomationProperties.AutomationId="closeParenthesisButton"
                                   ButtonId="CloseParenthesis"
                                   Content=")"/>

        <local:NumberPad x:Name="NumberPad"
                         x:Uid="NumberPad"
                         Grid.Row="5"
                         Grid.RowSpan="4"
                         Grid.Column="6"
                         Grid.ColumnSpan="3"
                         AutomationProperties.HeadingLevel="Level1"
                         ButtonStyle="{StaticResource NumericButtonStyle24}"/>
    </Grid>
</UserControl>
