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="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition MinHeight="44"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
<VisualState x:Name="Normal">
|
<VisualState x:Name="Normal">
|
||||||
@ -1917,17 +1912,13 @@
|
|||||||
<Setter Target="ColorChooserButton.Visibility" Value="Visible"/>
|
<Setter Target="ColorChooserButton.Visibility" Value="Visible"/>
|
||||||
<Setter Target="FunctionButton.Visibility" Value="Visible"/>
|
<Setter Target="FunctionButton.Visibility" Value="Visible"/>
|
||||||
<Setter Target="RemoveButton.Visibility" Value="Visible"/>
|
<Setter Target="RemoveButton.Visibility" Value="Visible"/>
|
||||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="PointerOverError">
|
<VisualState x:Name="PointerOverError">
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
||||||
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource EquationBoxErrorBackgroundBrush}"/>
|
<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="RemoveButton.Visibility" Value="Visible"/>
|
||||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="Disabled">
|
<VisualState x:Name="Disabled">
|
||||||
@ -1947,7 +1938,6 @@
|
|||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
||||||
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
|
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
|
||||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
@ -1974,18 +1964,15 @@
|
|||||||
Background="{TemplateBinding EquationColor}"
|
Background="{TemplateBinding EquationColor}"
|
||||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||||
BorderBrush="{TemplateBinding EquationColor}">
|
BorderBrush="{TemplateBinding EquationColor}">
|
||||||
<ToggleButton.Content>
|
<StackPanel x:Name="FunctionNumberLabel"
|
||||||
<StackPanel x:Name="FunctionNumberLabel"
|
HorizontalAlignment="Center"
|
||||||
HorizontalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
Orientation="Horizontal">
|
||||||
Background="Transparent"
|
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}" Glyph=""/>
|
||||||
Orientation="Horizontal">
|
<TextBlock Margin="-5,19,0,0"
|
||||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}" Glyph=""/>
|
FontSize="11"
|
||||||
<TextBlock Margin="-5,19,0,0"
|
Text="{TemplateBinding EquationButtonContentIndex}"/>
|
||||||
FontSize="11"
|
</StackPanel>
|
||||||
Text="{TemplateBinding EquationButtonContentIndex}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</ToggleButton.Content>
|
|
||||||
<ToggleButton.Resources>
|
<ToggleButton.Resources>
|
||||||
<SolidColorBrush x:Name="ButtonBackgroundBrush" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
<SolidColorBrush x:Name="ButtonBackgroundBrush" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||||
<SolidColorBrush x:Name="ButtonBorderBrush" 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 Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ToggleButton">
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
<Grid x:Name="RootGrid"
|
<Grid x:Name="RootGrid">
|
||||||
Background="Transparent"
|
|
||||||
BorderBrush="Transparent">
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
<VisualState x:Name="Normal">
|
<VisualState x:Name="Normal">
|
||||||
@ -2005,8 +1990,6 @@
|
|||||||
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonBackgroundBrush}"/>
|
<Setter Target="RootGrid.Background" Value="{ThemeResource ButtonBackgroundBrush}"/>
|
||||||
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
|
<Setter Target="RootGrid.BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
|
||||||
<Setter Target="Overlay.Opacity" Value="0.0"/>
|
<Setter Target="Overlay.Opacity" Value="0.0"/>
|
||||||
<Setter Target="ContentPresenter.Visibility" Value="Visible"/>
|
|
||||||
<Setter Target="ShowHideIcon.Visibility" Value="Collapsed"/>
|
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="PointerOver">
|
<VisualState x:Name="PointerOver">
|
||||||
|
@ -35,7 +35,6 @@ EquationTextBox::EquationTextBox()
|
|||||||
void EquationTextBox::OnApplyTemplate()
|
void EquationTextBox::OnApplyTemplate()
|
||||||
{
|
{
|
||||||
m_equationButton = dynamic_cast<ToggleButton ^>(GetTemplateChild("EquationButton"));
|
m_equationButton = dynamic_cast<ToggleButton ^>(GetTemplateChild("EquationButton"));
|
||||||
m_kgfEquationButton = dynamic_cast<Button ^>(GetTemplateChild("KGFEquationButton"));
|
|
||||||
m_richEditBox = dynamic_cast<MathRichEditBox ^>(GetTemplateChild("MathRichEditBox"));
|
m_richEditBox = dynamic_cast<MathRichEditBox ^>(GetTemplateChild("MathRichEditBox"));
|
||||||
m_deleteButton = dynamic_cast<Button ^>(GetTemplateChild("DeleteButton"));
|
m_deleteButton = dynamic_cast<Button ^>(GetTemplateChild("DeleteButton"));
|
||||||
m_removeButton = dynamic_cast<Button ^>(GetTemplateChild("RemoveButton"));
|
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);
|
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)
|
if (m_deleteButton != nullptr)
|
||||||
{
|
{
|
||||||
m_deleteButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnDeleteButtonClicked);
|
m_deleteButton->Click += ref new RoutedEventHandler(this, &EquationTextBox::OnDeleteButtonClicked);
|
||||||
@ -208,11 +202,6 @@ void EquationTextBox::OnEquationButtonClicked(Object ^ sender, RoutedEventArgs ^
|
|||||||
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
|
AutomationProperties::SetName(m_equationButton, equationButtonMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EquationTextBox::OnKGFEquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
|
||||||
{
|
|
||||||
EquationButtonClicked(this, ref new RoutedEventArgs());
|
|
||||||
}
|
|
||||||
|
|
||||||
void EquationTextBox::OnRemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
void EquationTextBox::OnRemoveButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
if (IsAddEquationMode)
|
if (IsAddEquationMode)
|
||||||
@ -350,7 +339,7 @@ bool EquationTextBox::RichEditHasContent()
|
|||||||
{
|
{
|
||||||
text = m_richEditBox->MathText;
|
text = m_richEditBox->MathText;
|
||||||
}
|
}
|
||||||
return (!text->IsEmpty() && m_HasFocus);
|
return !text->IsEmpty() && m_HasFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EquationTextBox::OnRichEditMenuOpening(Object ^ /*sender*/, Object ^ /*args*/)
|
void EquationTextBox::OnRichEditMenuOpening(Object ^ /*sender*/, Object ^ /*args*/)
|
||||||
|
@ -54,7 +54,6 @@ namespace CalculatorApp
|
|||||||
|
|
||||||
void OnDeleteButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
void OnDeleteButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void OnEquationButtonClicked(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 OnRemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void OnColorChooserButtonClicked(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);
|
void OnFunctionButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
@ -67,7 +66,6 @@ namespace CalculatorApp
|
|||||||
|
|
||||||
CalculatorApp::Controls::MathRichEditBox ^ m_richEditBox;
|
CalculatorApp::Controls::MathRichEditBox ^ m_richEditBox;
|
||||||
Windows::UI::Xaml::Controls::Primitives::ToggleButton ^ m_equationButton;
|
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_deleteButton;
|
||||||
Windows::UI::Xaml::Controls::Button ^ m_removeButton;
|
Windows::UI::Xaml::Controls::Button ^ m_removeButton;
|
||||||
Windows::UI::Xaml::Controls::Button ^ m_functionButton;
|
Windows::UI::Xaml::Controls::Button ^ m_functionButton;
|
||||||
|
@ -403,7 +403,7 @@
|
|||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Visibility="{Binding IsDateDiffMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
Visibility="{Binding IsDateDiffMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="1*" MaxHeight="17"/>
|
<RowDefinition Height="1*" MaxHeight="17"/>
|
||||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||||
<RowDefinition Height="1*" MaxHeight="24"/>
|
<RowDefinition Height="1*" MaxHeight="24"/>
|
||||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||||
|
@ -232,17 +232,17 @@
|
|||||||
Margin="1,0,1,2"
|
Margin="1,0,1,2"
|
||||||
Style="{StaticResource EquationTextBoxStyle}"
|
Style="{StaticResource EquationTextBoxStyle}"
|
||||||
DataContext="{x:Bind Mode=OneWay}"
|
DataContext="{x:Bind Mode=OneWay}"
|
||||||
DataContextChanged="InputTextBox_DataContextChanged"
|
DataContextChanged="EquationTextBox_DataContextChanged"
|
||||||
EquationButtonClicked="EquationTextBox_EquationButtonClicked"
|
EquationButtonClicked="EquationTextBox_EquationButtonClicked"
|
||||||
EquationButtonContentIndex="{x:Bind FunctionLabelIndex, Mode=OneWay}"
|
EquationButtonContentIndex="{x:Bind FunctionLabelIndex, Mode=OneWay}"
|
||||||
EquationColor="{x:Bind local:EquationInputArea.ToSolidColorBrush(LineColor), Mode=OneWay}"
|
EquationColor="{x:Bind local:EquationInputArea.ToSolidColorBrush(LineColor), Mode=OneWay}"
|
||||||
EquationSubmitted="InputTextBox_Submitted"
|
EquationSubmitted="EquationTextBox_Submitted"
|
||||||
GotFocus="InputTextBox_GotFocus"
|
GotFocus="EquationTextBox_GotFocus"
|
||||||
HasError="{x:Bind GraphEquation.HasGraphError, Mode=OneWay}"
|
HasError="{x:Bind GraphEquation.HasGraphError, Mode=OneWay}"
|
||||||
IsAddEquationMode="{x:Bind IsLastItemInList, Mode=OneWay}"
|
IsAddEquationMode="{x:Bind IsLastItemInList, Mode=OneWay}"
|
||||||
KeyGraphFeaturesButtonClicked="EquationTextBox_KeyGraphFeaturesButtonClicked"
|
KeyGraphFeaturesButtonClicked="EquationTextBox_KeyGraphFeaturesButtonClicked"
|
||||||
Loaded="InputTextBox_Loaded"
|
Loaded="EquationTextBox_Loaded"
|
||||||
LostFocus="InputTextBox_LostFocus"
|
LostFocus="EquationTextBox_LostFocus"
|
||||||
MathEquation="{x:Bind Expression, Mode=TwoWay}"
|
MathEquation="{x:Bind Expression, Mode=TwoWay}"
|
||||||
RemoveButtonClicked="EquationTextBox_RemoveButtonClicked">
|
RemoveButtonClicked="EquationTextBox_RemoveButtonClicked">
|
||||||
<controls:EquationTextBox.ColorChooserFlyout>
|
<controls:EquationTextBox.ColorChooserFlyout>
|
||||||
|
@ -74,17 +74,17 @@ void EquationInputArea::AddNewEquation()
|
|||||||
Equations->Append(eq);
|
Equations->Append(eq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EquationInputArea::InputTextBox_GotFocus(Object ^ sender, RoutedEventArgs ^ e)
|
void EquationInputArea::EquationTextBox_GotFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
KeyboardShortcutManager::HonorShortcuts(false);
|
KeyboardShortcutManager::HonorShortcuts(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EquationInputArea::InputTextBox_LostFocus(Object ^ sender, RoutedEventArgs ^ e)
|
void EquationInputArea::EquationTextBox_LostFocus(Object ^ sender, RoutedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
KeyboardShortcutManager::HonorShortcuts(true);
|
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);
|
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||||
if (tb == nullptr)
|
if (tb == nullptr)
|
||||||
@ -187,7 +187,7 @@ void EquationInputArea::EquationTextBox_EquationButtonClicked(Object ^ sender, R
|
|||||||
eq->IsLineEnabled = !eq->IsLineEnabled;
|
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);
|
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);
|
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||||
if (!tb->IsLoaded)
|
if (!tb->IsLoaded)
|
||||||
|
@ -38,9 +38,9 @@ namespace CalculatorApp
|
|||||||
|
|
||||||
void AddNewEquation();
|
void AddNewEquation();
|
||||||
|
|
||||||
void InputTextBox_GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
void EquationTextBox_GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void InputTextBox_LostFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
void EquationTextBox_LostFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void InputTextBox_Submitted(Platform::Object ^ sender, CalculatorApp::Controls::MathRichEditBoxSubmission ^ e);
|
void EquationTextBox_Submitted(Platform::Object ^ sender, CalculatorApp::Controls::MathRichEditBoxSubmission ^ e);
|
||||||
|
|
||||||
void OnHighContrastChanged(Windows::UI::ViewManagement::AccessibilitySettings ^ sender, Platform::Object ^ args);
|
void OnHighContrastChanged(Windows::UI::ViewManagement::AccessibilitySettings ^ sender, Platform::Object ^ args);
|
||||||
void ReloadAvailableColors(bool isHighContrast);
|
void ReloadAvailableColors(bool isHighContrast);
|
||||||
@ -49,8 +49,8 @@ namespace CalculatorApp
|
|||||||
void EquationTextBox_RemoveButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
void EquationTextBox_RemoveButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
|
||||||
void EquationTextBox_KeyGraphFeaturesButtonClicked(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 EquationTextBox_EquationButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
void InputTextBox_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
void EquationTextBox_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
void InputTextBox_DataContextChanged(Windows::UI::Xaml::FrameworkElement ^ sender, Windows::UI::Xaml::DataContextChangedEventArgs ^ args);
|
void EquationTextBox_DataContextChanged(Windows::UI::Xaml::FrameworkElement ^ sender, Windows::UI::Xaml::DataContextChangedEventArgs ^ args);
|
||||||
void FocusEquationIfNecessary(_In_ CalculatorApp::Controls::EquationTextBox ^ textBox);
|
void FocusEquationIfNecessary(_In_ CalculatorApp::Controls::EquationTextBox ^ textBox);
|
||||||
|
|
||||||
double validateDouble(Platform::String ^ value, double defaultValue);
|
double validateDouble(Platform::String ^ value, double defaultValue);
|
||||||
|
@ -10,171 +10,32 @@
|
|||||||
xmlns:vm="using:CalculatorApp.ViewModel"
|
xmlns:vm="using:CalculatorApp.ViewModel"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<Style x:Key="KGF_EquationTextBoxStyle" TargetType="controls:EquationTextBox">
|
<ResourceDictionary>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
<Setter Property="BorderThickness" Value="0"/>
|
<ResourceDictionary x:Key="Default">
|
||||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
|
<!-- Can't be #ffffff due to a bug in RichEditBox considering it as the default value -->
|
||||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
|
<!-- and replacing it by the system value (#000000) when dark theme is used -->
|
||||||
<Setter Property="FontWeight" Value="Normal"/>
|
<SolidColorBrush x:Key="TitleMathRichEditBoxForegroundBrush" Color="#feffff"/>
|
||||||
<Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}"/>
|
</ResourceDictionary>
|
||||||
<Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}"/>
|
<ResourceDictionary x:Key="Light">
|
||||||
<Setter Property="IsTabStop" Value="False"/>
|
<SolidColorBrush x:Key="TitleMathRichEditBoxForegroundBrush" Color="Black"/>
|
||||||
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
</ResourceDictionary>
|
||||||
<Setter Property="Template">
|
<ResourceDictionary x:Key="HighContrast">
|
||||||
<Setter.Value>
|
<SolidColorBrush x:Key="TitleMathRichEditBoxForegroundBrush" Color="{ThemeResource SystemColorWindowTextColor}"/>
|
||||||
<ControlTemplate TargetType="controls:EquationTextBox">
|
</ResourceDictionary>
|
||||||
<Grid Background="{ThemeResource TextControlBackground}">
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
<Style x:Key="KGF_RichEditBoxStyle" TargetType="controls:MathRichEditBox">
|
||||||
<Grid.ColumnDefinitions>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<Setter Property="IsReadOnly" Value="True"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<Setter Property="UseSystemFocusVisuals" Value="True"/>
|
||||||
</Grid.ColumnDefinitions>
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
<Grid.RowDefinitions>
|
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
||||||
<RowDefinition MinHeight="44"/>
|
<Setter Property="Padding" Value="0"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<Setter Property="Template">
|
||||||
</Grid.RowDefinitions>
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="controls:MathRichEditBox">
|
||||||
<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>
|
|
||||||
|
|
||||||
<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="Typography.StylisticSet20" Value="True"/>
|
|
||||||
<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}"/>
|
|
||||||
<ScrollViewer x:Name="ContentElement"
|
<ScrollViewer x:Name="ContentElement"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="{TemplateBinding BorderThickness}"
|
Margin="{TemplateBinding BorderThickness}"
|
||||||
@ -190,154 +51,146 @@
|
|||||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||||
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
||||||
ZoomMode="Disabled"/>
|
ZoomMode="Disabled"/>
|
||||||
<TextBlock x:Name="PlaceholderTextContentPresenter"
|
</ControlTemplate>
|
||||||
Grid.Row="1"
|
</Setter.Value>
|
||||||
Margin="{TemplateBinding BorderThickness}"
|
</Setter>
|
||||||
Padding="{TemplateBinding Padding}"
|
</Style>
|
||||||
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>
|
<Style x:Name="KGF_TitleTextBlockStyle" TargetType="TextBlock">
|
||||||
</Setter.Value>
|
<Setter Property="FontWeight" Value="Medium"/>
|
||||||
</Setter>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
</Style>
|
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
||||||
|
<Setter Property="AutomationProperties.HeadingLevel" Value="Level2"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style x:Name="KGF_TitleTextBlockStyle" TargetType="TextBlock">
|
<Style x:Name="KGF_TextBlockStyle" TargetType="TextBlock">
|
||||||
<Setter Property="FontWeight" Value="Medium"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="IsTextSelectionEnabled" Value="True"/>
|
||||||
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
</Style>
|
||||||
<Setter Property="AutomationProperties.HeadingLevel" Value="Level2"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style x:Name="KGF_TextBlockStyle" TargetType="TextBlock">
|
<Style x:Name="KGF_ListViewItemContainerStyle" TargetType="ListViewItem">
|
||||||
<Setter Property="FontWeight" Value="Normal"/>
|
<Setter Property="IsTabStop" Value="False"/>
|
||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||||
<Setter Property="IsTextSelectionEnabled" Value="True"/>
|
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>
|
||||||
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
<Setter Property="Padding" Value="0,10"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Name="KGF_ListViewItemContainerStyle" TargetType="ListViewItem">
|
<DataTemplate x:Key="KGFRichEditDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
||||||
<Setter Property="IsTabStop" Value="False"/>
|
<StackPanel>
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
<TextBlock x:Name="TitleTextBlock"
|
||||||
<Setter Property="Padding" Value="0"/>
|
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
Text="{x:Bind Title, Mode=OneWay}"/>
|
||||||
<Setter Property="Width" Value="Auto"/>
|
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
||||||
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw"/>
|
<ItemsControl.ItemTemplate>
|
||||||
<Setter Property="Margin" Value="0,10"/>
|
<DataTemplate x:DataType="x:String">
|
||||||
</Style>
|
<controls:MathRichEditBox Style="{StaticResource KGF_RichEditBoxStyle}" MathText="{x:Bind}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate x:Key="KGFRichEditDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
<DataTemplate x:Key="KGFGridDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock x:Name="TitleTextBlock"
|
<TextBlock x:Name="TitleTextBlock"
|
||||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||||
Text="{x:Bind Title, Mode=OneWay}"/>
|
Text="{x:Bind Title, Mode=OneWay}"/>
|
||||||
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
<ItemsControl ItemsSource="{x:Bind GridItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
||||||
<ItemsControl.ItemContainerStyle>
|
<ItemsControl.ItemTemplate>
|
||||||
<Style TargetType="ContentPresenter">
|
<DataTemplate x:DataType="vm:GridDisplayItems">
|
||||||
<Setter Property="Margin" Value="0"/>
|
<Grid VerticalAlignment="Center">
|
||||||
</Style>
|
<Grid.ColumnDefinitions>
|
||||||
</ItemsControl.ItemContainerStyle>
|
<ColumnDefinition Width="Auto" MinWidth="64"/>
|
||||||
<ItemsControl.ItemTemplate>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<DataTemplate x:DataType="x:String">
|
</Grid.ColumnDefinitions>
|
||||||
<controls:MathRichEditBox HorizontalAlignment="Left"
|
<controls:MathRichEditBox Style="{StaticResource KGF_RichEditBoxStyle}" MathText="{x:Bind Expression}"/>
|
||||||
HorizontalContentAlignment="Left"
|
<TextBlock Grid.Column="1"
|
||||||
Style="{StaticResource KGF_RichEditBoxStyle}"
|
Margin="0,-2,0,0"
|
||||||
MathText="{x:Bind}"/>
|
HorizontalAlignment="Left"
|
||||||
</DataTemplate>
|
VerticalAlignment="Center"
|
||||||
</ItemsControl.ItemTemplate>
|
Style="{StaticResource KGF_TextBlockStyle}"
|
||||||
</ItemsControl>
|
Text="{x:Bind Direction}"/>
|
||||||
</StackPanel>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate x:Key="KGFGridDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
<DataTemplate x:Key="KGFTextBlockDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock x:Name="TitleTextBlock"
|
<TextBlock x:Name="TitleTextBlock"
|
||||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||||
Text="{x:Bind Title, Mode=OneWay}"/>
|
Text="{x:Bind Title, Mode=OneWay}"/>
|
||||||
<ItemsControl ItemsSource="{x:Bind GridItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate x:DataType="vm:GridDisplayItems">
|
<DataTemplate x:DataType="x:String">
|
||||||
<Grid VerticalAlignment="Center">
|
<TextBlock Style="{StaticResource KGF_TextBlockStyle}" Text="{x:Bind}"/>
|
||||||
<Grid.ColumnDefinitions>
|
</DataTemplate>
|
||||||
<ColumnDefinition Width="Auto" MinWidth="64"/>
|
</ItemsControl.ItemTemplate>
|
||||||
<ColumnDefinition Width="Auto"/>
|
</ItemsControl>
|
||||||
</Grid.ColumnDefinitions>
|
</StackPanel>
|
||||||
<controls:MathRichEditBox Grid.Column="0"
|
</DataTemplate>
|
||||||
MinWidth="25"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Style="{StaticResource KGF_RichEditBoxStyle}"
|
|
||||||
MathText="{x:Bind Expression}"/>
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Style="{StaticResource KGF_TextBlockStyle}"
|
|
||||||
Text="{x:Bind Direction}"/>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
|
|
||||||
<DataTemplate x:Key="KGFTextBlockDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
<ts:KeyGraphFeaturesTemplateSelector x:Key="KGFTemplateSelector"
|
||||||
<StackPanel>
|
GridTemplate="{StaticResource KGFGridDataTemplate}"
|
||||||
<TextBlock x:Name="TitleTextBlock"
|
RichEditTemplate="{StaticResource KGFRichEditDataTemplate}"
|
||||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
TextBlockTemplate="{StaticResource KGFTextBlockDataTemplate}"/>
|
||||||
Text="{x:Bind Title, Mode=OneWay}"/>
|
|
||||||
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="x:String">
|
|
||||||
<TextBlock Style="{StaticResource KGF_TextBlockStyle}" Text="{x:Bind}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
|
|
||||||
<ts:KeyGraphFeaturesTemplateSelector x:Key="KGFTemplateSelector"
|
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
||||||
GridTemplate="{StaticResource KGFGridDataTemplate}"
|
|
||||||
RichEditTemplate="{StaticResource KGFRichEditDataTemplate}"
|
|
||||||
TextBlockTemplate="{StaticResource KGFTextBlockDataTemplate}"/>
|
|
||||||
|
|
||||||
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
<SolidColorBrush x:Key="TextControlBackgroundPointerOver" Color="Transparent"/>
|
||||||
|
<SolidColorBrush x:Key="TextControlBackgroundFocused" Color="Transparent"/>
|
||||||
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<Grid Background="Transparent">
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<controls:EquationTextBox x:Name="EquationInputTextBox"
|
<Grid>
|
||||||
x:Uid="EquationInputButton"
|
<Grid.ColumnDefinitions>
|
||||||
Grid.Row="0"
|
<ColumnDefinition Width="Auto"/>
|
||||||
Margin="0,0,3,0"
|
<ColumnDefinition Width="*"/>
|
||||||
Style="{StaticResource KGF_EquationTextBoxStyle}"
|
</Grid.ColumnDefinitions>
|
||||||
Background="Transparent"
|
<Button x:Name="BackButton"
|
||||||
BorderThickness="0"
|
x:Uid="equationAnalysisBack"
|
||||||
DataContext="{x:Bind ViewModel, Mode=OneWay}"
|
MinWidth="44"
|
||||||
EquationButtonClicked="EquationButtonClicked"
|
VerticalAlignment="Stretch"
|
||||||
EquationButtonContentIndex="{x:Bind ViewModel.FunctionLabelIndex, Mode=OneWay}"
|
Style="{StaticResource ButtonRevealStyle}"
|
||||||
Loaded="EquationInputTextBox_Loaded">
|
Background="{x:Bind local:KeyGraphFeaturesPanel.ToSolidColorBrush(ViewModel.LineColor), Mode=OneWay}"
|
||||||
<controls:EquationTextBox.EquationColor>
|
Foreground="{ThemeResource SystemChromeWhiteColor}"
|
||||||
<SolidColorBrush Color="{x:Bind ViewModel.LineColor, Mode=OneWay}"/>
|
Click="BackButton_Click">
|
||||||
</controls:EquationTextBox.EquationColor>
|
<StackPanel Margin="5,0"
|
||||||
</controls:EquationTextBox>
|
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"
|
<TextBlock x:Uid="KeyGraphFeaturesLabel"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="12,20,10,0"
|
Margin="12,12,10,0"
|
||||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
AutomationProperties.HeadingLevel="Level1"/>
|
AutomationProperties.HeadingLevel="Level1"/>
|
||||||
@ -360,6 +213,7 @@
|
|||||||
FontWeight="Normal"
|
FontWeight="Normal"
|
||||||
IsTextSelectionEnabled="False"
|
IsTextSelectionEnabled="False"
|
||||||
Text="{x:Bind ViewModel.AnalysisErrorString, Mode=OneWay}"
|
Text="{x:Bind ViewModel.AnalysisErrorString, Mode=OneWay}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Mode=OneWay}"/>
|
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Mode=OneWay}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -16,22 +16,15 @@ using namespace Windows::UI::Xaml::Controls;
|
|||||||
KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()
|
KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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());
|
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();
|
KeyGraphFeaturesPanel();
|
||||||
|
|
||||||
OBSERVABLE_OBJECT();
|
OBSERVABLE_OBJECT();
|
||||||
|
OBSERVABLE_PROPERTY_RW(CalculatorApp::ViewModel::EquationViewModel ^, ViewModel);
|
||||||
|
|
||||||
public:
|
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;
|
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:
|
private:
|
||||||
void EquationButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
void KeyGraphFeaturesPanel_Loaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
void SetEquationTextBoxProperties();
|
void BackButton_Click(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
void EquationInputTextBox_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CalculatorApp::ViewModel::EquationViewModel ^ m_viewModel;
|
CalculatorApp::ViewModel::EquationViewModel ^ m_viewModel;
|
||||||
|
Loading…
Reference in New Issue
Block a user