Use ToggleButton for variable options chevron button (#1219)

* Use togglebutton instead

* Update src/Calculator/Views/GraphingCalculator/EquationInputArea.xaml

Co-authored-by: Rudy Huyn <rudyhuyn@gmail.com>

* Update src/Calculator/Views/GraphingCalculator/EquationInputArea.xaml

Co-authored-by: Rudy Huyn <rudyhuyn@gmail.com>

* undo pr suggestion

Co-authored-by: Rudy Huyn <rudyhuyn@gmail.com>
This commit is contained in:
Pepe Rivera 2020-05-13 18:42:35 -07:00 committed by GitHub
parent 7a6b0a72c3
commit 0f14e4f46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 10 deletions

View File

@ -4433,7 +4433,11 @@
</data>
<data name="VariableAreaSettings.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Variable options</value>
<comment>Screen reader prompt for the variable settings button</comment>
<comment>Screen reader prompt for the variable settings toggle button</comment>
</data>
<data name="VariableAreaSettings.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Toggle variable options</value>
<comment>Tool tip for the variable settings toggle button</comment>
</data>
<data name="LineThicknessBoxHeading.Text" xml:space="preserve">
<value>Line Thickness</value>

View File

@ -215,17 +215,50 @@
Text="{x:Bind Max, Mode=OneWay}"/>
</Grid>
</Grid>
<Button x:Uid="VariableAreaSettings"
<ToggleButton Name="VariableAreaSettings"
x:Uid="VariableAreaSettings"
Margin="0,6,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
Click="VariableAreaClicked"
IsChecked="{x:Bind SliderSettingsVisible, Mode=OneWay}"
Tapped="VariableAreaButtonTapped">
<ToggleButton.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="ToggleButtonBackground" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="Transparent"/>
<StaticResource x:Key="ToggleButtonBorderBrushChecked" ResourceKey="ToggleButtonBorderBrush"/>
<StaticResource x:Key="ToggleButtonForegroundChecked" ResourceKey="ToggleButtonForeground"/>
<StaticResource x:Key="ToggleButtonBackgroundCheckedPointerOver" ResourceKey="ToggleButtonBackgroundPointerOver"/>
<StaticResource x:Key="ToggleButtonBorderBrushCheckedPointerOver" ResourceKey="ToggleButtonBorderBrushPointerOver"/>
<StaticResource x:Key="ToggleButtonForegroundCheckedPointerOver" ResourceKey="ToggleButtonForegroundPointerOver"/>
<StaticResource x:Key="ToggleButtonBackgroundCheckedPressed" ResourceKey="ToggleButtonBackgroundPressed"/>
<StaticResource x:Key="ToggleButtonBorderBrushCheckedPressed" ResourceKey="ToggleButtonBorderBrushPressed"/>
<StaticResource x:Key="ToggleButtonForegroundCheckedPressed" ResourceKey="ToggleButtonForegroundPressed"/>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ToggleButtonBackground" Color="Transparent"/>
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="Transparent"/>
<StaticResource x:Key="ToggleButtonBorderBrushChecked" ResourceKey="ToggleButtonBorderBrush"/>
<StaticResource x:Key="ToggleButtonForegroundChecked" ResourceKey="ToggleButtonForeground"/>
<StaticResource x:Key="ToggleButtonBackgroundCheckedPointerOver" ResourceKey="ToggleButtonBackgroundPointerOver"/>
<StaticResource x:Key="ToggleButtonBorderBrushCheckedPointerOver" ResourceKey="ToggleButtonBorderBrushPointerOver"/>
<StaticResource x:Key="ToggleButtonForegroundCheckedPointerOver" ResourceKey="ToggleButtonForegroundPointerOver"/>
<StaticResource x:Key="ToggleButtonBackgroundCheckedPressed" ResourceKey="ToggleButtonBackgroundPressed"/>
<StaticResource x:Key="ToggleButtonBorderBrushCheckedPressed" ResourceKey="ToggleButtonBorderBrushPressed"/>
<StaticResource x:Key="ToggleButtonForegroundCheckedPressed" ResourceKey="ToggleButtonForegroundPressed"/>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast"/>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</ToggleButton.Resources>
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
FontSize="9"
Glyph="{x:Bind local:EquationInputArea.GetChevronIcon(SliderSettingsVisible), Mode=OneWay}"/>
</Button>
</ToggleButton>
</StackPanel>
</Border>
</Grid>

View File

@ -484,7 +484,7 @@ void EquationInputArea::EquationTextBox_EquationFormatRequested(Object ^ sender,
void EquationInputArea::VariableAreaClicked(Object ^ sender, RoutedEventArgs ^ e)
{
ToggleVariableArea(static_cast<VariableViewModel ^>(static_cast<Button ^>(sender)->DataContext));
ToggleVariableArea(static_cast<VariableViewModel ^>(static_cast<ToggleButton ^>(sender)->DataContext));
}
void EquationInputArea::ToggleVariableArea(VariableViewModel ^ selectedVariableViewModel)