Remove EquationTextBox from KeyGraphFeaturesPanel (#833)
* remove EquationBox from KFG * polish * improve templates * fix issue with dark theme and MathRichEditBox
This commit is contained in:
parent
fe599e31f8
commit
dc79ec65f6
@ -1885,11 +1885,6 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition MinHeight="44"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
@ -1917,17 +1912,13 @@
|
||||
<Setter Target="ColorChooserButton.Visibility" Value="Visible"/>
|
||||
<Setter Target="FunctionButton.Visibility" Value="Visible"/>
|
||||
<Setter Target="RemoveButton.Visibility" Value="Visible"/>
|
||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOverError">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
||||
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource EquationBoxErrorBackgroundBrush}"/>
|
||||
<Setter Target="ColorChooserButton.Visibility" Value="Collapsed"/>
|
||||
<Setter Target="FunctionButton.Visibility" Value="Collapsed"/>
|
||||
<Setter Target="RemoveButton.Visibility" Value="Visible"/>
|
||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
@ -1947,7 +1938,6 @@
|
||||
<VisualState.Setters>
|
||||
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
||||
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
|
||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@ -1974,18 +1964,15 @@
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||
BorderBrush="{TemplateBinding EquationColor}">
|
||||
<ToggleButton.Content>
|
||||
<StackPanel x:Name="FunctionNumberLabel"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
Orientation="Horizontal">
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}" Glyph=""/>
|
||||
<TextBlock Margin="-5,19,0,0"
|
||||
FontSize="11"
|
||||
Text="{TemplateBinding EquationButtonContentIndex}"/>
|
||||
</StackPanel>
|
||||
</ToggleButton.Content>
|
||||
<ToggleButton.Resources>
|
||||
<SolidColorBrush x:Name="ButtonBackgroundBrush" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
<SolidColorBrush x:Name="ButtonBorderBrush" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
@ -1995,9 +1982,7 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Grid x:Name="RootGrid"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent">
|
||||
<Grid x:Name="RootGrid">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
@ -2005,8 +1990,6 @@
|
||||
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonBackgroundBrush}"/>
|
||||
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
|
||||
<Setter Target="Overlay.Opacity" Value="0.0"/>
|
||||
<Setter Target="ContentPresenter.Visibility" Value="Visible"/>
|
||||
<Setter Target="ShowHideIcon.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
|
@ -35,7 +35,6 @@ EquationTextBox::EquationTextBox()
|
||||
void EquationTextBox::OnApplyTemplate()
|
||||
{
|
||||
m_equationButton = dynamic_cast<ToggleButton ^>(GetTemplateChild("EquationButton"));
|
||||
m_kgfEquationButton = dynamic_cast<Button ^>(GetTemplateChild("KGFEquationButton"));
|
||||
m_richEditBox = dynamic_cast<MathRichEditBox ^>(GetTemplateChild("MathRichEditBox"));
|
||||
m_deleteButton = dynamic_cast<Button ^>(GetTemplateChild("DeleteButton"));
|
||||
m_removeButton = dynamic_cast<Button ^>(GetTemplateChild("RemoveButton"));
|
||||
@ -74,11 +73,6 @@ void EquationTextBox::OnApplyTemplate()
|
||||
m_richEditContextMenu->Opening += ref new EventHandler<Platform::Object ^>(this, &EquationTextBox::OnRichEditMenuOpening);
|
||||
}
|
||||
|
||||
if (m_kgfEquationButton != nullptr)
|
||||
{
|
||||
m_kgfEquationButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnKGFEquationButtonClicked);
|
||||
}
|
||||
|
||||
if (m_deleteButton != nullptr)
|
||||
{
|
||||
m_deleteButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnDeleteButtonClicked);
|
||||
@ -208,11 +202,6 @@ void EquationTextBox::OnEquationButtonClicked(Object ^ sender, RoutedEventArgs ^
|
||||
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
|
||||
}
|
||||
|
||||
void EquationTextBox::OnKGFEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
EquationButtonClicked(this, ref new RoutedEventArgs());
|
||||
}
|
||||
|
||||
void EquationTextBox::OnRemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
if (IsAddEquationMode)
|
||||
@ -350,7 +339,7 @@ bool EquationTextBox::RichEditHasContent()
|
||||
{
|
||||
text = m_richEditBox->MathText;
|
||||
}
|
||||
return (!text->IsEmpty() && m_HasFocus);
|
||||
return !text->IsEmpty() && m_HasFocus;
|
||||
}
|
||||
|
||||
void EquationTextBox::OnRichEditMenuOpening(Object ^ /*sender*/, Object ^ /*args*/)
|
||||
|
@ -54,7 +54,6 @@ namespace CalculatorApp
|
||||
|
||||
void OnDeleteButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnEquationButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnKGFEquationButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnRemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnColorChooserButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void OnFunctionButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
@ -67,7 +66,6 @@ namespace CalculatorApp
|
||||
|
||||
CalculatorApp::Controls::MathRichEditBox ^ m_richEditBox;
|
||||
Windows::UI::Xaml::Controls::Primitives::ToggleButton ^ m_equationButton;
|
||||
Windows::UI::Xaml::Controls::Button ^ m_kgfEquationButton;
|
||||
Windows::UI::Xaml::Controls::Button ^ m_deleteButton;
|
||||
Windows::UI::Xaml::Controls::Button ^ m_removeButton;
|
||||
Windows::UI::Xaml::Controls::Button ^ m_functionButton;
|
||||
|
@ -232,17 +232,17 @@
|
||||
Margin="1,0,1,2"
|
||||
Style="{StaticResource EquationTextBoxStyle}"
|
||||
DataContext="{x:Bind Mode=OneWay}"
|
||||
DataContextChanged="InputTextBox_DataContextChanged"
|
||||
DataContextChanged="EquationTextBox_DataContextChanged"
|
||||
EquationButtonClicked="EquationTextBox_EquationButtonClicked"
|
||||
EquationButtonContentIndex="{x:Bind FunctionLabelIndex, Mode=OneWay}"
|
||||
EquationColor="{x:Bind local:EquationInputArea.ToSolidColorBrush(LineColor), Mode=OneWay}"
|
||||
EquationSubmitted="InputTextBox_Submitted"
|
||||
GotFocus="InputTextBox_GotFocus"
|
||||
EquationSubmitted="EquationTextBox_Submitted"
|
||||
GotFocus="EquationTextBox_GotFocus"
|
||||
HasError="{x:Bind GraphEquation.HasGraphError, Mode=OneWay}"
|
||||
IsAddEquationMode="{x:Bind IsLastItemInList, Mode=OneWay}"
|
||||
KeyGraphFeaturesButtonClicked="EquationTextBox_KeyGraphFeaturesButtonClicked"
|
||||
Loaded="InputTextBox_Loaded"
|
||||
LostFocus="InputTextBox_LostFocus"
|
||||
Loaded="EquationTextBox_Loaded"
|
||||
LostFocus="EquationTextBox_LostFocus"
|
||||
MathEquation="{x:Bind Expression, Mode=TwoWay}"
|
||||
RemoveButtonClicked="EquationTextBox_RemoveButtonClicked">
|
||||
<controls:EquationTextBox.ColorChooserFlyout>
|
||||
|
@ -74,17 +74,17 @@ void EquationInputArea::AddNewEquation()
|
||||
Equations->Append(eq);
|
||||
}
|
||||
|
||||
void EquationInputArea::InputTextBox_GotFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||
void EquationInputArea::EquationTextBox_GotFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
KeyboardShortcutManager::HonorShortcuts(false);
|
||||
}
|
||||
|
||||
void EquationInputArea::InputTextBox_LostFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||
void EquationInputArea::EquationTextBox_LostFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
KeyboardShortcutManager::HonorShortcuts(true);
|
||||
}
|
||||
|
||||
void EquationInputArea::InputTextBox_Submitted(Object ^ sender, MathRichEditBoxSubmission ^ submission)
|
||||
void EquationInputArea::EquationTextBox_Submitted(Object ^ sender, MathRichEditBoxSubmission ^ submission)
|
||||
{
|
||||
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||
if (tb == nullptr)
|
||||
@ -187,7 +187,7 @@ void EquationInputArea::EquationTextBox_EquationButtonClicked(Object ^ sender, R
|
||||
eq->IsLineEnabled = !eq->IsLineEnabled;
|
||||
}
|
||||
|
||||
void EquationInputArea::InputTextBox_Loaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
void EquationInputArea::EquationTextBox_Loaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||
|
||||
@ -212,7 +212,7 @@ void EquationInputArea::InputTextBox_Loaded(Object ^ sender, RoutedEventArgs ^ e
|
||||
}
|
||||
}
|
||||
|
||||
void EquationInputArea::InputTextBox_DataContextChanged(Windows::UI::Xaml::FrameworkElement ^ sender, Windows::UI::Xaml::DataContextChangedEventArgs ^ args)
|
||||
void EquationInputArea::EquationTextBox_DataContextChanged(Windows::UI::Xaml::FrameworkElement ^ sender, Windows::UI::Xaml::DataContextChangedEventArgs ^ args)
|
||||
{
|
||||
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||
if (!tb->IsLoaded)
|
||||
|
@ -38,9 +38,9 @@ namespace CalculatorApp
|
||||
|
||||
void AddNewEquation();
|
||||
|
||||
void InputTextBox_GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void InputTextBox_LostFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void InputTextBox_Submitted(Platform::Object ^ sender, CalculatorApp::Controls::MathRichEditBoxSubmission ^ e);
|
||||
void EquationTextBox_GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void EquationTextBox_LostFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void EquationTextBox_Submitted(Platform::Object ^ sender, CalculatorApp::Controls::MathRichEditBoxSubmission ^ e);
|
||||
|
||||
void OnHighContrastChanged(Windows::UI::ViewManagement::AccessibilitySettings ^ sender, Platform::Object ^ args);
|
||||
void ReloadAvailableColors(bool isHighContrast);
|
||||
@ -49,8 +49,8 @@ namespace CalculatorApp
|
||||
void EquationTextBox_RemoveButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||
void EquationTextBox_KeyGraphFeaturesButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void EquationTextBox_EquationButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void InputTextBox_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void InputTextBox_DataContextChanged(Windows::UI::Xaml::FrameworkElement ^ sender, Windows::UI::Xaml::DataContextChangedEventArgs ^ args);
|
||||
void EquationTextBox_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void EquationTextBox_DataContextChanged(Windows::UI::Xaml::FrameworkElement ^ sender, Windows::UI::Xaml::DataContextChangedEventArgs ^ args);
|
||||
void FocusEquationIfNecessary(_In_ CalculatorApp::Controls::EquationTextBox ^ textBox);
|
||||
|
||||
double validateDouble(Platform::String ^ value, double defaultValue);
|
||||
|
@ -10,171 +10,32 @@
|
||||
xmlns:vm="using:CalculatorApp.ViewModel"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="KGF_EquationTextBoxStyle" TargetType="controls:EquationTextBox">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
|
||||
<Setter Property="FontWeight" Value="Normal"/>
|
||||
<Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}"/>
|
||||
<Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}"/>
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:EquationTextBox">
|
||||
<Grid Background="{ThemeResource TextControlBackground}">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition MinHeight="44"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button x:Name="KGFEquationButton"
|
||||
x:Uid="equationAnalysisBack"
|
||||
MinWidth="44"
|
||||
MinHeight="44"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||
BorderThickness="0">
|
||||
<Button.Content>
|
||||
<StackPanel x:Name="FunctionNumberLabel"
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
Orientation="Horizontal">
|
||||
<FontIcon Margin="0,0,6,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Glyph=""/>
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}" Glyph=""/>
|
||||
<TextBlock Margin="-5,19,0,0"
|
||||
FontSize="11"
|
||||
Text="{TemplateBinding EquationButtonContentIndex}"/>
|
||||
</StackPanel>
|
||||
|
||||
</Button.Content>
|
||||
<Button.Resources>
|
||||
<SolidColorBrush x:Name="ButtonBackgroundPointerOver"
|
||||
Opacity="0.7"
|
||||
Color="{TemplateBinding EquationColor}"/>
|
||||
<SolidColorBrush x:Name="ButtonForegroundPointerOver" Color="{ThemeResource SystemChromeWhiteColor}"/>
|
||||
<SolidColorBrush x:Name="ButtonBorderBrushPointerOver" Color="Transparent"/>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
|
||||
<controls:MathRichEditBox x:Name="MathRichEditBox"
|
||||
Grid.Column="1"
|
||||
MinHeight="44"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Stretch"
|
||||
Style="{StaticResource MathRichEditBoxStyle}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
AcceptsReturn="false"
|
||||
InputScope="Text"
|
||||
IsReadOnly="True"
|
||||
MaxLength="2048"
|
||||
TextWrapping="NoWrap"
|
||||
UseSystemFocusVisuals="True"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Default">
|
||||
<!-- Can't be #ffffff due to a bug in RichEditBox considering it as the default value -->
|
||||
<!-- and replacing it by the system value (#000000) when dark theme is used -->
|
||||
<SolidColorBrush x:Key="TitleMathRichEditBoxForegroundBrush" Color="#feffff"/>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<SolidColorBrush x:Key="TitleMathRichEditBoxForegroundBrush" Color="Black"/>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<SolidColorBrush x:Key="TitleMathRichEditBoxForegroundBrush" Color="{ThemeResource SystemColorWindowTextColor}"/>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
<Style x:Key="KGF_RichEditBoxStyle" TargetType="controls:MathRichEditBox">
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="IsReadOnly" Value="True"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="IsEnabled" Value="True"/>
|
||||
<Setter Property="Padding" Value="0,3,4,0"/>
|
||||
<Setter Property="UseSystemFocusVisuals" Value="True"/>
|
||||
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
|
||||
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
|
||||
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RichEditBox">
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Disabled">
|
||||
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForeground}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrush}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForeground}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Normal"/>
|
||||
<VisualState x:Name="PointerOver"/>
|
||||
<VisualState x:Name="Focused"/>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<ContentPresenter x:Name="HeaderContentPresenter"
|
||||
Grid.Row="0"
|
||||
Margin="{ThemeResource RichEditBoxTopHeaderMargin}"
|
||||
Foreground="{ThemeResource TextControlHeaderForeground}"
|
||||
FontWeight="Normal"
|
||||
x:DeferLoadStrategy="Lazy"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="Collapsed"/>
|
||||
<Border x:Name="BorderElement"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="1"
|
||||
MinWidth="0"
|
||||
MinHeight="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"/>
|
||||
<ControlTemplate TargetType="controls:MathRichEditBox">
|
||||
<ScrollViewer x:Name="ContentElement"
|
||||
Grid.Row="1"
|
||||
Margin="{TemplateBinding BorderThickness}"
|
||||
@ -190,39 +51,20 @@
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
||||
ZoomMode="Disabled"/>
|
||||
<TextBlock x:Name="PlaceholderTextContentPresenter"
|
||||
Grid.Row="1"
|
||||
Margin="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Foreground="{ThemeResource TextControlPlaceholderForeground}"
|
||||
IsHitTestVisible="False"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}"/>
|
||||
<ContentPresenter x:Name="DescriptionPresenter"
|
||||
Grid.Row="2"
|
||||
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{TemplateBinding Description}"
|
||||
x:Load="False"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<Style x:Name="KGF_TitleTextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontWeight" Value="Medium"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
<Setter Property="AutomationProperties.HeadingLevel" Value="Level2"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Name="KGF_TextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontWeight" Value="Normal"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="IsTextSelectionEnabled" Value="True"/>
|
||||
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
||||
@ -231,11 +73,8 @@
|
||||
<Style x:Name="KGF_ListViewItemContainerStyle" TargetType="ListViewItem">
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>
|
||||
<Setter Property="Margin" Value="0,10"/>
|
||||
<Setter Property="Padding" Value="0,10"/>
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="KGFRichEditDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
||||
@ -244,17 +83,9 @@
|
||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||
Text="{x:Bind Title, Mode=OneWay}"/>
|
||||
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<controls:MathRichEditBox HorizontalAlignment="Left"
|
||||
HorizontalContentAlignment="Left"
|
||||
Style="{StaticResource KGF_RichEditBoxStyle}"
|
||||
MathText="{x:Bind}"/>
|
||||
<controls:MathRichEditBox Style="{StaticResource KGF_RichEditBoxStyle}" MathText="{x:Bind}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
@ -274,12 +105,9 @@
|
||||
<ColumnDefinition Width="Auto" MinWidth="64"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:MathRichEditBox Grid.Column="0"
|
||||
MinWidth="25"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource KGF_RichEditBoxStyle}"
|
||||
MathText="{x:Bind Expression}"/>
|
||||
<controls:MathRichEditBox Style="{StaticResource KGF_RichEditBoxStyle}" MathText="{x:Bind Expression}"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Margin="0,-2,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource KGF_TextBlockStyle}"
|
||||
@ -312,32 +140,57 @@
|
||||
TextBlockTemplate="{StaticResource KGFTextBlockDataTemplate}"/>
|
||||
|
||||
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
||||
|
||||
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="Transparent"/>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Background="Transparent">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<controls:EquationTextBox x:Name="EquationInputTextBox"
|
||||
x:Uid="EquationInputButton"
|
||||
Grid.Row="0"
|
||||
Margin="0,0,3,0"
|
||||
Style="{StaticResource KGF_EquationTextBoxStyle}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
DataContext="{x:Bind ViewModel, Mode=OneWay}"
|
||||
EquationButtonClicked="EquationButtonClicked"
|
||||
EquationButtonContentIndex="{x:Bind ViewModel.FunctionLabelIndex, Mode=OneWay}"
|
||||
Loaded="EquationInputTextBox_Loaded">
|
||||
<controls:EquationTextBox.EquationColor>
|
||||
<SolidColorBrush Color="{x:Bind ViewModel.LineColor, Mode=OneWay}"/>
|
||||
</controls:EquationTextBox.EquationColor>
|
||||
</controls:EquationTextBox>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="BackButton"
|
||||
x:Uid="equationAnalysisBack"
|
||||
MinWidth="44"
|
||||
VerticalAlignment="Stretch"
|
||||
Style="{StaticResource ButtonRevealStyle}"
|
||||
Background="{x:Bind local:KeyGraphFeaturesPanel.ToSolidColorBrush(ViewModel.LineColor), Mode=OneWay}"
|
||||
Foreground="{ThemeResource SystemChromeWhiteColor}"
|
||||
Click="BackButton_Click">
|
||||
<StackPanel Margin="5,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<FontIcon Margin="0,0,6,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Glyph=""/>
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}" Glyph=""/>
|
||||
<TextBlock Margin="-5,19,0,0"
|
||||
FontSize="11"
|
||||
Text="{x:Bind ViewModel.FunctionLabelIndex}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<controls:MathRichEditBox Grid.Column="1"
|
||||
Padding="10,0,6,0"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Center"
|
||||
Style="{StaticResource KGF_RichEditBoxStyle}"
|
||||
Foreground="{ThemeResource TitleMathRichEditBoxForegroundBrush}"
|
||||
MathText="{x:Bind ViewModel.Expression, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
<TextBlock x:Uid="KeyGraphFeaturesLabel"
|
||||
Grid.Row="1"
|
||||
Margin="12,20,10,0"
|
||||
Margin="12,12,10,0"
|
||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||
FontSize="18"
|
||||
AutomationProperties.HeadingLevel="Level1"/>
|
||||
@ -360,6 +213,7 @@
|
||||
FontWeight="Normal"
|
||||
IsTextSelectionEnabled="False"
|
||||
Text="{x:Bind ViewModel.AnalysisErrorString, Mode=OneWay}"
|
||||
TextWrapping="Wrap"
|
||||
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
@ -16,22 +16,15 @@ using namespace Windows::UI::Xaml::Controls;
|
||||
KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
this->Loaded += ref new RoutedEventHandler(this, &KeyGraphFeaturesPanel::KeyGraphFeaturesPanel_Loaded);
|
||||
}
|
||||
|
||||
void KeyGraphFeaturesPanel::EquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||
void KeyGraphFeaturesPanel::KeyGraphFeaturesPanel_Loaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||
{
|
||||
BackButton->Focus(::FocusState::Programmatic);
|
||||
}
|
||||
|
||||
void KeyGraphFeaturesPanel::BackButton_Click(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
KeyGraphFeaturesClosed(this, ref new RoutedEventArgs());
|
||||
}
|
||||
|
||||
void KeyGraphFeaturesPanel::EquationInputTextBox_Loaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
if (ViewModel != nullptr)
|
||||
{
|
||||
SetEquationTextBoxProperties();
|
||||
}
|
||||
}
|
||||
|
||||
void KeyGraphFeaturesPanel::SetEquationTextBoxProperties()
|
||||
{
|
||||
EquationInputTextBox->SetEquationText(ViewModel->Expression);
|
||||
}
|
||||
|
@ -18,31 +18,16 @@ public
|
||||
KeyGraphFeaturesPanel();
|
||||
|
||||
OBSERVABLE_OBJECT();
|
||||
OBSERVABLE_PROPERTY_RW(CalculatorApp::ViewModel::EquationViewModel ^, ViewModel);
|
||||
|
||||
public:
|
||||
property CalculatorApp::ViewModel::EquationViewModel ^ ViewModel
|
||||
{
|
||||
CalculatorApp::ViewModel::EquationViewModel ^ get()
|
||||
{
|
||||
return m_viewModel;
|
||||
}
|
||||
void set(CalculatorApp::ViewModel::EquationViewModel ^ value)
|
||||
{
|
||||
m_viewModel = value;
|
||||
RaisePropertyChanged(L"EquationViewModel");
|
||||
if (value != nullptr)
|
||||
{
|
||||
SetEquationTextBoxProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesClosed;
|
||||
|
||||
static Windows::UI::Xaml::Media::SolidColorBrush
|
||||
^ ToSolidColorBrush(Windows::UI::Color color) { return ref new Windows::UI::Xaml::Media::SolidColorBrush(color); }
|
||||
private:
|
||||
void EquationButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void SetEquationTextBoxProperties();
|
||||
void EquationInputTextBox_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void KeyGraphFeaturesPanel_Loaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void BackButton_Click(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
private:
|
||||
CalculatorApp::ViewModel::EquationViewModel ^ m_viewModel;
|
||||
|
Loading…
Reference in New Issue
Block a user