Update color picker (#668)
This commit is contained in:
@@ -46,8 +46,28 @@
|
||||
FallbackColor="{ThemeResource SystemChromeMediumColor}"
|
||||
TintColor="{ThemeResource SystemChromeLowColor}"
|
||||
TintOpacity="0.7"/>
|
||||
<SolidColorBrush x:Key="EquationTextBoxTransparentBackgroundBrush" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemControlBackgroundAltMediumBrush}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemBaseHighColor}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxBorderBrush" Color="{ThemeResource TextControlBackground}"/>
|
||||
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="Transparent"/>
|
||||
|
||||
<SolidColorBrush x:Key="EquationBrush1" Color="#FF0078D7"/>
|
||||
<SolidColorBrush x:Key="EquationBrush2" Color="#FFFFB900"/>
|
||||
<SolidColorBrush x:Key="EquationBrush3" Color="#FFFF8C00"/>
|
||||
<SolidColorBrush x:Key="EquationBrush4" Color="#FFF7630C"/>
|
||||
<SolidColorBrush x:Key="EquationBrush5" Color="#FFCA5010"/>
|
||||
<SolidColorBrush x:Key="EquationBrush6" Color="#FFE3008C"/>
|
||||
<SolidColorBrush x:Key="EquationBrush7" Color="#FFBF0077"/>
|
||||
<SolidColorBrush x:Key="EquationBrush8" Color="#FFC239B3"/>
|
||||
<SolidColorBrush x:Key="EquationBrush9" Color="#FF0063B1"/>
|
||||
<SolidColorBrush x:Key="EquationBrush10" Color="#FF2D7D9A"/>
|
||||
<SolidColorBrush x:Key="EquationBrush11" Color="#FF00B7C3"/>
|
||||
<SolidColorBrush x:Key="EquationBrush12" Color="#FF00CC6A"/>
|
||||
<SolidColorBrush x:Key="EquationBrush13" Color="#FF00B294"/>
|
||||
<SolidColorBrush x:Key="EquationBrush14" Color="#FF018574"/>
|
||||
<SolidColorBrush x:Key="EquationBrush15" Color="#FF10893E"/>
|
||||
<SolidColorBrush x:Key="EquationBrush16" Color="#FF000000"/>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Thickness x:Key="HighContrastThicknessTop">0,0,0,0</Thickness>
|
||||
@@ -85,6 +105,25 @@
|
||||
TintOpacity="0.7"/>
|
||||
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemControlBackgroundAltMediumBrush}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemBaseHighColor}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxBorderBrush" Color="{ThemeResource TextControlBackground}"/>
|
||||
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="Transparent"/>
|
||||
|
||||
<SolidColorBrush x:Key="EquationBrush1" Color="#FF0078D7"/>
|
||||
<SolidColorBrush x:Key="EquationBrush2" Color="#FFFFB900"/>
|
||||
<SolidColorBrush x:Key="EquationBrush3" Color="#FFFF8C00"/>
|
||||
<SolidColorBrush x:Key="EquationBrush4" Color="#FFF7630C"/>
|
||||
<SolidColorBrush x:Key="EquationBrush5" Color="#FFCA5010"/>
|
||||
<SolidColorBrush x:Key="EquationBrush6" Color="#FFE3008C"/>
|
||||
<SolidColorBrush x:Key="EquationBrush7" Color="#FFBF0077"/>
|
||||
<SolidColorBrush x:Key="EquationBrush8" Color="#FFC239B3"/>
|
||||
<SolidColorBrush x:Key="EquationBrush9" Color="#FF0063B1"/>
|
||||
<SolidColorBrush x:Key="EquationBrush10" Color="#FF2D7D9A"/>
|
||||
<SolidColorBrush x:Key="EquationBrush11" Color="#FF00B7C3"/>
|
||||
<SolidColorBrush x:Key="EquationBrush12" Color="#FF00CC6A"/>
|
||||
<SolidColorBrush x:Key="EquationBrush13" Color="#FF00B294"/>
|
||||
<SolidColorBrush x:Key="EquationBrush14" Color="#FF018574"/>
|
||||
<SolidColorBrush x:Key="EquationBrush15" Color="#FF10893E"/>
|
||||
<SolidColorBrush x:Key="EquationBrush16" Color="#FF000000"/>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<Thickness x:Key="HighContrastThicknessTop">0,1,0,0</Thickness>
|
||||
@@ -106,8 +145,28 @@
|
||||
<SolidColorBrush x:Key="AppControlBackgroundListAccentHighRevealBackgroundBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
||||
<SolidColorBrush x:Key="AppControlListLowRevealHighlightBrush" Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||
<SolidColorBrush x:Key="AppChromeAcrylicHostBackdropMediumLowBrush" Color="{ThemeResource SystemColorWindowColor}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxBorderBrush" Color="{ThemeResource SystemColorButtonTextColor}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxPointerOverBackgroundBrush" Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemColorCaptionTextColor}"/>
|
||||
<SolidColorBrush x:Key="EquationBoxHoverButtonForegroundBrush" Color="{ThemeResource SystemColorButtonTextColor}"/>
|
||||
<SolidColorBrush x:Key="AppControlTransparentButtonBackgroundBrush" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
||||
|
||||
<!-- TODO: Add high contrast colors mapping -->
|
||||
<SolidColorBrush x:Key="EquationBrush1" Color="#FFFF0000"/>
|
||||
<SolidColorBrush x:Key="EquationBrush2" Color="#FFFFB900"/>
|
||||
<SolidColorBrush x:Key="EquationBrush3" Color="#FFFF8C00"/>
|
||||
<SolidColorBrush x:Key="EquationBrush4" Color="#FFF7630C"/>
|
||||
<SolidColorBrush x:Key="EquationBrush5" Color="#FFCA5010"/>
|
||||
<SolidColorBrush x:Key="EquationBrush6" Color="#FFE3008C"/>
|
||||
<SolidColorBrush x:Key="EquationBrush7" Color="#FFBF0077"/>
|
||||
<SolidColorBrush x:Key="EquationBrush8" Color="#FFC239B3"/>
|
||||
<SolidColorBrush x:Key="EquationBrush9" Color="#FF0063B1"/>
|
||||
<SolidColorBrush x:Key="EquationBrush10" Color="#FF2D7D9A"/>
|
||||
<SolidColorBrush x:Key="EquationBrush11" Color="#FF00B7C3"/>
|
||||
<SolidColorBrush x:Key="EquationBrush12" Color="#FF00CC6A"/>
|
||||
<SolidColorBrush x:Key="EquationBrush13" Color="#FF00B294"/>
|
||||
<SolidColorBrush x:Key="EquationBrush14" Color="#FF018574"/>
|
||||
<SolidColorBrush x:Key="EquationBrush15" Color="#FF10893E"/>
|
||||
<SolidColorBrush x:Key="EquationBrush16" Color="#FF000000"/>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
@@ -1147,7 +1206,7 @@
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}"/>
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemChromeWhiteColor}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
@@ -1176,183 +1235,6 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Name="EquationTextBoxToggleButtonStyle" TargetType="ToggleButton">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="Transparent"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Grid x:Name="ButtonLayoutGrid"
|
||||
Background="Transparent"
|
||||
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal"/>
|
||||
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPointerOver}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonBorderBrushPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<DoubleAnimation Duration="0"
|
||||
Storyboard.TargetName="ButtonLayoutGrid"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Checked">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushChecked}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="ButtonLayoutGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="CheckedPointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedPointerOver}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="ButtonLayoutGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="CheckedPressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForegroundPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="ButtonLayoutGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="CheckedDisabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundCheckedDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundCheckedDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Indeterminate">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminate}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminate}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminate}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="ButtonLayoutGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="IndeterminatePointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminatePointerOver}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminatePointerOver}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminatePointerOver}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="ButtonLayoutGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="IndeterminatePressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminatePressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminatePressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminatePressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="ButtonLayoutGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="IndeterminateDisabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminateDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminateDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonLayoutGrid" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminateDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<TextBlock x:Name="GlyphElement"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource EquationBoxHoverButtonForegroundBrush}"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="12"
|
||||
FontStyle="Normal"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{TemplateBinding Content}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="EquationTextBoxStyle" TargetType="RichEditBox">
|
||||
<Setter Property="Foreground" Value="{ThemeResource TextControlForeground}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
@@ -1543,7 +1425,7 @@
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackground}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EquationBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}"/>
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource EquationBoxBorderBrush}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
@@ -1590,7 +1472,7 @@
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledBorderThemeBrush}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EquationTextBox" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
@@ -1641,7 +1523,7 @@
|
||||
<Border x:Name="EquationBoxBorder"
|
||||
Grid.Column="1"
|
||||
Background="{ThemeResource TextControlBackground}"
|
||||
BorderBrush="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding EquationColor}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
|
||||
<Grid>
|
||||
@@ -1664,7 +1546,7 @@
|
||||
InputScope="Text"
|
||||
MaxLength="2048"
|
||||
TextWrapping="NoWrap"/>
|
||||
<!-- TODO: Consider overwiting the hover color instead of hijacking the foreground/background property -->
|
||||
<!-- TODO: Use brush overrides here instead of a new style, use a new style for the EquationButton above once that has more functionality -->
|
||||
<Button x:Name="DeleteButton"
|
||||
Grid.Column="3"
|
||||
MinWidth="34"
|
||||
@@ -1673,7 +1555,7 @@
|
||||
Style="{StaticResource EquationTextBoxButtonStyle}"
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{TemplateBinding EquationColor}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderThickness="0"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
@@ -1688,7 +1570,7 @@
|
||||
Style="{StaticResource EquationTextBoxButtonStyle}"
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{TemplateBinding EquationColor}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderThickness="0"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
@@ -1700,16 +1582,26 @@
|
||||
MinWidth="34"
|
||||
Margin="{ThemeResource HelperButtonThemePadding}"
|
||||
VerticalAlignment="Stretch"
|
||||
Style="{StaticResource EquationTextBoxToggleButtonStyle}"
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{TemplateBinding EquationColor}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{ThemeResource AppControlTransparentButtonBackgroundBrush}"
|
||||
BorderThickness="0"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content=""
|
||||
IsTabStop="False"
|
||||
Visibility="Collapsed"/>
|
||||
Visibility="Collapsed">
|
||||
<ToggleButton.Resources>
|
||||
<SolidColorBrush x:Name="ToggleButtonBackgroundPointerOver" Color="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonBorderBrushPointerOver" Color="{ThemeResource AppControlTransparentButtonBackgroundBrush}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonForegroundPressed" Color="{ThemeResource SystemChromeWhiteColor}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonForegroundChecked" Color="{ThemeResource SystemChromeWhiteColor}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonForegroundPointerOver" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonBackgroundChecked" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonBackgroundCheckedPointerOver" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonBackgroundCheckedPressed" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
<SolidColorBrush x:Name="ToggleButtonBackgroundPressed" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
</ToggleButton.Resources>
|
||||
</ToggleButton>
|
||||
<Button x:Name="FunctionButton"
|
||||
Grid.Column="1"
|
||||
MinWidth="34"
|
||||
|
@@ -255,6 +255,9 @@
|
||||
<ClInclude Include="App.xaml.h">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EquationStylePanelControl.xaml.h">
|
||||
<DependentUpon>EquationStylePanelControl.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Views\Calculator.xaml.h">
|
||||
<DependentUpon>Views\Calculator.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
@@ -323,6 +326,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="AboutFlyout.xaml" />
|
||||
<Page Include="EquationStylePanelControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\Calculator.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -399,6 +405,9 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EquationStylePanelControl.xaml.cpp">
|
||||
<DependentUpon>EquationStylePanelControl.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Views\Calculator.xaml.cpp">
|
||||
<DependentUpon>Views\Calculator.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
|
@@ -467,6 +467,9 @@
|
||||
<Filter>Views\GraphingCalculator</Filter>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)DensityStyles\Compact.xaml" />
|
||||
<Page Include="EquationStylePanelControl.xaml">
|
||||
<Filter>Views\GraphingCalculator</Filter>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PRIResource Include="Resources\en-US\CEngineStrings.resw">
|
||||
|
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "pch.h"
|
||||
#include "EquationTextBox.h"
|
||||
#include "CalcViewModel/GraphingCalculator/EquationViewModel.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Platform;
|
||||
@@ -72,6 +71,8 @@ void EquationTextBox::OnApplyTemplate()
|
||||
ColorChooserFlyout->Opened += ref new EventHandler<Object ^>(this, &EquationTextBox::OnColorFlyoutOpened);
|
||||
ColorChooserFlyout->Closed += ref new EventHandler<Object ^>(this, &EquationTextBox::OnColorFlyoutClosed);
|
||||
}
|
||||
|
||||
UpdateCommonVisualState();
|
||||
}
|
||||
|
||||
void EquationTextBox::OnPointerEntered(PointerRoutedEventArgs ^ e)
|
||||
@@ -260,6 +261,5 @@ bool EquationTextBox::ShouldDeleteButtonBeVisible()
|
||||
{
|
||||
m_richEditBox->TextDocument->GetMath(&text);
|
||||
}
|
||||
|
||||
return (!text->IsEmpty() && m_isFocused);
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CalcViewModel/Common/Utils.h"
|
||||
#include "CalcViewModel/GraphingCalculator/EquationViewModel.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
|
91
src/Calculator/EquationStylePanelControl.xaml
Normal file
91
src/Calculator/EquationStylePanelControl.xaml
Normal file
@@ -0,0 +1,91 @@
|
||||
<UserControl x:Class="CalculatorApp.EquationStylePanelControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<GridView x:Name="ColorChooser"
|
||||
ItemsSource="{x:Bind AvailableColors}"
|
||||
Loaded="ColorChooserLoaded"
|
||||
SelectionChanged="SelectionChanged"
|
||||
SingleSelectionFollowsFocus="False">
|
||||
<GridView.ItemContainerStyle>
|
||||
<Style TargetType="GridViewItem">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="MinHeight" Value="52"/>
|
||||
<Setter Property="MinWidth" Value="52"/>
|
||||
<Setter Property="Height" Value="52"/>
|
||||
<Setter Property="Width" Value="52"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="GridViewItem">
|
||||
<Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal"/>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ItemContent.Margin" Value="-2,-2,-2,-2"/>
|
||||
<Setter Target="ItemBorder.Margin" Value="2,2,2,2"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ItemContent.Margin" Value="-2,-2,-2,-2"/>
|
||||
<Setter Target="ItemBorder.Stroke" Value="{ThemeResource InkToolbarFlyoutItemBorderPressedThemeBrush}"/>
|
||||
<Setter Target="ItemBorder.Margin" Value="2,2,2,2"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Selected">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ItemContent.Margin" Value="2,2,2,2"/>
|
||||
<Setter Target="ItemBorder.Stroke" Value="{ThemeResource InkToolbarFlyoutItemBorderSelectedThemeBrush}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="FocusStates">
|
||||
<VisualState x:Name="Focused"/>
|
||||
<VisualState x:Name="Unfocused"/>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<Ellipse x:Name="ItemBorder"
|
||||
Margin="6,6,6,6"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Fill="Transparent"
|
||||
Stroke="Transparent"
|
||||
StrokeThickness="2"
|
||||
UseLayoutRounding="false"/>
|
||||
<ContentPresenter x:Name="ItemContent" UseLayoutRounding="false"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</GridView.ItemContainerStyle>
|
||||
<GridView.Header>
|
||||
<TextBlock x:Uid="LineColorText" Margin="8,0,8,8"/>
|
||||
</GridView.Header>
|
||||
<GridView.ItemTemplate>
|
||||
<DataTemplate x:DataType="Brush">
|
||||
<Ellipse Margin="8,8,8,8"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Fill="{x:Bind}"
|
||||
StrokeThickness="0"
|
||||
UseLayoutRounding="false"/>
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
<GridView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<ItemsWrapGrid MaximumRowsOrColumns="7" Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</GridView.ItemsPanel>
|
||||
</GridView>
|
||||
</UserControl>
|
92
src/Calculator/EquationStylePanelControl.xaml.cpp
Normal file
92
src/Calculator/EquationStylePanelControl.xaml.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "EquationStylePanelControl.xaml.h"
|
||||
|
||||
using namespace CalculatorApp;
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Platform::Collections;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
using namespace Windows::UI::Xaml::Shapes;
|
||||
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(EquationStylePanelControl, SelectedColor);
|
||||
|
||||
EquationStylePanelControl::EquationStylePanelControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeAvailableColors();
|
||||
}
|
||||
|
||||
void EquationStylePanelControl::InitializeAvailableColors()
|
||||
{
|
||||
// TODO: Handle dynamically switching these to high contrast equivalents
|
||||
m_AvailableColors = ref new Vector<SolidColorBrush ^>();
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush1")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush2")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush3")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush4")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush5")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush6")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush7")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush8")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush9")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush10")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush11")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush12")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush13")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush14")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush15")));
|
||||
m_AvailableColors->Append(safe_cast<SolidColorBrush ^>(Application::Current->Resources->Lookup(L"EquationBrush16")));
|
||||
}
|
||||
|
||||
void EquationStylePanelControl::SelectionChanged(Object ^ /*sender */, SelectionChangedEventArgs ^ e)
|
||||
{
|
||||
if (e->AddedItems->Size > 0)
|
||||
{
|
||||
SelectedColor = static_cast<SolidColorBrush ^>(e->AddedItems->GetAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
void EquationStylePanelControl::OnSelectedColorPropertyChanged(SolidColorBrush ^ /*oldColor*/, SolidColorBrush ^ newColor)
|
||||
{
|
||||
SelectColor(newColor);
|
||||
}
|
||||
|
||||
void EquationStylePanelControl::ColorChooserLoaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
SelectColor(SelectedColor);
|
||||
}
|
||||
|
||||
void EquationStylePanelControl::SelectColor(SolidColorBrush ^ selectedColor)
|
||||
{
|
||||
for (auto item : ColorChooser->Items->GetView())
|
||||
{
|
||||
auto brush = static_cast<SolidColorBrush ^>(item);
|
||||
auto gridViewItem = dynamic_cast<GridViewItem ^>(ColorChooser->ContainerFromItem(brush));
|
||||
|
||||
if (!gridViewItem)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (brush->Color == selectedColor->Color)
|
||||
{
|
||||
gridViewItem->IsSelected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gridViewItem->IsSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
35
src/Calculator/EquationStylePanelControl.xaml.h
Normal file
35
src/Calculator/EquationStylePanelControl.xaml.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "EquationStylePanelControl.g.h"
|
||||
#include "CalcViewModel/Common/Utils.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden] public ref class EquationStylePanelControl sealed
|
||||
{
|
||||
public:
|
||||
EquationStylePanelControl();
|
||||
DEPENDENCY_PROPERTY_OWNER(EquationStylePanelControl);
|
||||
|
||||
DEPENDENCY_PROPERTY_WITH_CALLBACK(Windows::UI::Xaml::Media::SolidColorBrush ^, SelectedColor);
|
||||
|
||||
property Windows::Foundation::Collections::IVector<Windows::UI::Xaml::Media::SolidColorBrush^>^ AvailableColors
|
||||
{
|
||||
Windows::Foundation::Collections::IVector<Windows::UI::Xaml::Media::SolidColorBrush^>^ get() {
|
||||
return m_AvailableColors;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void InitializeAvailableColors();
|
||||
void SelectionChanged(Platform::Object ^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e);
|
||||
void OnSelectedColorPropertyChanged(Windows::UI::Xaml::Media::SolidColorBrush ^ oldValue, Windows::UI::Xaml::Media::SolidColorBrush ^ newValue);
|
||||
void ColorChooserLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void SelectColor(Windows::UI::Xaml::Media::SolidColorBrush ^ selectedColor);
|
||||
|
||||
Windows::Foundation::Collections::IVector<Windows::UI::Xaml::Media::SolidColorBrush ^>^ m_AvailableColors;
|
||||
};
|
||||
}
|
@@ -3527,4 +3527,8 @@
|
||||
<value>Max</value>
|
||||
<comment>Label text for the max text box</comment>
|
||||
</data>
|
||||
<data name="LineColorText.Text" xml:space="preserve">
|
||||
<value>Line Color</value>
|
||||
<comment>Label for the Line Color section of the style picker</comment>
|
||||
</data>
|
||||
</root>
|
||||
|
@@ -3,80 +3,59 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CalculatorApp.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:CalculatorApp.ViewModel"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListView x:Name="EquationInputList"
|
||||
VerticalContentAlignment="Top"
|
||||
IsItemClickEnabled="False"
|
||||
ItemsSource="{x:Bind Equations}"
|
||||
SelectionMode="None">
|
||||
|
||||
<ListView x:Name="EquationInputList"
|
||||
Grid.Row="0"
|
||||
Margin="0,8,0,0"
|
||||
IsItemClickEnabled="False"
|
||||
ItemsSource="{x:Bind Equations}"
|
||||
SelectionMode="None">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0,0,0,2"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0,0,0,2"/>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:EquationViewModel">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.Resources>
|
||||
<SolidColorBrush x:Key="LineColorBrush" Color="{x:Bind LineColor, Mode=OneWay}"/>
|
||||
</Grid.Resources>
|
||||
|
||||
<controls:EquationTextBox x:Uid="EquationInputButton"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,3,0"
|
||||
Style="{StaticResource EquationTextBoxStyle}"
|
||||
EquationSubmitted="InputTextBox_Submitted"
|
||||
GotFocus="InputTextBox_GotFocus"
|
||||
LostFocus="InputTextBox_LostFocus"
|
||||
RemoveButtonClicked="EquationTextBox_RemoveButtonClicked">
|
||||
<controls:EquationTextBox.EquationColor>
|
||||
<SolidColorBrush x:Name="EquationLineColor" Color="{x:Bind LineColor, Mode=OneWay}"/>
|
||||
</controls:EquationTextBox.EquationColor>
|
||||
<controls:EquationTextBox.KeyGraphFeaturesContent>
|
||||
<StackPanel x:Name="KeyGraphFeaturesGrid" Visibility="{x:Bind KeyGraphFeaturesVisibility, Mode=OneWay}">
|
||||
<TextBlock Text="Key Graph Features"/>
|
||||
<TextBlock Text="{x:Bind Expression, Mode=OneWay}"/>
|
||||
</StackPanel>
|
||||
</controls:EquationTextBox.KeyGraphFeaturesContent>
|
||||
<controls:EquationTextBox.ColorChooserFlyout>
|
||||
<Flyout x:Name="ColorChooserFlyout"
|
||||
x:Uid="ColorChooserFlyout"
|
||||
Placement="Bottom">
|
||||
<StackPanel>
|
||||
<ColorPicker x:Name="EquationColorPicker" Color="{x:Bind LineColor, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</controls:EquationTextBox.ColorChooserFlyout>
|
||||
</controls:EquationTextBox>
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
<Button Grid.Row="1"
|
||||
Margin="4"
|
||||
Click="AddEquationButton_Click"
|
||||
Content="+"/>
|
||||
</Grid>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:EquationViewModel">
|
||||
<controls:EquationTextBox x:Uid="EquationInputButton"
|
||||
Margin="0,0,3,0"
|
||||
Style="{StaticResource EquationTextBoxStyle}"
|
||||
EquationColor="{x:Bind LineColor, Mode=OneWay}"
|
||||
EquationSubmitted="InputTextBox_Submitted"
|
||||
GotFocus="InputTextBox_GotFocus"
|
||||
Loaded="EquationTextBoxLoaded"
|
||||
LostFocus="InputTextBox_LostFocus"
|
||||
RemoveButtonClicked="EquationTextBox_RemoveButtonClicked">
|
||||
<controls:EquationTextBox.KeyGraphFeaturesContent>
|
||||
<StackPanel x:Name="KeyGraphFeaturesGrid" Visibility="{x:Bind KeyGraphFeaturesVisibility, Mode=OneWay}">
|
||||
<TextBlock Text="Key Graph Features"/>
|
||||
<TextBlock Text="{x:Bind Expression, Mode=OneWay}"/>
|
||||
</StackPanel>
|
||||
</controls:EquationTextBox.KeyGraphFeaturesContent>
|
||||
<controls:EquationTextBox.ColorChooserFlyout>
|
||||
<Flyout x:Name="ColorChooserFlyout"
|
||||
x:Uid="ColorChooserFlyout"
|
||||
Placement="Bottom">
|
||||
<local:EquationStylePanelControl SelectedColor="{x:Bind LineColor, Mode=TwoWay}"/>
|
||||
</Flyout>
|
||||
</controls:EquationTextBox.ColorChooserFlyout>
|
||||
</controls:EquationTextBox>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
<ListView.Footer>
|
||||
<Button Margin="4"
|
||||
Click="AddEquationButton_Click"
|
||||
Content="+"/>
|
||||
</ListView.Footer>
|
||||
</ListView>
|
||||
</UserControl>
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#include "pch.h"
|
||||
#include "EquationInputArea.xaml.h"
|
||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
||||
#include "Controls/EquationTextBox.h"
|
||||
|
||||
using namespace CalculatorApp;
|
||||
using namespace CalculatorApp::Common;
|
||||
@@ -13,25 +11,14 @@ using namespace Windows::System;
|
||||
using namespace Windows::UI;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace GraphControl;
|
||||
|
||||
namespace
|
||||
{
|
||||
const Color accentColor = (ref new UISettings())->GetColorValue(UIColorType::Accent);
|
||||
const Color lineColors[] = {
|
||||
accentColor,
|
||||
Colors::DarkOrange,
|
||||
Colors::MediumPurple,
|
||||
Colors::ForestGreen,
|
||||
Colors::BlueViolet,
|
||||
Colors::DarkRed,
|
||||
Colors::LightGoldenrodYellow,
|
||||
Colors::DarkOliveGreen
|
||||
};
|
||||
const size_t lineColorsSize = std::size(lineColors);
|
||||
|
||||
StringReference EquationsPropertyName(L"Equations");
|
||||
}
|
||||
|
||||
@@ -65,8 +52,6 @@ void EquationInputArea::AddEquationButton_Click(Object^ sender, RoutedEventArgs^
|
||||
void EquationInputArea::AddNewEquation()
|
||||
{
|
||||
auto eq = ref new EquationViewModel();
|
||||
eq->LineColor = GetNextLineColor();
|
||||
|
||||
Equations->Append(eq);
|
||||
}
|
||||
|
||||
@@ -85,15 +70,9 @@ void EquationInputArea::InputTextBox_Submitted(Object ^ sender, RoutedEventArgs
|
||||
auto tb = static_cast<EquationTextBox^>(sender);
|
||||
auto eq = static_cast<EquationViewModel^>(tb->DataContext);
|
||||
eq->Expression = tb->GetEquationText();
|
||||
FocusManager::TryMoveFocus(::FocusNavigationDirection::Left);
|
||||
}
|
||||
|
||||
Color EquationInputArea::GetNextLineColor()
|
||||
{
|
||||
m_lastLineColorIndex = (m_lastLineColorIndex + 1) % lineColorsSize;
|
||||
return lineColors[m_lastLineColorIndex];
|
||||
}
|
||||
|
||||
|
||||
void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object^ sender, RoutedEventArgs^ e)
|
||||
{
|
||||
auto tb = static_cast<EquationTextBox^>(sender);
|
||||
@@ -104,3 +83,15 @@ void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object^ sender, Rout
|
||||
Equations->RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
void EquationInputArea::EquationTextBoxLoaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||
auto eq = static_cast<EquationViewModel ^>(tb->DataContext);
|
||||
|
||||
auto colorChooser = static_cast<EquationStylePanelControl ^>(tb->ColorChooserFlyout->Content);
|
||||
|
||||
m_lastLineColorIndex = (m_lastLineColorIndex + 1) % colorChooser->AvailableColors->Size;
|
||||
|
||||
eq->LineColor = colorChooser->AvailableColors->GetAt(m_lastLineColorIndex);
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@
|
||||
#include "Views/GraphingCalculator/EquationInputArea.g.h"
|
||||
#include "CalcViewModel/Common/Utils.h"
|
||||
#include "CalcViewModel/GraphingCalculator/EquationViewModel.h"
|
||||
#include "EquationStylePanelControl.xaml.h"
|
||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
||||
#include "Controls/EquationTextBox.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
@@ -25,10 +28,9 @@ namespace CalculatorApp
|
||||
void InputTextBox_LostFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void InputTextBox_Submitted(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
Windows::UI::Color GetNextLineColor();
|
||||
|
||||
private:
|
||||
int m_lastLineColorIndex;
|
||||
void EquationTextBox_RemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void EquationTextBoxLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
@@ -365,18 +365,23 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="5*"/>
|
||||
<RowDefinition Height="3*"/>
|
||||
<RowDefinition Height="3*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button x:Name="Share" Click="OnShareClick">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph=""/>
|
||||
</Button>
|
||||
<local:EquationInputArea Grid.Row="0" Equations="{x:Bind ViewModel.Equations}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<local:EquationInputArea Grid.Row="1"
|
||||
Margin="0,8,0,0"
|
||||
Equations="{x:Bind ViewModel.Equations}"/>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="ButtonContainerGrid"
|
||||
Grid.Row="2"
|
||||
Grid.Row="1"
|
||||
Margin="3,0,3,3"
|
||||
UseLayoutRounding="False">
|
||||
<Grid.RowDefinitions>
|
||||
|
@@ -92,7 +92,7 @@ void GraphingCalculator::OnDataRequested(DataTransferManager^ sender, DataReques
|
||||
for (unsigned i = 0; i < equations->Size; i++)
|
||||
{
|
||||
auto expression = equations->GetAt(i)->Expression->Data();
|
||||
auto color = equations->GetAt(i)->LineColor;
|
||||
auto color = equations->GetAt(i)->LineColor->Color;
|
||||
|
||||
if (equations->GetAt(i)->Expression->Length() == 0)
|
||||
{
|
||||
@@ -204,11 +204,11 @@ void GraphingCalculator::SubmitTextbox(TextBox^ sender)
|
||||
}
|
||||
else if (sender->Name == "MaxTextBox")
|
||||
{
|
||||
variableViewModel->Step = validateDouble(sender->Text, variableViewModel->Step);
|
||||
variableViewModel->Max = validateDouble(sender->Text, variableViewModel->Max);
|
||||
}
|
||||
else if (sender->Name == "StepTextBox")
|
||||
{
|
||||
variableViewModel->Max = validateDouble(sender->Text, variableViewModel->Max);
|
||||
variableViewModel->Step = validateDouble(sender->Text, variableViewModel->Step);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user