Add preview tag to Graphing feature (#907)
* Add preview tag to Graphing * Fix Graph Settings button in dark mode
This commit is contained in:
@@ -247,6 +247,9 @@
|
||||
<ClInclude Include="Controls\CalculatorButton.h" />
|
||||
<ClInclude Include="Controls\FlipButtons.h" />
|
||||
<ClInclude Include="Controls\OverflowTextBlock.h" />
|
||||
<ClInclude Include="Controls\PreviewTagControl.xaml.h">
|
||||
<DependentUpon>Controls\PreviewTagControl.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controls\RadixButton.h" />
|
||||
<ClInclude Include="Controls\SupplementaryItemsControl.h" />
|
||||
<ClInclude Include="Converters\BooleanNegationConverter.h" />
|
||||
@@ -346,6 +349,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="AboutFlyout.xaml" />
|
||||
<Page Include="Controls\PreviewTagControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="EquationStylePanelControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -410,6 +416,9 @@
|
||||
<ClCompile Include="Controls\CalculatorButton.cpp" />
|
||||
<ClCompile Include="Controls\FlipButtons.cpp" />
|
||||
<ClCompile Include="Controls\OverflowTextBlock.cpp" />
|
||||
<ClCompile Include="Controls\PreviewTagControl.xaml.cpp">
|
||||
<DependentUpon>Controls\PreviewTagControl.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controls\RadixButton.cpp" />
|
||||
<ClCompile Include="Controls\SupplementaryItemsControl.cpp" />
|
||||
<ClCompile Include="Converters\BooleanNegationConverter.cpp" />
|
||||
|
57
src/Calculator/Controls/PreviewTagControl.xaml
Normal file
57
src/Calculator/Controls/PreviewTagControl.xaml
Normal file
@@ -0,0 +1,57 @@
|
||||
<UserControl x:Class="CalculatorApp.Controls.PreviewTagControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Default">
|
||||
<Style x:Key="PreviewTagRectStyle" TargetType="Rectangle">
|
||||
<Setter Property="Opacity" Value="0.86"/>
|
||||
<Setter Property="Fill" Value="{ThemeResource SystemAccentColor}"/>
|
||||
</Style>
|
||||
<Style x:Key="PreviewTagTextStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Setter Property="Margin" Value="4,0,4,1"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<Style x:Key="PreviewTagRectStyle" TargetType="Rectangle">
|
||||
<Setter Property="Opacity" Value="0.86"/>
|
||||
<Setter Property="Fill" Value="{ThemeResource SystemAccentColor}"/>
|
||||
</Style>
|
||||
<Style x:Key="PreviewTagTextStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Setter Property="Margin" Value="4,0,4,1"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<Style x:Key="PreviewTagRectStyle" TargetType="Rectangle">
|
||||
<Setter Property="Fill" Value="{ThemeResource SystemColorWindowBrush}"/>
|
||||
<Setter Property="Stroke" Value="{ThemeResource SystemColorWindowTextBrush}"/>
|
||||
<Setter Property="StrokeThickness" Value="1"/>
|
||||
</Style>
|
||||
<Style x:Key="PreviewTagTextStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemColorWindowTextBrush}"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Margin" Value="6,2,6,3"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Rectangle Style="{ThemeResource PreviewTagRectStyle}"
|
||||
RadiusX="2"
|
||||
RadiusY="2"/>
|
||||
<TextBlock Style="{ThemeResource PreviewTagTextStyle}"
|
||||
FontWeight="SemiBold"
|
||||
Text="Preview"/>
|
||||
</Grid>
|
||||
</UserControl>
|
23
src/Calculator/Controls/PreviewTagControl.xaml.cpp
Normal file
23
src/Calculator/Controls/PreviewTagControl.xaml.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "PreviewTagControl.xaml.h"
|
||||
|
||||
using namespace CalculatorApp;
|
||||
using namespace CalculatorApp::Controls;
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
PreviewTagControl::PreviewTagControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
16
src/Calculator/Controls/PreviewTagControl.xaml.h
Normal file
16
src/Calculator/Controls/PreviewTagControl.xaml.h
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Controls\PreviewTagControl.g.h"
|
||||
|
||||
namespace CalculatorApp::Controls
|
||||
{
|
||||
[Windows::Foundation::Metadata::WebHostHidden]
|
||||
public ref class PreviewTagControl sealed
|
||||
{
|
||||
public:
|
||||
PreviewTagControl();
|
||||
};
|
||||
}
|
@@ -426,8 +426,7 @@
|
||||
MinWidth="40"
|
||||
Style="{ThemeResource ThemedGraphButtonStyle}"
|
||||
contract7Present:CornerRadius="{ThemeResource RightButtonCornerRadius}"
|
||||
Click="GraphSettingsButton_Click"
|
||||
RequestedTheme="Light">
|
||||
Click="GraphSettingsButton_Click">
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
|
||||
FontSize="18"
|
||||
Glyph=""/>
|
||||
|
@@ -33,6 +33,13 @@
|
||||
<Setter Property="KeyTipPlacementMode" Value="Right"/>
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="NavMenuItemPreviewDataTemplate" x:DataType="x:String">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="{x:Bind}"/>
|
||||
<controls:PreviewTagControl Margin="6,0,0,0" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<converters:BooleanToVisibilityNegationConverter x:Key="BooleanToVisibilityNegationConverter"/>
|
||||
<converters:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
|
||||
</Page.Resources>
|
||||
@@ -157,23 +164,28 @@
|
||||
</muxc:NavigationViewList>
|
||||
</StackPanel>
|
||||
</muxc:NavigationView.PaneFooter>
|
||||
<Grid>
|
||||
<Grid Height="{StaticResource HamburgerHeight}" VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="Header"
|
||||
Grid.Column="0"
|
||||
Margin="52,6,12,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{x:Bind Model.CategoryName, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
||||
<StackPanel Margin="52,0,0,0" Orientation="Horizontal">
|
||||
<TextBlock x:Name="Header"
|
||||
Margin="0,-3,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="{x:Bind Model.CategoryName, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.IsAlwaysOnTop, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
||||
<controls:PreviewTagControl Margin="6,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{x:Bind Model.IsModePreview, Mode=OneWay}"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="NormalAlwaysOnTopButton"
|
||||
x:Uid="EnterAlwaysOnTopButton"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Top"
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
Style="{StaticResource SquareIconButtonStyle}"
|
||||
Background="Transparent"
|
||||
|
@@ -498,7 +498,17 @@ MUXC::NavigationViewItem ^ MainPage::CreateNavViewItemFromCategory(NavCategory ^
|
||||
icon->Glyph = category->Glyph;
|
||||
item->Icon = icon;
|
||||
|
||||
item->Content = category->Name;
|
||||
if (category->IsPreview)
|
||||
{
|
||||
auto contentPresenter = ref new ContentPresenter();
|
||||
contentPresenter->Content = category->Name;
|
||||
contentPresenter->ContentTemplate = static_cast<DataTemplate ^>(Resources->Lookup(L"NavMenuItemPreviewDataTemplate"));
|
||||
item->Content = contentPresenter;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->Content = category->Name;
|
||||
}
|
||||
item->AccessKey = category->AccessKey;
|
||||
item->IsEnabled = category->IsEnabled;
|
||||
item->Style = static_cast<Windows::UI::Xaml::Style ^>(Resources->Lookup(L"NavViewItemStyle"));
|
||||
|
Reference in New Issue
Block a user