Key graph features (#704)
* Added IGraphAnalyzer * Key Graph Features called and getting returned to the client. To do put all strings into the Equation object * Updated UpdateKeyGraphFeatures to add function analysis data to all properties in Equation object * Update KGF when variables are updated * Key graph features ui started * Added MathRichEditBox and started hooking up key graph features to the UI * Updated EquationViewModel to include parity and periodicity * Updated key graph features to update the EquationViewModel * updated key graph features to display more values * Key graph features populating uing MathRichEdit mode * moved KeyGraphFeatures control to GraphingCalculator.xaml * Use MathML formatting instead of MathRichEdit for strings passed back from the engine * cleaned up project targeting and equation.h comments * Updated equation edit box to populate for KeyGraphFeatures * Fixed vcxproj files to have the correct targeting and certificates. KGF Title strings moved to x:Uid instead of the code behind * Updated per PR feedback * Update MathRichEditBox to detect if the string is a mathml string and use the appropriate set method to set the text * fixed the issue where parity, periodicity and monotonicity could be set with an old value if the next one is empty * KGF control UI adjustments and error handling * Error control updates * Error handling added when analysis fails * fixed alignment on rich edit boxes * Add monotonicity direction into the mathml string and only have 1 richeditbox * Set hover state on KGF EquationEditBox to change button opacity and fixed spacing in Monotonicity RichEditBox * remove sideload package certificate info VS added * updated logic for setting error strings to be in the viewmodel * Updated KeyGraphFeatures to populate dynamically using a ListView and TemplateSelector * Update periodicity to not show if it isn't supported * Fixed issue where y-intercept was using the x-intercept value * Remove ItemsControl ItemsContainerStyle * Updated per pr feedback. Fixed bug where analysis error would not reset * Update MathRichEdit box to remove selection when focus is lost * Updated mathrichedit to get LAF access for Dev, Release and Graphing projects * Remove OnLostFocus in MathRichEdit, Change KGF ItemsControl back to ListView * Clean up styles for KGF and ensure the match the comps * Moved formatoptions logic to the Grapher constructor and reverted LineColor.Text resource that was mistakenly taken out * Add copyright header to KGF Files * fixed issue where asymptote values were not populating * Disable KGF button when there is no equation. Fixed issue where equation populated in a new equationtextbox after the previous one was deleted * Removed formatoptions testing lines used for debugging
This commit is contained in:
@@ -111,26 +111,42 @@
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundDisabled" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonForeground" Color="#99000000"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="{ThemeResource SystemAccentColor}" Opacity="0.8"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="{ThemeResource SystemAccentColor}" Opacity="1.0"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
|
||||
Opacity="0.8"
|
||||
Color="{ThemeResource SystemAccentColor}"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPressed"
|
||||
Opacity="1.0"
|
||||
Color="{ThemeResource SystemAccentColor}"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundDisabled" Color="#33000000"/>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundDisabled" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonForeground" Color="{ThemeResource SystemColorWindowTextColor}" Opacity="0.6"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}" Opacity="0.8"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="{ThemeResource SystemColorHighlightColor}" Opacity="1.0"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundDisabled" Color="{ThemeResource SystemColorGrayTextColor}" Opacity="0.2"/>
|
||||
<SolidColorBrush x:Key="ButtonForeground"
|
||||
Opacity="0.6"
|
||||
Color="{ThemeResource SystemColorWindowTextColor}"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
|
||||
Opacity="0.8"
|
||||
Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPressed"
|
||||
Opacity="1.0"
|
||||
Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundDisabled"
|
||||
Opacity="0.2"
|
||||
Color="{ThemeResource SystemColorGrayTextColor}"/>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundDisabled" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="ButtonForeground" Color="#99FFFFFF"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPointerOver" Color="{ThemeResource SystemAccentColorLight1}" Opacity="0.8"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPressed" Color="{ThemeResource SystemAccentColorLight1}" Opacity="1.0"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
|
||||
Opacity="0.8"
|
||||
Color="{ThemeResource SystemAccentColorLight1}"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundPressed"
|
||||
Opacity="1.0"
|
||||
Color="{ThemeResource SystemAccentColorLight1}"/>
|
||||
<SolidColorBrush x:Key="ButtonForegroundDisabled" Color="#33FFFFFF"/>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
@@ -149,41 +165,39 @@
|
||||
Style="{StaticResource ResultsScrollerSnapped}"
|
||||
AutomationProperties.AccessibilityView="Control">
|
||||
<TextBlock x:Name="EditableToken"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{Binding DisplayValue, Mode=OneWay}"
|
||||
Grid.Row="2"
|
||||
Margin="4,0,4,0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Stretch"
|
||||
FontWeight="SemiBold"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Right"/>
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{Binding DisplayValue, Mode=OneWay}"/>
|
||||
</ScrollViewer>
|
||||
<Border Background="{ThemeResource AppChromeAcrylicHostBackdropMediumLowBrush}"
|
||||
Grid.Column="0">
|
||||
<Border Grid.Column="0" Background="{ThemeResource AppChromeAcrylicHostBackdropMediumLowBrush}">
|
||||
<Button x:Name="ScrollLeft"
|
||||
x:Uid="scrollLeft"
|
||||
Margin="0,3,0,0"
|
||||
Style="{StaticResource AlwaysOnTopScrollButtonStyleS}"
|
||||
MinWidth="{TemplateBinding ColumnWidth}"
|
||||
MinHeight="{TemplateBinding ColumnHeight}"
|
||||
Background="Transparent">
|
||||
x:Uid="scrollLeft"
|
||||
MinWidth="{TemplateBinding ColumnWidth}"
|
||||
MinHeight="{TemplateBinding ColumnHeight}"
|
||||
Margin="0,3,0,0"
|
||||
Style="{StaticResource AlwaysOnTopScrollButtonStyleS}"
|
||||
Background="Transparent">
|
||||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="{TemplateBinding ScrollButtonFontSize}"
|
||||
Glyph=""/>
|
||||
FontSize="{TemplateBinding ScrollButtonFontSize}"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
</Border>
|
||||
<Border Background="{ThemeResource AppChromeAcrylicHostBackdropMediumLowBrush}"
|
||||
Grid.Column="2">
|
||||
<Border Grid.Column="2" Background="{ThemeResource AppChromeAcrylicHostBackdropMediumLowBrush}">
|
||||
<Button x:Name="ScrollRight"
|
||||
x:Uid="scrollRight"
|
||||
Margin="0,3,0,0"
|
||||
Style="{StaticResource AlwaysOnTopScrollButtonStyleS}"
|
||||
MinWidth="{TemplateBinding ColumnWidth}"
|
||||
MinHeight="{TemplateBinding ColumnHeight}"
|
||||
Background="Transparent">
|
||||
x:Uid="scrollRight"
|
||||
MinWidth="{TemplateBinding ColumnWidth}"
|
||||
MinHeight="{TemplateBinding ColumnHeight}"
|
||||
Margin="0,3,0,0"
|
||||
Style="{StaticResource AlwaysOnTopScrollButtonStyleS}"
|
||||
Background="Transparent">
|
||||
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="{TemplateBinding ScrollButtonFontSize}"
|
||||
Glyph=""/>
|
||||
FontSize="{TemplateBinding ScrollButtonFontSize}"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -192,7 +206,9 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="AlwaysOnTopStyleM" BasedOn="{StaticResource AlwaysOnTopStyleS}" TargetType="controls:OverflowTextBlock">
|
||||
<Style x:Key="AlwaysOnTopStyleM"
|
||||
BasedOn="{StaticResource AlwaysOnTopStyleS}"
|
||||
TargetType="controls:OverflowTextBlock">
|
||||
<Setter Property="ColumnWidth" Value="28"/>
|
||||
<Setter Property="ColumnHeight" Value="280"/>
|
||||
<Setter Property="ScrollButtonFontSize" Value="28"/>
|
||||
@@ -223,7 +239,7 @@
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</Style>
|
||||
|
||||
|
||||
<Style x:Key="AlwaysOnTopScrollButtonStyleS" TargetType="Button">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="0,0,0,0"/>
|
||||
@@ -592,8 +608,8 @@
|
||||
<controls:OverflowTextBlock x:Name="ExpressionText"
|
||||
Grid.Row="1"
|
||||
Margin="6,0,6,0"
|
||||
Style="{StaticResource NormalStyle}"
|
||||
VerticalAlignment="Bottom"
|
||||
Style="{StaticResource NormalStyle}"
|
||||
AutomationProperties.AutomationId="CalculatorExpression"
|
||||
AutomationProperties.Name="{x:Bind Model.CalculationExpressionAutomationName, Mode=OneWay}"
|
||||
IsTabStop="False"
|
||||
@@ -620,12 +636,12 @@
|
||||
x:Uid="CalculatorAlwaysOnTopResults"
|
||||
Grid.Row="2"
|
||||
Margin="6,0,6,0"
|
||||
HorizontalContentAlignment="Right"
|
||||
AutomationProperties.AutomationId="CalculatorAlwaysOnTopResults"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
AutomationProperties.Name="{x:Bind Model.CalculationResultAutomationName, Mode=OneWay}"
|
||||
TokensUpdated="{x:Bind Model.AreAlwaysOnTopResultsUpdated, Mode=OneWay}"
|
||||
HorizontalContentAlignment="Right"
|
||||
IsActive="True"
|
||||
TokensUpdated="{x:Bind Model.AreAlwaysOnTopResultsUpdated, Mode=OneWay}"
|
||||
UseSystemFocusVisuals="True"
|
||||
Visibility="{x:Bind Model.IsAlwaysOnTop, Mode=OneWay}"/>
|
||||
|
||||
@@ -644,18 +660,17 @@
|
||||
TabIndex="7"
|
||||
Visibility="{x:Bind Model.IsProgrammer, Mode=OneWay}"/>
|
||||
|
||||
<Grid x:Name="HistoryButtonParent"
|
||||
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}">
|
||||
<Grid x:Name="HistoryButtonParent" Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}">
|
||||
<Button x:Name="HistoryButton"
|
||||
x:Uid="HistoryButton"
|
||||
Grid.Row="0"
|
||||
IsEnabled="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
|
||||
Style="{StaticResource HistoryButtonStyle}"
|
||||
AutomationProperties.AutomationId="HistoryButton"
|
||||
Command="{x:Bind HistoryButtonPressed, Mode=OneTime}"
|
||||
Content=""
|
||||
ExitDisplayModeOnAccessKeyInvoked="False"
|
||||
TabIndex="2">
|
||||
x:Uid="HistoryButton"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource HistoryButtonStyle}"
|
||||
AutomationProperties.AutomationId="HistoryButton"
|
||||
Command="{x:Bind HistoryButtonPressed, Mode=OneTime}"
|
||||
Content=""
|
||||
ExitDisplayModeOnAccessKeyInvoked="False"
|
||||
IsEnabled="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
|
||||
TabIndex="2">
|
||||
<FlyoutBase.AttachedFlyout>
|
||||
<Flyout x:Name="HistoryFlyout"
|
||||
AutomationProperties.AutomationId="HistoryFlyout"
|
||||
@@ -666,7 +681,7 @@
|
||||
</FlyoutBase.AttachedFlyout>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
|
||||
<!-- Scientific angle buttons -->
|
||||
<local:CalculatorScientificAngleButtons x:Name="ScientificAngleButtons"
|
||||
Grid.Row="3"
|
||||
@@ -680,8 +695,8 @@
|
||||
x:Uid="MemoryPanel"
|
||||
Grid.Row="4"
|
||||
Margin="3,0,3,0"
|
||||
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"
|
||||
AutomationProperties.HeadingLevel="Level1">
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" MaxWidth="80"/>
|
||||
<ColumnDefinition Width="1*" MaxWidth="80"/>
|
||||
|
@@ -12,13 +12,16 @@
|
||||
#include "Controls/CalculationResult.h"
|
||||
#include "Controls/OverflowTextBlock.h"
|
||||
#include "Controls/EquationTextBox.h"
|
||||
#include "Controls/MathRichEditBox.h"
|
||||
#include "CalcViewModel/HistoryViewModel.h"
|
||||
#include "TemplateSelectors/KeyGraphFeaturesTemplateSelector.h"
|
||||
#include "Views/CalculatorProgrammerDisplayPanel.xaml.h"
|
||||
#include "Views/CalculatorProgrammerOperators.xaml.h"
|
||||
#include "Views/CalculatorScientificAngleButtons.xaml.h"
|
||||
#include "Views/HistoryList.xaml.h"
|
||||
#include "Views/Memory.xaml.h"
|
||||
#include "Views/OperatorsPanel.xaml.h"
|
||||
#include "Views/GraphingCalculator/KeyGraphFeaturesPanel.xaml.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
|
@@ -10,24 +10,24 @@
|
||||
d:DesignWidth="400"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ListView x:Name="EquationInputList"
|
||||
<ListView x:Name="EquationInputList"
|
||||
VerticalContentAlignment="Top"
|
||||
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">
|
||||
<controls:EquationTextBox x:Uid="EquationInputButton"
|
||||
<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}"
|
||||
@@ -35,27 +35,22 @@
|
||||
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"
|
||||
RemoveButtonClicked="EquationTextBox_RemoveButtonClicked"
|
||||
KeyGraphFeaturesButtonClicked="EquationTextBox_KeyGraphFeaturesButtonClicked">
|
||||
<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"
|
||||
<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>
|
||||
</ListView.Footer>
|
||||
</ListView>
|
||||
</UserControl>
|
||||
|
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "EquationInputArea.xaml.h"
|
||||
|
||||
@@ -33,7 +36,7 @@ EquationInputArea::EquationInputArea()
|
||||
ref new TypedEventHandler<AccessibilitySettings ^, Object ^>(this, &EquationInputArea::OnHighContrastChanged);
|
||||
|
||||
ReloadAvailableColors(m_accessibilitySettings->HighContrast);
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -98,6 +101,18 @@ void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object ^ sender, Rou
|
||||
}
|
||||
}
|
||||
|
||||
void EquationInputArea::EquationTextBox_KeyGraphFeaturesButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||
auto eq = static_cast<EquationViewModel ^>(tb->DataContext);
|
||||
EquationVM = eq;
|
||||
KeyGraphFeaturesVisibilityChanged(this, ref new RoutedEventArgs());
|
||||
}
|
||||
|
||||
void EquationInputArea::EquationTextBox_EquationButtonClicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
}
|
||||
|
||||
void EquationInputArea::EquationTextBoxLoaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
auto tb = static_cast<EquationTextBox ^>(sender);
|
||||
|
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Views/GraphingCalculator/EquationInputArea.g.h"
|
||||
@@ -6,6 +9,7 @@
|
||||
#include "EquationStylePanelControl.xaml.h"
|
||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
||||
#include "Controls/EquationTextBox.h"
|
||||
#include "Converters/BooleanNegationConverter.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
@@ -16,8 +20,10 @@ namespace CalculatorApp
|
||||
|
||||
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
|
||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector< ViewModel::EquationViewModel^ >^, Equations);
|
||||
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(ViewModel::EquationViewModel ^, EquationVM);
|
||||
OBSERVABLE_PROPERTY_RW(Windows::Foundation::Collections::IObservableVector<Windows::UI::Xaml::Media::SolidColorBrush ^> ^, AvailableColors);
|
||||
|
||||
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesVisibilityChanged;
|
||||
|
||||
private:
|
||||
void OnPropertyChanged(Platform::String^ propertyName);
|
||||
@@ -37,6 +43,8 @@ namespace CalculatorApp
|
||||
Windows::UI::ViewManagement::AccessibilitySettings ^ m_accessibilitySettings;
|
||||
int m_lastLineColorIndex;
|
||||
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 EquationTextBoxLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
@@ -9,8 +9,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:CalculatorApp.ViewModel"
|
||||
DataContextChanged="GraphingCalculator_DataContextChanged"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="ZoomRepeatButtonStyle" TargetType="RepeatButton">
|
||||
@@ -33,7 +32,7 @@
|
||||
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="RootGrid" >
|
||||
<Grid x:Name="RootGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="RowHamburger" Height="{StaticResource HamburgerHeightGridLength}"/>
|
||||
<RowDefinition/>
|
||||
@@ -48,39 +47,75 @@
|
||||
Grid.Row="1"
|
||||
Grid.Column="0">
|
||||
<Grid Grid.Row="0" Margin="4,7,4,4">
|
||||
<graphControl:Grapher Name="GraphingControl"
|
||||
EquationsSource="{x:Bind ViewModel.Equations, Mode=OneWay}"
|
||||
ForceProportionalAxes="True"
|
||||
UseSystemFocusVisuals="True"
|
||||
VariablesUpdated="GraphVariablesUpdated"
|
||||
LostFocus="OnGraphLostFocus"
|
||||
LosingFocus="OnLoosingFocus">
|
||||
<graphControl:Grapher Name="GraphingControl"
|
||||
EquationsSource="{x:Bind ViewModel.Equations, Mode=OneWay}"
|
||||
ForceProportionalAxes="True"
|
||||
LosingFocus="OnLoosingFocus"
|
||||
LostFocus="OnGraphLostFocus"
|
||||
UseSystemFocusVisuals="True"
|
||||
VariablesUpdated="GraphVariablesUpdated">
|
||||
<graphControl:Grapher.Background>
|
||||
<SolidColorBrush Color="White"/>
|
||||
</graphControl:Grapher.Background>
|
||||
<graphControl:Grapher.EquationTemplate>
|
||||
<DataTemplate x:DataType="vm:EquationViewModel">
|
||||
<graphControl:Equation Expression="{x:Bind Expression, Mode=OneWay}" LineColor="{x:Bind LineColor, Mode=OneWay}"/>
|
||||
<graphControl:Equation AnalysisError="{x:Bind AnalysisError, Mode=TwoWay}"
|
||||
Domain="{x:Bind Domain, Mode=TwoWay}"
|
||||
Expression="{x:Bind Expression, Mode=OneWay}"
|
||||
HorizontalAsymptotes="{x:Bind HorizontalAsymptotes, Mode=TwoWay}"
|
||||
InflectionPoints="{x:Bind InflectionPoints, Mode=TwoWay}"
|
||||
IsAnalysisUpdated="{x:Bind IsAnalysisUpdated, Mode=TwoWay}"
|
||||
LineColor="{x:Bind LineColor, Mode=OneWay}"
|
||||
Maxima="{x:Bind Maxima, Mode=TwoWay}"
|
||||
Minima="{x:Bind Minima, Mode=TwoWay}"
|
||||
Monotonicity="{x:Bind Monotonicity, Mode=TwoWay}"
|
||||
ObliqueAsymptotes="{x:Bind ObliqueAsymptotes, Mode=TwoWay}"
|
||||
Parity="{x:Bind Parity, Mode=TwoWay}"
|
||||
PeriodicityDirection="{x:Bind PeriodicityDirection, Mode=TwoWay}"
|
||||
PeriodicityExpression="{x:Bind PeriodicityExpression, Mode=TwoWay}"
|
||||
Range="{x:Bind Range, Mode=TwoWay}"
|
||||
TooComplexFeatures="{x:Bind TooComplexFeatures, Mode=TwoWay}"
|
||||
VerticalAsymptotes="{x:Bind VerticalAsymptotes, Mode=TwoWay}"
|
||||
XIntercept="{x:Bind XIntercept, Mode=TwoWay}"
|
||||
YIntercept="{x:Bind YIntercept, Mode=TwoWay}"/>
|
||||
</DataTemplate>
|
||||
</graphControl:Grapher.EquationTemplate>
|
||||
|
||||
</graphControl:Grapher>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,10,10">
|
||||
<Button x:Name="ActiveTracing" Click="OnActiveTracingClick" MinWidth="40" MinHeight="40" Margin="0,0,10,0">
|
||||
<StackPanel Grid.Row="0"
|
||||
Margin="0,0,10,10"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<Button x:Name="ActiveTracing"
|
||||
MinWidth="40"
|
||||
MinHeight="40"
|
||||
Margin="0,0,10,0"
|
||||
Click="OnActiveTracingClick">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph=""/>
|
||||
</Button>
|
||||
<Button x:Name="Share" Click="OnShareClick" MinWidth="40" MinHeight="40">
|
||||
<Button x:Name="Share"
|
||||
MinWidth="40"
|
||||
MinHeight="40"
|
||||
Click="OnShareClick">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph=""/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Popup x:Name="TraceValuePopup" Grid.Row="0" RenderTransformOrigin="0,1">
|
||||
|
||||
<Popup x:Name="TraceValuePopup"
|
||||
Grid.Row="0"
|
||||
RenderTransformOrigin="0,1">
|
||||
<Popup.RenderTransform>
|
||||
<TranslateTransform x:Name="TraceValuePopupTransform" X="50" Y="150"/>
|
||||
</Popup.RenderTransform>
|
||||
<Grid Background="{StaticResource ToolTipBackground}" BorderBrush="{StaticResource ToolTipBorderBrush}" BorderThickness="3,3,3,3">
|
||||
<TextBlock x:Name="TraceValue" Text="x=0,y=0" Margin="5,5,5,5" Foreground="{StaticResource ToolTipForeground}"/>
|
||||
<Grid Background="{StaticResource ToolTipBackground}"
|
||||
BorderBrush="{StaticResource ToolTipBorderBrush}"
|
||||
BorderThickness="3,3,3,3">
|
||||
<TextBlock x:Name="TraceValue"
|
||||
Margin="5,5,5,5"
|
||||
Foreground="{StaticResource ToolTipForeground}"
|
||||
Text="x=0,y=0"/>
|
||||
</Grid>
|
||||
</Popup>
|
||||
|
||||
@@ -392,20 +427,30 @@
|
||||
<RowDefinition Height="3*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<!-- Ideally the KeyGraphFeaturesPanel should be a frame so that navigation to and from the panel could be handled nicely -->
|
||||
<local:KeyGraphFeaturesPanel x:Name="KeyGraphFeaturesControl"
|
||||
Grid.RowSpan="2"
|
||||
x:Load="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"
|
||||
KeyGraphFeaturesClosed="OnKeyGraphFeaturesClosed"
|
||||
ViewModel="{x:Bind EquationInputAreaControl.EquationVM, Mode=OneWay}"
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"/>
|
||||
<Grid x:Name="EquationInputAreaGrid" Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<local:EquationInputArea Grid.Row="1"
|
||||
<local:EquationInputArea x:Name="EquationInputAreaControl"
|
||||
Grid.Row="1"
|
||||
Margin="0,8,0,0"
|
||||
Equations="{x:Bind ViewModel.Equations}"/>
|
||||
Equations="{x:Bind ViewModel.Equations}"
|
||||
KeyGraphFeaturesVisibilityChanged="OnEquationKeyGraphFeaturesVisibilityChanged"/>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="ButtonContainerGrid"
|
||||
Grid.Row="1"
|
||||
Margin="3,0,3,3"
|
||||
UseLayoutRounding="False">
|
||||
UseLayoutRounding="False"
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
|
@@ -1,9 +1,13 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "CalcViewModel/Common/TraceLogger.h"
|
||||
#include "GraphingCalculator.xaml.h"
|
||||
#include "CalcViewModel/Common/KeyboardShortcutManager.h"
|
||||
#include "Controls/CalculationResult.h"
|
||||
#include "Calculator\Controls\EquationTextBox.h"
|
||||
#include "Calculator\Views\GraphingCalculator\EquationInputArea.xaml.h"
|
||||
|
||||
using namespace CalculatorApp;
|
||||
using namespace CalculatorApp::Common;
|
||||
@@ -311,3 +315,13 @@ void CalculatorApp::GraphingCalculator::OnLoosingFocus(Windows::UI::Xaml::UIElem
|
||||
args->TryCancel();
|
||||
}
|
||||
}
|
||||
|
||||
void GraphingCalculator::OnEquationKeyGraphFeaturesVisibilityChanged(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
IsKeyGraphFeaturesVisible = true;
|
||||
}
|
||||
|
||||
void GraphingCalculator::OnKeyGraphFeaturesClosed(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
IsKeyGraphFeaturesVisible = false;
|
||||
}
|
||||
|
@@ -1,8 +1,12 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Views\GraphingCalculator\GraphingCalculator.g.h"
|
||||
#include "CalcViewModel\GraphingCalculator\GraphingCalculatorViewModel.h"
|
||||
#include "Views\NumberPad.xaml.h"
|
||||
#include "Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
@@ -18,6 +22,7 @@ namespace CalculatorApp
|
||||
COMMAND_FOR_METHOD(ZoomOutButtonPressed, GraphingCalculator::OnZoomOutCommand);
|
||||
COMMAND_FOR_METHOD(ZoomInButtonPressed, GraphingCalculator::OnZoomInCommand);
|
||||
COMMAND_FOR_METHOD(ZoomResetButtonPressed, GraphingCalculator::OnZoomResetCommand);
|
||||
OBSERVABLE_PROPERTY_RW(bool, IsKeyGraphFeaturesVisible);
|
||||
|
||||
property CalculatorApp::ViewModel::GraphingCalculatorViewModel^ ViewModel
|
||||
{
|
||||
@@ -57,7 +62,8 @@ namespace CalculatorApp
|
||||
void OnActiveTracingClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnGraphLostFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnLoosingFocus(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::LosingFocusEventArgs ^ args);
|
||||
|
||||
void OnEquationKeyGraphFeaturesVisibilityChanged(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnKeyGraphFeaturesClosed(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
bool ActiveTracingOn;
|
||||
};
|
||||
|
||||
|
@@ -0,0 +1,462 @@
|
||||
<UserControl x:Class="CalculatorApp.KeyGraphFeaturesPanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CalculatorApp.Controls"
|
||||
xmlns:converters="using:CalculatorApp.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ts="using:CalculatorApp.TemplateSelectors"
|
||||
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>
|
||||
<Grid.Resources>
|
||||
<Style x:Key="KGF_EquationTextBoxStyle" TargetType="controls:MathRichEditBox">
|
||||
<Setter Property="Foreground" Value="{ThemeResource TextControlForeground}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="ContentLinkForegroundColor" Value="{ThemeResource ContentLinkForegroundColor}"/>
|
||||
<Setter Property="ContentLinkBackgroundColor" Value="{ThemeResource ContentLinkBackgroundColor}"/>
|
||||
<Setter Property="SelectionHighlightColor" Value="{ThemeResource TextControlSelectionHighlightColor}"/>
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource TextControlBorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}"/>
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto"/>
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"/>
|
||||
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
|
||||
<Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}"/>
|
||||
<Setter Property="UseSystemFocusVisuals" Value="{ThemeResource IsApplicationFocusVisualKindReveal}"/>
|
||||
<Setter Property="ContextFlyout" Value="{StaticResource TextControlCommandBarContextFlyout}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:MathRichEditBox">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Disabled"/>
|
||||
<VisualState x:Name="Normal"/>
|
||||
<VisualState x:Name="PointerOver"/>
|
||||
<VisualState x:Name="Focused"/>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<ContentPresenter x:Name="HeaderContentPresenter"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
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"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
MinWidth="{ThemeResource TextControlThemeMinWidth}"
|
||||
MinHeight="{ThemeResource TextControlThemeMinHeight}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="0"
|
||||
Control.IsTemplateFocusTarget="True"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"/>
|
||||
<ScrollViewer x:Name="ContentElement"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
|
||||
IsTabStop="False"
|
||||
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
||||
ZoomMode="Disabled"/>
|
||||
<TextBlock x:Name="PlaceholderTextContentPresenter"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Margin="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource TextControlPlaceholderForeground}"
|
||||
IsHitTestVisible="False"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
TextWrapping="{TemplateBinding TextWrapping}"/>
|
||||
<ContentPresenter x:Name="DescriptionPresenter"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Background="Transparent"
|
||||
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
|
||||
x:Load="False"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{TemplateBinding Description}"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition MinHeight="44"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button x:Name="EquationButton"
|
||||
MinWidth="44"
|
||||
MinHeight="44"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding EquationColor}"
|
||||
Foreground="{StaticResource SystemChromeWhiteColor}"
|
||||
BorderThickness="0">
|
||||
<Button.Content>
|
||||
<StackPanel Margin="5,0"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<FontIcon VerticalAlignment="Center"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Glyph=""/>
|
||||
<TextBlock Margin="12,-4,0,0"
|
||||
VerticalAlignment="Top"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="16"
|
||||
Text="ƒₓ"/>
|
||||
</StackPanel>
|
||||
</Button.Content>
|
||||
<Button.Resources>
|
||||
<SolidColorBrush x:Name="ButtonBackgroundPointerOver"
|
||||
Opacity="0.7"
|
||||
Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor.Color}"/>
|
||||
<SolidColorBrush x:Name="ButtonForegroundPointerOver" Color="{ThemeResource SystemChromeWhiteColor}"/>
|
||||
<SolidColorBrush x:Name="ButtonBorderBrushPointerOver" Color="Transparent"/>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
|
||||
<controls:MathRichEditBox x:Name="EquationTextBox"
|
||||
Grid.Column="1"
|
||||
MinHeight="44"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Stretch"
|
||||
Style="{StaticResource MathRichEdit_EquationTextBoxStyle}"
|
||||
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="Margin" Value="-8,0,0,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="{ThemeResource TextControlThemeMinWidth}"
|
||||
MinHeight="{ThemeResource TextControlThemeMinHeight}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"/>
|
||||
<ScrollViewer x:Name="ContentElement"
|
||||
Grid.Row="1"
|
||||
Margin="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
|
||||
IsTabStop="False"
|
||||
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
|
||||
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}"
|
||||
x:Load="False"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{TemplateBinding Description}"/>
|
||||
|
||||
</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="TextWrapping" Value="WrapWholeWords"/>
|
||||
</Style>
|
||||
|
||||
<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"/>
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="KGFRichEditDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
||||
<StackPanel>
|
||||
<TextBlock x:Name="TitleTextBlock"
|
||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||
Text="{x:Bind Title, Mode=OneWay}"/>
|
||||
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<controls:MathRichEditBox HorizontalAlignment="Left"
|
||||
HorizontalContentAlignment="Left"
|
||||
Style="{StaticResource KGF_RichEditBoxStyle}"
|
||||
MathText="{x:Bind}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="KGFGridDataTemplate" x:DataType="vm:KeyGraphFeaturesItem">
|
||||
<StackPanel>
|
||||
<TextBlock x:Name="TitleTextBlock"
|
||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||
Text="{x:Bind Title, Mode=OneWay}"/>
|
||||
<ItemsControl ItemsSource="{x:Bind GridItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:GridDisplayItems">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:MathRichEditBox Grid.Column="0"
|
||||
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">
|
||||
<StackPanel>
|
||||
<TextBlock x:Name="TitleTextBlock"
|
||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||
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"
|
||||
GridTemplate="{StaticResource KGFGridDataTemplate}"
|
||||
RichEditTemplate="{StaticResource KGFRichEditDataTemplate}"
|
||||
TextBlockTemplate="{StaticResource KGFTextBlockDataTemplate}"/>
|
||||
|
||||
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Margin="0,7,0,0" Background="Transparent">
|
||||
<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"
|
||||
Loaded="EquationInputTextBox_Loaded"/>
|
||||
<TextBlock x:Uid="KeyGraphFeaturesLabel"
|
||||
Grid.Row="1"
|
||||
Margin="12,20,10,0"
|
||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||
FontSize="18"
|
||||
AutomationProperties.HeadingLevel="Level1"/>
|
||||
|
||||
<ListView x:Name="KeyGraphFeaturesListView"
|
||||
Grid.Row="2"
|
||||
Margin="12,10,10,0"
|
||||
Padding="0,0,0,12"
|
||||
IsItemClickEnabled="False"
|
||||
ItemContainerStyle="{StaticResource KGF_ListViewItemContainerStyle}"
|
||||
ItemTemplateSelector="{StaticResource KGFTemplateSelector}"
|
||||
ItemsSource="{x:Bind ViewModel.KeyGraphFeaturesItems}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollMode="Auto"
|
||||
SelectionMode="None"
|
||||
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
||||
<TextBlock x:Name="AnalysisErrorTextBlock"
|
||||
Grid.Row="2"
|
||||
Margin="12,10,10,0"
|
||||
Style="{StaticResource KGF_TextBlockStyle}"
|
||||
FontWeight="Normal"
|
||||
Text="{x:Bind ViewModel.AnalysisErrorString, Mode=OneWay}"
|
||||
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "KeyGraphFeaturesPanel.xaml.h"
|
||||
#include "Controls/MathRichEditBox.h"
|
||||
#include "CalcViewModel/GraphingCalculatorEnums.h"
|
||||
|
||||
using namespace CalculatorApp;
|
||||
using namespace CalculatorApp::ViewModel;
|
||||
using namespace Platform;
|
||||
using namespace Windows::UI;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
|
||||
KeyGraphFeaturesPanel::KeyGraphFeaturesPanel()
|
||||
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void KeyGraphFeaturesPanel::OnPropertyChanged(String ^ propertyName)
|
||||
{
|
||||
if (propertyName == L"ViewModel")
|
||||
{
|
||||
if (ViewModel == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetEquationTextBoxProperties();
|
||||
}
|
||||
}
|
||||
|
||||
void KeyGraphFeaturesPanel::EquationButtonClicked(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);
|
||||
EquationInputTextBox->EquationColor = ViewModel->LineColor;
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Views\GraphingCalculator\KeyGraphFeaturesPanel.g.h"
|
||||
#include "CalcViewModel\GraphingCalculator\EquationViewModel.h"
|
||||
#include "Controls/MathRichEditBox.h"
|
||||
#include "Controls/EquationTextBox.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
public
|
||||
ref class KeyGraphFeaturesPanel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
|
||||
{
|
||||
public:
|
||||
KeyGraphFeaturesPanel();
|
||||
|
||||
OBSERVABLE_OBJECT_CALLBACK(OnPropertyChanged);
|
||||
OBSERVABLE_PROPERTY_RW_ALWAYS_NOTIFY(CalculatorApp::ViewModel::EquationViewModel ^, ViewModel);
|
||||
|
||||
event Windows::UI::Xaml::RoutedEventHandler ^ KeyGraphFeaturesClosed;
|
||||
|
||||
private:
|
||||
|
||||
void OnPropertyChanged(Platform::String ^ propertyName);
|
||||
void EquationButtonClicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void SetEquationTextBoxProperties();
|
||||
void EquationInputTextBox_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user