Revert dual screen (#1134)
This commit is contained in:
parent
ded99f87b4
commit
b0565f90f0
@ -334,7 +334,6 @@
|
||||
<ClInclude Include="StandardCalculatorViewModel.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="UnitConverterViewModel.h" />
|
||||
<ClInclude Include="Utils\DeviceFamilyHelper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ApplicationViewModel.cpp" />
|
||||
@ -375,7 +374,6 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="StandardCalculatorViewModel.cpp" />
|
||||
<ClCompile Include="UnitConverterViewModel.cpp" />
|
||||
<ClCompile Include="Utils\DeviceFamilyHelper.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CalcManager\CalcManager.vcxproj">
|
||||
|
@ -13,9 +13,6 @@
|
||||
<Filter Include="GraphingCalculator">
|
||||
<UniqueIdentifier>{cf7dca32-9727-4f98-83c3-1c0ca7dd1e0c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Utils">
|
||||
<UniqueIdentifier>{68bb415f-fcb1-4759-b0a7-c5caf9d72396}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
@ -89,9 +86,6 @@
|
||||
<ClCompile Include="GraphingCalculator\GraphingSettingsViewModel.cpp">
|
||||
<Filter>GraphingCalculator</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utils\DeviceFamilyHelper.cpp">
|
||||
<Filter>Utils</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
@ -205,9 +199,6 @@
|
||||
<ClInclude Include="Common\DelegateCommand.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils\DeviceFamilyHelper.h">
|
||||
<Filter>Utils</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="DataLoaders\DefaultFromToCurrency.json">
|
||||
|
@ -1,54 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "DeviceFamilyHelper.h"
|
||||
|
||||
using namespace CalculatorApp::ViewModel::Utils;
|
||||
using namespace Windows::System::Profile;
|
||||
|
||||
bool DeviceFamilyHelper::m_isInit{ false };
|
||||
DeviceFamily DeviceFamilyHelper::m_deviceFamily{ DeviceFamily::Unknown };
|
||||
|
||||
DeviceFamily DeviceFamilyHelper::GetDeviceFamily()
|
||||
{
|
||||
if (!m_isInit)
|
||||
{
|
||||
InitDeviceFamily();
|
||||
m_isInit = true;
|
||||
}
|
||||
return m_deviceFamily;
|
||||
}
|
||||
|
||||
void DeviceFamilyHelper::InitDeviceFamily()
|
||||
{
|
||||
auto deviceFamily = AnalyticsInfo::VersionInfo->DeviceFamily;
|
||||
if (deviceFamily == L"Windows.Desktop")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Desktop;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Core")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::WindowsCore;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Xbox")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Xbox;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Team")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::SurfaceHub;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Holographic")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::HoloLens;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Mobile")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Mobile;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Unknown;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace CalculatorApp::ViewModel::Utils
|
||||
{
|
||||
public enum class DeviceFamily
|
||||
{
|
||||
Unknown,
|
||||
Desktop,
|
||||
Mobile,
|
||||
Xbox,
|
||||
SurfaceHub,
|
||||
HoloLens,
|
||||
WindowsCore,
|
||||
};
|
||||
|
||||
public ref class DeviceFamilyHelper sealed
|
||||
{
|
||||
private:
|
||||
DeviceFamilyHelper() {}
|
||||
public:
|
||||
static DeviceFamily GetDeviceFamily();
|
||||
private:
|
||||
static void InitDeviceFamily();
|
||||
private:
|
||||
static bool m_isInit;
|
||||
static DeviceFamily m_deviceFamily;
|
||||
};
|
||||
}
|
@ -3,8 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="using:CalculatorApp.Controls"
|
||||
xmlns:common="using:CalculatorApp.Common"
|
||||
xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)"
|
||||
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
|
||||
xmlns:local="using:CalculatorApp">
|
||||
|
||||
<Application.Resources>
|
||||
@ -1768,125 +1766,6 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Controls:TwoPaneViewCX">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="MinWideModeWidth" Value="641"/>
|
||||
<Setter Property="MinTallModeHeight" Value="641"/>
|
||||
<Setter Property="IsTabStop" Value="False"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Controls:TwoPaneViewCX">
|
||||
<Grid x:Name="RootGrid"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="PART_ColumnLeft" Width="Auto"/>
|
||||
<ColumnDefinition x:Name="PART_ColumnMiddle" Width="0"/>
|
||||
<ColumnDefinition x:Name="PART_ColumnRight" Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="PART_RowTop" Height="*"/>
|
||||
<RowDefinition x:Name="PART_RowMiddle" Height="0"/>
|
||||
<RowDefinition x:Name="PART_RowBottom" Height="0"/>
|
||||
</Grid.RowDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="ModeStates">
|
||||
<VisualState x:Name="ViewMode_LeftRight"/>
|
||||
|
||||
<VisualState x:Name="ViewMode_RightLeft">
|
||||
<VisualState.Setters>
|
||||
<contract7NotPresent:Setter Target="PART_Pane1.(Grid.Column)" Value="2"/>
|
||||
<contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>
|
||||
|
||||
<contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Column)" Value="2"/>
|
||||
<contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="ViewMode_TopBottom">
|
||||
<VisualState.Setters>
|
||||
<contract7NotPresent:Setter Target="PART_Pane1.(Grid.Column)" Value="0"/>
|
||||
<contract7NotPresent:Setter Target="PART_Pane1.(Grid.Row)" Value="0"/>
|
||||
|
||||
<contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>
|
||||
<contract7NotPresent:Setter Target="PART_Pane2.(Grid.Row)" Value="2"/>
|
||||
|
||||
<contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Column)" Value="0"/>
|
||||
<contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Row)" Value="0"/>
|
||||
|
||||
<contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
|
||||
<contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Row)" Value="2"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="ViewMode_BottomTop">
|
||||
<VisualState.Setters>
|
||||
<contract7NotPresent:Setter Target="PART_Pane1.(Grid.Column)" Value="0"/>
|
||||
<contract7NotPresent:Setter Target="PART_Pane1.(Grid.Row)" Value="2"/>
|
||||
|
||||
<contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>
|
||||
<contract7NotPresent:Setter Target="PART_Pane2.(Grid.Row)" Value="0"/>
|
||||
|
||||
<contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Column)" Value="0"/>
|
||||
<contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Row)" Value="2"/>
|
||||
|
||||
<contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
|
||||
<contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Row)" Value="0"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="ViewMode_OneOnly">
|
||||
<VisualState.Setters>
|
||||
<contract7NotPresent:Setter Target="PART_Pane2.Visibility" Value="Collapsed"/>
|
||||
|
||||
<contract7Present:Setter Target="PART_Pane2ScrollViewer.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
|
||||
<VisualState x:Name="ViewMode_TwoOnly">
|
||||
<VisualState.Setters>
|
||||
<contract7NotPresent:Setter Target="PART_Pane1.Visibility" Value="Collapsed"/>
|
||||
<contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>
|
||||
|
||||
<contract7Present:Setter Target="PART_Pane1ScrollViewer.Visibility" Value="Collapsed"/>
|
||||
<contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<contract7Present:ScrollViewer x:Name="PART_Pane1ScrollViewer"
|
||||
Grid.Column="0"
|
||||
IsTabStop="False"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Border Child="{TemplateBinding Pane1}"/>
|
||||
</contract7Present:ScrollViewer>
|
||||
|
||||
<contract7Present:ScrollViewer x:Name="PART_Pane2ScrollViewer"
|
||||
Grid.Column="2"
|
||||
IsTabStop="False"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Border Child="{TemplateBinding Pane2}"/>
|
||||
</contract7Present:ScrollViewer>
|
||||
|
||||
<contract7NotPresent:Border x:Name="PART_Pane1"
|
||||
Grid.Column="0"
|
||||
Child="{TemplateBinding Pane1}"/>
|
||||
|
||||
<contract7NotPresent:Border x:Name="PART_Pane2"
|
||||
Grid.Column="2"
|
||||
Child="{TemplateBinding Pane2}"/>
|
||||
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
@ -252,7 +252,6 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="Controls\RadixButton.h" />
|
||||
<ClInclude Include="Controls\SupplementaryItemsControl.h" />
|
||||
<ClInclude Include="Controls\TwoPaneViewCX.h" />
|
||||
<ClInclude Include="Converters\BooleanNegationConverter.h" />
|
||||
<ClInclude Include="Converters\BooleanToVisibilityConverter.h" />
|
||||
<ClInclude Include="Converters\ExpressionItemTemplateSelector.h" />
|
||||
@ -330,7 +329,6 @@
|
||||
<ClInclude Include="Views\OperatorsPanel.xaml.h">
|
||||
<DependentUpon>Views\OperatorsPanel.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Views\StateTriggers\ApplicationViewModeTrigger.h" />
|
||||
<ClInclude Include="Views\StateTriggers\AspectRatioTrigger.h" />
|
||||
<ClInclude Include="Views\StateTriggers\ControlSizeTrigger.h" />
|
||||
<ClInclude Include="Views\SupplementaryResults.xaml.h">
|
||||
@ -424,7 +422,6 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="Controls\RadixButton.cpp" />
|
||||
<ClCompile Include="Controls\SupplementaryItemsControl.cpp" />
|
||||
<ClCompile Include="Controls\TwoPaneViewCX.cpp" />
|
||||
<ClCompile Include="Converters\BooleanNegationConverter.cpp" />
|
||||
<ClCompile Include="Converters\BooleanToVisibilityConverter.cpp" />
|
||||
<ClCompile Include="Converters\ExpressionItemTemplateSelector.cpp" />
|
||||
@ -508,7 +505,6 @@
|
||||
<ClCompile Include="Views\OperatorsPanel.xaml.cpp">
|
||||
<DependentUpon>Views\OperatorsPanel.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Views\StateTriggers\ApplicationViewModeTrigger.cpp" />
|
||||
<ClCompile Include="Views\StateTriggers\AspectRatioTrigger.cpp" />
|
||||
<ClCompile Include="Views\StateTriggers\ControlSizeTrigger.cpp" />
|
||||
<ClCompile Include="Views\SupplementaryResults.xaml.cpp">
|
||||
|
@ -329,12 +329,6 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\ViewState.cpp" />
|
||||
<ClCompile Include="Utils\DispatcherTimerDelayer.cpp" />
|
||||
<ClCompile Include="Controls\TwoPaneViewCX.cpp">
|
||||
<Filter>Controls</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Views\StateTriggers\ApplicationViewModeTrigger.cpp">
|
||||
<Filter>Views\StateTriggers</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
@ -443,12 +437,6 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\ViewState.h" />
|
||||
<ClInclude Include="Utils\DispatcherTimerDelayer.h" />
|
||||
<ClInclude Include="Controls\TwoPaneViewCX.h">
|
||||
<Filter>Controls</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Views\StateTriggers\ApplicationViewModeTrigger.h">
|
||||
<Filter>Views\StateTriggers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest" />
|
||||
|
@ -1,487 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
|
||||
#include "pch.h"
|
||||
#include "TwoPaneViewCX.h"
|
||||
#include "Utils/VisualTree.h"
|
||||
#include <math.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Platform;
|
||||
using namespace CalculatorApp::Controls;
|
||||
using namespace Calculator::Utils;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using Windows::Foundation::Metadata::ApiInformation;
|
||||
namespace MUXC = Microsoft::UI::Xaml::Controls;
|
||||
|
||||
StringReference c_pane1ScrollViewerName(L"PART_Pane1ScrollViewer");
|
||||
StringReference c_pane2ScrollViewerName(L"PART_Pane2ScrollViewer");
|
||||
StringReference c_columnLeftName(L"PART_ColumnLeft");
|
||||
StringReference c_columnMiddleName(L"PART_ColumnMiddle");
|
||||
StringReference c_columnRightName(L"PART_ColumnRight");
|
||||
StringReference c_rowTopName(L"PART_RowTop");
|
||||
StringReference c_rowMiddleName(L"PART_RowMiddle");
|
||||
StringReference c_rowBottomName(L"PART_RowBottom");
|
||||
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane1);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane2);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane1Length);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane2Length);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane1MinLength);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane2MinLength);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane1MaxLength);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Pane2MaxLength);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, PanePriority);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, Mode);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, WideModeConfiguration);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, TallModeConfiguration);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, MinWideModeWidth);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(TwoPaneViewCX, MinTallModeHeight);
|
||||
|
||||
TwoPaneViewCX::TwoPaneViewCX()
|
||||
{
|
||||
this->DefaultStyleKey = L"CalculatorApp.Controls.TwoPaneViewCX";
|
||||
this->SizeChanged += ref new Windows::UI::Xaml::SizeChangedEventHandler(this, &TwoPaneViewCX::OnSizeChanged);
|
||||
m_windowSizeChangedToken = Window::Current->SizeChanged +=
|
||||
ref new Windows::UI::Xaml::WindowSizeChangedEventHandler(this, &TwoPaneViewCX::OnWindowSizeChanged);
|
||||
}
|
||||
|
||||
TwoPaneViewCX::~TwoPaneViewCX()
|
||||
{
|
||||
Window::Current->SizeChanged -= m_windowSizeChangedToken;
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnApplyTemplate()
|
||||
{
|
||||
m_loaded = true;
|
||||
this->SetScrollViewerProperties(c_pane1ScrollViewerName);
|
||||
this->SetScrollViewerProperties(c_pane2ScrollViewerName);
|
||||
|
||||
if (auto column = dynamic_cast<ColumnDefinition ^>(this->GetTemplateChild(c_columnLeftName)))
|
||||
{
|
||||
m_columnLeft = column;
|
||||
}
|
||||
if (auto column = dynamic_cast<ColumnDefinition ^>(this->GetTemplateChild(c_columnMiddleName)))
|
||||
{
|
||||
m_columnMiddle = column;
|
||||
}
|
||||
if (auto column = dynamic_cast<ColumnDefinition ^>(this->GetTemplateChild(c_columnRightName)))
|
||||
{
|
||||
m_columnRight = column;
|
||||
}
|
||||
if (auto row = dynamic_cast<RowDefinition ^>(this->GetTemplateChild(c_rowTopName)))
|
||||
{
|
||||
m_rowTop = row;
|
||||
}
|
||||
if (auto row = dynamic_cast<RowDefinition ^>(this->GetTemplateChild(c_rowMiddleName)))
|
||||
{
|
||||
m_rowMiddle = row;
|
||||
}
|
||||
if (auto row = dynamic_cast<RowDefinition ^>(this->GetTemplateChild(c_rowBottomName)))
|
||||
{
|
||||
m_rowBottom = row;
|
||||
}
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::UpdateMode()
|
||||
{
|
||||
// Don't bother running this logic until after we hit OnApplyTemplate.
|
||||
if (!m_loaded)
|
||||
return;
|
||||
|
||||
double controlWidth = this->ActualWidth;
|
||||
double controlHeight = this->ActualHeight;
|
||||
|
||||
ViewMode newMode = (this->PanePriority == MUXC::TwoPaneViewPriority::Pane1) ? ViewMode::Pane1Only : ViewMode::Pane2Only;
|
||||
|
||||
// Calculate new mode
|
||||
Rect rcControl = GetControlRect();
|
||||
auto info = this->GetDisplayRegionHelperInfo();
|
||||
bool isInMultipleRegions = IsInMultipleRegions(info, rcControl);
|
||||
|
||||
if (isInMultipleRegions)
|
||||
{
|
||||
if (info.Mode == MUXC::TwoPaneViewMode::Wide)
|
||||
{
|
||||
// Regions are laid out horizontally
|
||||
if (this->WideModeConfiguration != MUXC::TwoPaneViewWideModeConfiguration::SinglePane)
|
||||
{
|
||||
newMode = (this->WideModeConfiguration == MUXC::TwoPaneViewWideModeConfiguration::LeftRight) ? ViewMode::LeftRight : ViewMode::RightLeft;
|
||||
}
|
||||
}
|
||||
else if (info.Mode == MUXC::TwoPaneViewMode::Tall)
|
||||
{
|
||||
// Regions are laid out vertically
|
||||
if (this->TallModeConfiguration != MUXC::TwoPaneViewTallModeConfiguration::SinglePane)
|
||||
{
|
||||
newMode = (this->TallModeConfiguration == MUXC::TwoPaneViewTallModeConfiguration::TopBottom) ? ViewMode::TopBottom : ViewMode::BottomTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// One region
|
||||
if (controlWidth > this->MinWideModeWidth && this->WideModeConfiguration != MUXC::TwoPaneViewWideModeConfiguration::SinglePane)
|
||||
{
|
||||
// Split horizontally
|
||||
newMode = (this->WideModeConfiguration == MUXC::TwoPaneViewWideModeConfiguration::LeftRight) ? ViewMode::LeftRight : ViewMode::RightLeft;
|
||||
}
|
||||
else if (controlHeight > this->MinTallModeHeight && this->TallModeConfiguration != MUXC::TwoPaneViewTallModeConfiguration::SinglePane)
|
||||
{
|
||||
// Split vertically
|
||||
newMode = (this->TallModeConfiguration == MUXC::TwoPaneViewTallModeConfiguration::TopBottom) ? ViewMode::TopBottom : ViewMode::BottomTop;
|
||||
}
|
||||
}
|
||||
|
||||
// Update row/column sizes (this may need to happen even if the mode doesn't change)
|
||||
UpdateRowsColumns(newMode, info, rcControl);
|
||||
|
||||
// Update mode if necessary
|
||||
if (newMode != m_currentMode)
|
||||
{
|
||||
m_currentMode = newMode;
|
||||
|
||||
auto newViewMode = MUXC::TwoPaneViewMode::SinglePane;
|
||||
|
||||
switch (m_currentMode)
|
||||
{
|
||||
case ViewMode::Pane1Only:
|
||||
VisualStateManager::GoToState(this, L"ViewMode_OneOnly", true);
|
||||
break;
|
||||
case ViewMode::Pane2Only:
|
||||
VisualStateManager::GoToState(this, L"ViewMode_TwoOnly", true);
|
||||
break;
|
||||
case ViewMode::LeftRight:
|
||||
VisualStateManager::GoToState(this, L"ViewMode_LeftRight", true);
|
||||
newViewMode = MUXC::TwoPaneViewMode::Wide;
|
||||
break;
|
||||
case ViewMode::RightLeft:
|
||||
VisualStateManager::GoToState(this, L"ViewMode_RightLeft", true);
|
||||
newViewMode = MUXC::TwoPaneViewMode::Wide;
|
||||
break;
|
||||
case ViewMode::TopBottom:
|
||||
VisualStateManager::GoToState(this, L"ViewMode_TopBottom", true);
|
||||
newViewMode = MUXC::TwoPaneViewMode::Tall;
|
||||
break;
|
||||
case ViewMode::BottomTop:
|
||||
VisualStateManager::GoToState(this, L"ViewMode_BottomTop", true);
|
||||
newViewMode = MUXC::TwoPaneViewMode::Tall;
|
||||
break;
|
||||
}
|
||||
|
||||
if (newViewMode != this->Mode)
|
||||
{
|
||||
SetValue(s_ModeProperty, newViewMode);
|
||||
this->ModeChanged(this, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::UpdateRowsColumns(ViewMode newMode, DisplayRegionHelperInfo info, Rect rcControl)
|
||||
{
|
||||
if (m_columnLeft && m_columnMiddle && m_columnRight && m_rowTop && m_rowMiddle && m_rowBottom)
|
||||
{
|
||||
// Reset split lengths
|
||||
this->m_columnMiddle->Width = GridLengthHelper::FromPixels(0);
|
||||
this->m_rowMiddle->Height = GridLengthHelper::FromPixels(0);
|
||||
|
||||
// Set columns lengths
|
||||
if (newMode == ViewMode::LeftRight || newMode == ViewMode::RightLeft)
|
||||
{
|
||||
if (newMode == ViewMode::LeftRight)
|
||||
{
|
||||
this->m_columnLeft->MinWidth = this->Pane1MinLength;
|
||||
this->m_columnLeft->MaxWidth = this->Pane1MaxLength;
|
||||
this->m_columnLeft->Width = this->Pane1Length;
|
||||
this->m_columnRight->MinWidth = this->Pane2MinLength;
|
||||
this->m_columnRight->MaxWidth = this->Pane2MaxLength;
|
||||
this->m_columnRight->Width = this->Pane2Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_columnLeft->MinWidth = this->Pane2MinLength;
|
||||
this->m_columnLeft->MaxWidth = this->Pane2MaxLength;
|
||||
this->m_columnLeft->Width = this->Pane2Length;
|
||||
this->m_columnRight->MinWidth = this->Pane1MinLength;
|
||||
this->m_columnRight->MaxWidth = this->Pane1MaxLength;
|
||||
this->m_columnRight->Width = this->Pane1Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_columnLeft->MinWidth = 0.0;
|
||||
this->m_columnRight->MinWidth = 0.0;
|
||||
this->m_columnLeft->MaxWidth = std::numeric_limits<double>::max();
|
||||
this->m_columnRight->MaxWidth = std::numeric_limits<double>::max();
|
||||
this->m_columnLeft->Width = GridLengthHelper::FromValueAndType(1, GridUnitType::Star);
|
||||
this->m_columnRight->Width = GridLengthHelper::FromPixels(0);
|
||||
}
|
||||
|
||||
// Set row lengths
|
||||
if (newMode == ViewMode::TopBottom || newMode == ViewMode::BottomTop)
|
||||
{
|
||||
if (newMode == ViewMode::TopBottom)
|
||||
{
|
||||
this->m_rowTop->MinHeight = this->Pane1MinLength;
|
||||
this->m_rowTop->MaxHeight = this->Pane1MaxLength;
|
||||
this->m_rowTop->Height = this->Pane1Length;
|
||||
this->m_rowBottom->MinHeight = this->Pane2MinLength;
|
||||
this->m_rowBottom->MaxHeight = this->Pane2MaxLength;
|
||||
this->m_rowBottom->Height = this->Pane2Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_rowTop->MinHeight = this->Pane2MinLength;
|
||||
this->m_rowTop->MaxHeight = this->Pane2MaxLength;
|
||||
this->m_rowTop->Height = this->Pane2Length;
|
||||
this->m_rowBottom->MinHeight = this->Pane1MinLength;
|
||||
this->m_rowBottom->MaxHeight = this->Pane1MaxLength;
|
||||
this->m_rowBottom->Height = this->Pane1Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_rowTop->MinHeight = 0.0;
|
||||
this->m_rowBottom->MinHeight = 0.0;
|
||||
this->m_rowTop->MaxHeight = std::numeric_limits<double>::max();
|
||||
this->m_rowBottom->MaxHeight = std::numeric_limits<double>::max();
|
||||
this->m_rowTop->Height = GridLengthHelper::FromValueAndType(1, GridUnitType::Star);
|
||||
this->m_rowBottom->Height = GridLengthHelper::FromPixels(0);
|
||||
}
|
||||
|
||||
// Handle regions
|
||||
if (IsInMultipleRegions(info, rcControl) && newMode != ViewMode::Pane1Only && newMode != ViewMode::Pane2Only)
|
||||
{
|
||||
Rect rc1 = info.Regions[0];
|
||||
Rect rc2 = info.Regions[1];
|
||||
Rect rcWindow = Window::Current->Bounds;
|
||||
|
||||
if (info.Mode == MUXC::TwoPaneViewMode::Wide)
|
||||
{
|
||||
this->m_columnMiddle->Width = GridLengthHelper::FromPixels(rc2.X - rc1.Width);
|
||||
|
||||
this->m_columnLeft->MinWidth = 0.0;
|
||||
this->m_columnRight->MinWidth = 0.0;
|
||||
this->m_columnLeft->MaxWidth = std::numeric_limits<double>::max();
|
||||
this->m_columnRight->MaxWidth = std::numeric_limits<double>::max();
|
||||
this->m_columnLeft->Width = GridLengthHelper::FromPixels(rc1.Width - rcControl.X);
|
||||
this->m_columnRight->Width = GridLengthHelper::FromPixels(rc2.Width - ((rcWindow.Width - rcControl.Width) - rcControl.X));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_rowMiddle->Height = GridLengthHelper::FromPixels(rc2.Y - rc1.Height);
|
||||
|
||||
this->m_rowTop->MinHeight = 0.0;
|
||||
this->m_rowBottom->MinHeight = 0.0;
|
||||
this->m_rowTop->MaxHeight = std::numeric_limits<double>::max();
|
||||
this->m_rowBottom->MaxHeight = std::numeric_limits<double>::max();
|
||||
this->m_rowTop->Height = GridLengthHelper::FromPixels(rc1.Height - rcControl.Y);
|
||||
this->m_rowBottom->Height = GridLengthHelper::FromPixels(rc2.Height - ((rcWindow.Height - rcControl.Height) - rcControl.Y));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rect TwoPaneViewCX::GetControlRect()
|
||||
{
|
||||
// Find out where this control is in the window
|
||||
auto transform = TransformToVisual(Window::Current->Content);
|
||||
return transform->TransformBounds(RectHelper::FromCoordinatesAndDimensions(0, 0, (float)this->ActualWidth, (float)this->ActualHeight));
|
||||
}
|
||||
|
||||
bool TwoPaneViewCX::IsInMultipleRegions(DisplayRegionHelperInfo info, Rect rcControl)
|
||||
{
|
||||
bool isInMultipleRegions = false;
|
||||
|
||||
if (info.Mode != MUXC::TwoPaneViewMode::SinglePane)
|
||||
{
|
||||
Rect rc1 = info.Regions[0];
|
||||
Rect rc2 = info.Regions[1];
|
||||
|
||||
if (info.Mode == MUXC::TwoPaneViewMode::Wide)
|
||||
{
|
||||
// Check that the control is over the split
|
||||
if (rcControl.X < rc1.Width && rcControl.X + rcControl.Width > rc2.X)
|
||||
{
|
||||
isInMultipleRegions = true;
|
||||
}
|
||||
}
|
||||
else if (info.Mode == MUXC::TwoPaneViewMode::Tall)
|
||||
{
|
||||
// Check that the control is over the split
|
||||
if (rcControl.Y < rc1.Height && rcControl.Y + rcControl.Height > rc2.Y)
|
||||
{
|
||||
isInMultipleRegions = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isInMultipleRegions;
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnSizeChanged(Platform::Object ^ /*sender*/, Windows::UI::Xaml::SizeChangedEventArgs ^ /*e*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnWindowSizeChanged(Platform::Object ^ /*sender*/, Windows::UI::Core::WindowSizeChangedEventArgs ^ /*e*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnPane1LengthPropertyChanged(GridLength /*oldValue*/, GridLength /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnPane2LengthPropertyChanged(GridLength /*oldValue*/, GridLength /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnPane1MinLengthPropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnPane2MinLengthPropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnPane1MaxLengthPropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnPane2MaxLengthPropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnMinTallModeHeightPropertyChanged(double /*oldValue*/, double newValue)
|
||||
{
|
||||
auto clampedValue = max(0.0, newValue);
|
||||
if (clampedValue != newValue)
|
||||
{
|
||||
this->MinTallModeHeight = clampedValue;
|
||||
return;
|
||||
}
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnMinWideModeWidthPropertyChanged(double /*oldValue*/, double newValue)
|
||||
{
|
||||
auto clampedValue = max(0.0, newValue);
|
||||
if (clampedValue != newValue)
|
||||
{
|
||||
this->MinWideModeWidth = clampedValue;
|
||||
return;
|
||||
}
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnWideModeConfigurationPropertyChanged(
|
||||
MUXC::TwoPaneViewWideModeConfiguration /*oldValue*/,
|
||||
MUXC::TwoPaneViewWideModeConfiguration /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnTallModeConfigurationPropertyChanged(
|
||||
MUXC::TwoPaneViewTallModeConfiguration /*oldValue*/,
|
||||
MUXC::TwoPaneViewTallModeConfiguration /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnPanePriorityPropertyChanged(MUXC::TwoPaneViewPriority /*oldValue*/, MUXC::TwoPaneViewPriority /*newValue*/)
|
||||
{
|
||||
this->UpdateMode();
|
||||
}
|
||||
|
||||
TwoPaneViewCX::DisplayRegionHelperInfo TwoPaneViewCX::GetDisplayRegionHelperInfo()
|
||||
{
|
||||
DisplayRegionHelperInfo info;
|
||||
info.Mode = MUXC::TwoPaneViewMode::SinglePane;
|
||||
|
||||
if (!Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.UI.ViewManagement.ApplicationView", L"GetDisplayRegions"))
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
// ApplicationView::GetForCurrentView throws on failure; in that case we just won't do anything.
|
||||
ApplicationView ^ view;
|
||||
try
|
||||
{
|
||||
view = ApplicationView::GetForCurrentView();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
if (view && (int)view->ViewMode == 2 /*ApplicationViewMode::Spanning*/)
|
||||
{
|
||||
auto regions = view->GetDisplayRegions();
|
||||
if (regions->Size == 2)
|
||||
{
|
||||
auto region1 = regions->GetAt(0);
|
||||
auto region2 = regions->GetAt(1);
|
||||
info.Regions = ref new Array<Rect>(2);
|
||||
info.Regions[0] = RectHelper::FromCoordinatesAndDimensions(
|
||||
region1->WorkAreaOffset.X, region1->WorkAreaOffset.Y, region1->WorkAreaSize.Width, region1->WorkAreaSize.Height);
|
||||
info.Regions[1] = RectHelper::FromCoordinatesAndDimensions(
|
||||
region2->WorkAreaOffset.X, region2->WorkAreaOffset.Y, region2->WorkAreaSize.Width, region2->WorkAreaSize.Height);
|
||||
|
||||
// Determine orientation. If neither of these are true, default to doing nothing.
|
||||
if (info.Regions[0].X < info.Regions[1].X && info.Regions[0].Y == info.Regions[1].Y)
|
||||
{
|
||||
// Double portrait
|
||||
info.Mode = MUXC::TwoPaneViewMode::Wide;
|
||||
}
|
||||
else if (info.Regions[0].X == info.Regions[1].X && info.Regions[0].Y < info.Regions[1].Y)
|
||||
{
|
||||
// Double landscape
|
||||
info.Mode = MUXC::TwoPaneViewMode::Tall;
|
||||
}
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::SetScrollViewerProperties(String ^ scrollViewerName)
|
||||
{
|
||||
if (ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7))
|
||||
{
|
||||
if (auto scrollViewer = dynamic_cast<ScrollViewer ^>(this->GetTemplateChild(scrollViewerName)))
|
||||
{
|
||||
if (ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Controls.ScrollContentPresenter", L"SizesContentToTemplatedParent"))
|
||||
{
|
||||
scrollViewer->Loaded += ref new RoutedEventHandler(this, &TwoPaneViewCX::OnScrollViewerLoaded);
|
||||
}
|
||||
|
||||
if (ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Controls.ScrollViewer", L"ReduceViewportForCoreInputViewOcclusions"))
|
||||
{
|
||||
scrollViewer->ReduceViewportForCoreInputViewOcclusions = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TwoPaneViewCX::OnScrollViewerLoaded(Object ^ sender, RoutedEventArgs ^ e)
|
||||
{
|
||||
if (auto scrollViewer = dynamic_cast<FrameworkElement ^>(sender))
|
||||
{
|
||||
auto scrollContentPresenterFE = VisualTree::FindDescendantByName(scrollViewer, L"ScrollContentPresenter");
|
||||
if (scrollContentPresenterFE)
|
||||
{
|
||||
if (auto scrollContentPresenter = dynamic_cast<ScrollContentPresenter ^>(scrollContentPresenterFE))
|
||||
{
|
||||
scrollContentPresenter->SizesContentToTemplatedParent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
|
||||
#pragma once
|
||||
#include "CalcViewModel/Common/Utils.h"
|
||||
|
||||
namespace CalculatorApp::Controls
|
||||
{
|
||||
ref class TwoPaneViewCX;
|
||||
public
|
||||
interface class ITwoPaneViewCX
|
||||
{
|
||||
event Windows::Foundation::TypedEventHandler<TwoPaneViewCX ^, Object ^> ^ ModeChanged;
|
||||
};
|
||||
|
||||
// We can't use the TwoPaneView control from the SDK or from Microsoft.UI.Xaml because of a bug with C++ apps.
|
||||
// (see this issue: https://github.com/microsoft/microsoft-ui-xaml/pull/2045)
|
||||
// This class is a C++/CX port of the C++/WinRT version of Microsoft.UI.Xaml (commit b3a2e45) which include the patch to fix the crash.
|
||||
// This fork adds also 4 new properties Pane1MinLength, Pane2MinLength, Pane1MaxLength, Pane2MaxLength
|
||||
public
|
||||
ref class TwoPaneViewCX sealed : public Windows::UI::Xaml::Controls::Control, [Windows::Foundation::Metadata::Default] ITwoPaneViewCX
|
||||
{
|
||||
enum class ViewMode
|
||||
{
|
||||
Pane1Only,
|
||||
Pane2Only,
|
||||
LeftRight,
|
||||
RightLeft,
|
||||
TopBottom,
|
||||
BottomTop,
|
||||
None
|
||||
};
|
||||
|
||||
struct DisplayRegionHelperInfo
|
||||
{
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewMode Mode = Microsoft::UI::Xaml::Controls::TwoPaneViewMode::SinglePane;
|
||||
Platform::Array<Windows::Foundation::Rect> ^ Regions;
|
||||
};
|
||||
|
||||
public:
|
||||
DEPENDENCY_PROPERTY_OWNER(TwoPaneViewCX);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::UIElement ^, Pane1);
|
||||
DEPENDENCY_PROPERTY(Windows::UI::Xaml::UIElement ^, Pane2);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(
|
||||
Windows::UI::Xaml::GridLength,
|
||||
Pane1Length,
|
||||
Windows::UI::Xaml::GridLengthHelper::FromValueAndType(1, Windows::UI::Xaml::GridUnitType::Auto));
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(
|
||||
Windows::UI::Xaml::GridLength,
|
||||
Pane2Length,
|
||||
Windows::UI::Xaml::GridLengthHelper::FromValueAndType(1, Windows::UI::Xaml::GridUnitType::Star));
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, Pane1MinLength, 0.0);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, Pane2MinLength, 0.0);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, Pane1MaxLength, std::numeric_limits<double>::max());
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, Pane2MaxLength, std::numeric_limits<double>::max());
|
||||
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(Microsoft::UI::Xaml::Controls::TwoPaneViewPriority,
|
||||
PanePriority,
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewPriority::Pane1);
|
||||
DEPENDENCY_PROPERTY(Microsoft::UI::Xaml::Controls::TwoPaneViewMode, Mode);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewWideModeConfiguration,
|
||||
WideModeConfiguration,
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewWideModeConfiguration::LeftRight);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewTallModeConfiguration,
|
||||
TallModeConfiguration,
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewTallModeConfiguration::TopBottom);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MinWideModeWidth, 641);
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MinTallModeHeight, 641);
|
||||
|
||||
TwoPaneViewCX();
|
||||
virtual ~TwoPaneViewCX();
|
||||
void OnApplyTemplate() override;
|
||||
virtual event Windows::Foundation::TypedEventHandler<TwoPaneViewCX ^, Object ^> ^ ModeChanged;
|
||||
|
||||
private:
|
||||
void UpdateRowsColumns(ViewMode newMode, DisplayRegionHelperInfo info, Windows::Foundation::Rect rcControl);
|
||||
void UpdateMode();
|
||||
bool IsInMultipleRegions(DisplayRegionHelperInfo info, Windows::Foundation::Rect rcControl);
|
||||
void SetScrollViewerProperties(Platform::String ^ scrollViewerName);
|
||||
Windows::Foundation::Rect GetControlRect();
|
||||
DisplayRegionHelperInfo GetDisplayRegionHelperInfo();
|
||||
|
||||
void OnSizeChanged(Platform::Object ^ sender, Windows::UI::Xaml::SizeChangedEventArgs ^ e);
|
||||
void OnWindowSizeChanged(Platform::Object ^ sender, Windows::UI::Core::WindowSizeChangedEventArgs ^ e);
|
||||
void OnPane1LengthPropertyChanged(Windows::UI::Xaml::GridLength oldValue, Windows::UI::Xaml::GridLength newValue);
|
||||
void OnPane2LengthPropertyChanged(Windows::UI::Xaml::GridLength oldValue, Windows::UI::Xaml::GridLength newValue);
|
||||
void OnPane1MinLengthPropertyChanged(double oldValue, double newValue);
|
||||
void OnPane2MinLengthPropertyChanged(double oldValue, double newValue);
|
||||
void OnPane1MaxLengthPropertyChanged(double oldValue, double newValue);
|
||||
void OnPane2MaxLengthPropertyChanged(double oldValue, double newValue);
|
||||
void
|
||||
OnPanePriorityPropertyChanged(Microsoft::UI::Xaml::Controls::TwoPaneViewPriority oldValue, Microsoft::UI::Xaml::Controls::TwoPaneViewPriority newValue);
|
||||
void OnMinTallModeHeightPropertyChanged(double oldValue, double newValue);
|
||||
void OnMinWideModeWidthPropertyChanged(double oldValue, double newValue);
|
||||
void OnWideModeConfigurationPropertyChanged(
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewWideModeConfiguration oldValue,
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewWideModeConfiguration newValue);
|
||||
void OnTallModeConfigurationPropertyChanged(
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewTallModeConfiguration oldValue,
|
||||
Microsoft::UI::Xaml::Controls::TwoPaneViewTallModeConfiguration newValue);
|
||||
void OnScrollViewerLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
private:
|
||||
Windows::UI::Xaml::Controls::ColumnDefinition ^ m_columnLeft;
|
||||
Windows::UI::Xaml::Controls::ColumnDefinition ^ m_columnMiddle;
|
||||
Windows::UI::Xaml::Controls::ColumnDefinition ^ m_columnRight;
|
||||
Windows::UI::Xaml::Controls::RowDefinition ^ m_rowTop;
|
||||
Windows::UI::Xaml::Controls::RowDefinition ^ m_rowMiddle;
|
||||
Windows::UI::Xaml::Controls::RowDefinition ^ m_rowBottom;
|
||||
Windows::Foundation::EventRegistrationToken m_windowSizeChangedToken;
|
||||
ViewMode m_currentMode{ ViewMode::None };
|
||||
bool m_loaded{ false };
|
||||
};
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
<Logo>Assets\CalculatorStoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17133.0" MaxVersionTested="10.0.19400.0" />
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17133.0" MaxVersionTested="10.0.18362.0" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -675,10 +675,6 @@ void Calculator::UnregisterEventHandlers()
|
||||
{
|
||||
ExpressionText->UnregisterEventHandlers();
|
||||
AlwaysOnTopResults->UnregisterEventHandlers();
|
||||
if (DualScreenExpressionText != nullptr)
|
||||
{
|
||||
DualScreenExpressionText->UnregisterEventHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
void Calculator::OnErrorVisualStateCompleted(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e)
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "Views/Memory.xaml.h"
|
||||
#include "Views/OperatorsPanel.xaml.h"
|
||||
#include "Views/StateTriggers/ControlSizeTrigger.h"
|
||||
#include "Views/StateTriggers/ApplicationViewModeTrigger.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
|
@ -856,7 +856,7 @@
|
||||
<Flyout x:Uid="ColorChooserFlyout" Placement="Bottom">
|
||||
<local:EquationStylePanelControl EnableLineStylePicker="{x:Bind GraphEquation.IsInequality, Converter={StaticResource BooleanNegationConverter}, Mode=OneWay}"
|
||||
SelectedColor="{x:Bind LineColor, Mode=TwoWay}"
|
||||
SelectedColorIndex="{x:Bind LineColorIndex , Mode=TwoWay}"
|
||||
SelectedColorIndex="{x:Bind LineColorIndex, Mode=TwoWay}"
|
||||
SelectedStyle="{x:Bind GraphEquation.EquationStyle, Mode=TwoWay}"/>
|
||||
</Flyout>
|
||||
</controls:EquationTextBox.ColorChooserFlyout>
|
||||
|
@ -2,14 +2,11 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
|
||||
xmlns:controls="using:CalculatorApp.Controls"
|
||||
xmlns:converters="using:CalculatorApp.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:graphControl="using:GraphControl"
|
||||
xmlns:local="using:CalculatorApp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:states="using:CalculatorApp.Views.StateTriggers"
|
||||
x:Name="Control"
|
||||
DataContextChanged="GraphingCalculator_DataContextChanged"
|
||||
mc:Ignorable="d">
|
||||
@ -296,7 +293,7 @@
|
||||
<Color x:Key="DarkThemeGridLinesColor">#4F4F4F</Color>
|
||||
|
||||
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
||||
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Default">
|
||||
<Style x:Key="ThemedSwitchModeToggleButtonStyle"
|
||||
@ -349,16 +346,13 @@
|
||||
</Style>
|
||||
<Style x:Key="ThemedGraphRepeatButtonStyle"
|
||||
BasedOn="{StaticResource GraphRepeatButtonStyle}"
|
||||
TargetType="RepeatButton">
|
||||
</Style>
|
||||
TargetType="RepeatButton"/>
|
||||
<Style x:Key="ThemedGraphButtonStyle"
|
||||
BasedOn="{StaticResource GraphButtonStyle}"
|
||||
TargetType="Button">
|
||||
</Style>
|
||||
TargetType="Button"/>
|
||||
<Style x:Key="ThemedGraphToggleButtonStyle"
|
||||
BasedOn="{StaticResource GraphToggleButtonStyle}"
|
||||
TargetType="ToggleButton">
|
||||
</Style>
|
||||
TargetType="ToggleButton"/>
|
||||
<Style x:Key="GraphTooltipStyle" TargetType="Border">
|
||||
<Setter Property="Background" Value="{ThemeResource SystemControlAcrylicElementBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="#e0e0e0"/>
|
||||
@ -405,60 +399,26 @@
|
||||
<RowDefinition Height="{StaticResource HamburgerHeightGridLength}"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"
|
||||
MinWidth="300"
|
||||
MaxWidth="420"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<states:ApplicationViewModeTrigger ViewMode="DoubleLandscape"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="KeyGraphFeaturesControl.(Grid.Row)" Value="0"/>
|
||||
<Setter Target="EquationInputAreaControl.(Grid.Row)" Value="0"/>
|
||||
<Setter Target="GraphingNumPad.(Grid.Row)" Value="0"/>
|
||||
<Setter Target="KeyGraphFeaturesControl.(Grid.RowSpan)" Value="2"/>
|
||||
<Setter Target="EquationInputAreaControl.(Grid.RowSpan)" Value="2"/>
|
||||
<Setter Target="GraphingNumPad.(Grid.RowSpan)" Value="2"/>
|
||||
<Setter Target="KeyGraphFeaturesControl.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="EquationInputAreaControl.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="GraphingNumPad.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="KeyGraphFeaturesControl.(Grid.ColumnSpan)" Value="1"/>
|
||||
<Setter Target="EquationInputAreaControl.(Grid.ColumnSpan)" Value="1"/>
|
||||
<Setter Target="GraphingNumPad.(Grid.ColumnSpan)" Value="1"/>
|
||||
<Setter Target="RightGrid.Margin" Value="24"/>
|
||||
<Setter Target="GraphingNumPad.Margin" Value="0,0,24,0"/>
|
||||
<Setter Target="KeyGraphFeaturesControl.Margin" Value="0,40,0,0"/>
|
||||
<Setter Target="EquationInputAreaControl.Margin" Value="0,40,0,0"/>
|
||||
<Setter Target="PaneView.TallModeConfiguration">
|
||||
<Setter.Value>
|
||||
<muxc:TwoPaneViewTallModeConfiguration>TopBottom</muxc:TwoPaneViewTallModeConfiguration>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<states:ApplicationViewModeTrigger ViewMode="DoublePortrait"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="RightGrid.Margin" Value="24,0,24,24"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState>
|
||||
<VisualStateGroup CurrentStateChanged="OnVisualStateChanged">
|
||||
<VisualState x:Name="ColumnsState">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="800"/>
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState>
|
||||
<VisualState x:Name="SmallState">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="0"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Control.IsSmallState" Value="True"/>
|
||||
<Setter Target="PaneView.WideModeConfiguration">
|
||||
<Setter.Value>
|
||||
<muxc:TwoPaneViewWideModeConfiguration>SinglePane</muxc:TwoPaneViewWideModeConfiguration>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Target="LeftGrid.(Grid.ColumnSpan)" Value="2"/>
|
||||
<Setter Target="RightGrid.(Grid.ColumnSpan)" Value="2"/>
|
||||
<Setter Target="RightGrid.(Grid.Column)" Value="0"/>
|
||||
<Setter Target="SwitchModeToggleButton.Visibility" Value="Visible"/>
|
||||
@ -490,225 +450,218 @@
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<!-- Top panel -->
|
||||
<ToggleSwitch x:Name="SwitchModeToggleButton"
|
||||
x:Uid="SwitchModeToggleButton"
|
||||
Margin="0,0,12,2"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource GraphModeToggleSwitchStyle}"
|
||||
AutomationProperties.AutomationId="SwitchModeToggleButton"
|
||||
AutomationProperties.Name="{x:Bind local:GraphingCalculator.GetInfoForSwitchModeToggleButton(SwitchModeToggleButton.IsOn), Mode=OneWay}"
|
||||
Toggled="SwitchModeToggleButton_Toggled"
|
||||
ToolTipService.ToolTip="{x:Bind local:GraphingCalculator.GetInfoForSwitchModeToggleButton(SwitchModeToggleButton.IsOn), Mode=OneWay}"
|
||||
Visibility="Collapsed"/>
|
||||
|
||||
<controls:TwoPaneViewCX x:Name="PaneView"
|
||||
Grid.Row="1"
|
||||
MinTallModeHeight="Infinity"
|
||||
MinWideModeWidth="0"
|
||||
Pane1Length="2*"
|
||||
Pane2Length="1*"
|
||||
Pane2MaxLength="420"
|
||||
Pane2MinLength="300"
|
||||
PanePriority="{x:Bind local:GraphingCalculator.GetPanePriority(SwitchModeToggleButton.IsOn), Mode=OneWay}"
|
||||
TallModeConfiguration="SinglePane">
|
||||
<controls:TwoPaneViewCX.Pane1>
|
||||
<Grid x:Name="LeftGrid" Padding="0,4,0,0">
|
||||
<Grid.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#10000000"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#20000000"/>
|
||||
<SolidColorBrush x:Key="RepeatButtonBackgroundPointerOver" Color="#10000000"/>
|
||||
<SolidColorBrush x:Key="RepeatButtonBackgroundPressed" Color="#20000000"/>
|
||||
<CornerRadius x:Key="TopButtonCornerRadius">4,4,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="BottomButtonCornerRadius">0,0,4,4</CornerRadius>
|
||||
<CornerRadius x:Key="LeftButtonCornerRadius">4,0,0,4</CornerRadius>
|
||||
<CornerRadius x:Key="RightButtonCornerRadius">0,4,4,0</CornerRadius>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<CornerRadius x:Key="TopButtonCornerRadius">4,4,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="BottomButtonCornerRadius">0,0,4,4</CornerRadius>
|
||||
<CornerRadius x:Key="LeftButtonCornerRadius">4,0,0,4</CornerRadius>
|
||||
<CornerRadius x:Key="RightButtonCornerRadius">0,4,4,0</CornerRadius>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<CornerRadius x:Key="TopButtonCornerRadius">0</CornerRadius>
|
||||
<CornerRadius x:Key="BottomButtonCornerRadius">0</CornerRadius>
|
||||
<CornerRadius x:Key="LeftButtonCornerRadius">0</CornerRadius>
|
||||
<CornerRadius x:Key="RightButtonCornerRadius">0</CornerRadius>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
<Grid Grid.ColumnSpan="2">
|
||||
<ToggleSwitch x:Name="SwitchModeToggleButton"
|
||||
x:Uid="SwitchModeToggleButton"
|
||||
Margin="0,0,12,2"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource GraphModeToggleSwitchStyle}"
|
||||
AutomationProperties.AutomationId="SwitchModeToggleButton"
|
||||
AutomationProperties.Name="{x:Bind local:GraphingCalculator.GetInfoForSwitchModeToggleButton(SwitchModeToggleButton.IsOn), Mode=OneWay}"
|
||||
Toggled="SwitchModeToggleButton_Toggled"
|
||||
ToolTipService.ToolTip="{x:Bind local:GraphingCalculator.GetInfoForSwitchModeToggleButton(SwitchModeToggleButton.IsOn), Mode=OneWay}"
|
||||
Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
<!-- Left portion of the screen -->
|
||||
<Grid x:Name="LeftGrid"
|
||||
Grid.Row="1"
|
||||
Padding="0,4,0,0"
|
||||
Visibility="{x:Bind ShouldDisplayPanel(IsSmallState, SwitchModeToggleButton.IsOn, x:True), Mode=OneWay}">
|
||||
<Grid.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="#10000000"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="#20000000"/>
|
||||
<SolidColorBrush x:Key="RepeatButtonBackgroundPointerOver" Color="#10000000"/>
|
||||
<SolidColorBrush x:Key="RepeatButtonBackgroundPressed" Color="#20000000"/>
|
||||
<CornerRadius x:Key="TopButtonCornerRadius">4,4,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="BottomButtonCornerRadius">0,0,4,4</CornerRadius>
|
||||
<CornerRadius x:Key="LeftButtonCornerRadius">4,0,0,4</CornerRadius>
|
||||
<CornerRadius x:Key="RightButtonCornerRadius">0,4,4,0</CornerRadius>
|
||||
</ResourceDictionary>
|
||||
</Grid.Resources>
|
||||
<graphControl:Grapher Name="GraphingControl"
|
||||
AutomationProperties.Name="{x:Bind GraphControlAutomationName, Mode=OneWay}"
|
||||
ForceProportionalAxes="False"
|
||||
GraphPlottedEvent="GraphingControl_GraphPlottedEvent"
|
||||
GraphViewChangedEvent="GraphingControl_GraphViewChangedEvent"
|
||||
LosingFocus="GraphingControl_LosingFocus"
|
||||
LostFocus="GraphingControl_LostFocus"
|
||||
RequestedTheme="Light"
|
||||
UseSystemFocusVisuals="True"
|
||||
VariablesUpdated="GraphingControl_VariablesUpdated">
|
||||
<graphControl:Grapher.ContextFlyout>
|
||||
<MenuFlyout Placement="Bottom">
|
||||
<MenuFlyoutItem x:Uid="GraphCopyMenuItem"
|
||||
Click="GraphMenuFlyoutItem_Click"
|
||||
Icon="Copy"/>
|
||||
</MenuFlyout>
|
||||
</graphControl:Grapher.ContextFlyout>
|
||||
</graphControl:Grapher>
|
||||
<Border MinHeight="36"
|
||||
Margin="0,12,12,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{ThemeResource GraphControlCommandPanel}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ToggleButton x:Name="ActiveTracing"
|
||||
MinWidth="40"
|
||||
Margin="0,-1"
|
||||
Style="{ThemeResource ThemedGraphToggleButtonStyle}"
|
||||
contract7Present:CornerRadius="{ThemeResource LeftButtonCornerRadius}"
|
||||
AutomationProperties.Name="{x:Bind local:GraphingCalculator.GetTracingLegend(GraphingControl.ActiveTracing), Mode=OneWay}"
|
||||
Checked="ActiveTracing_Checked"
|
||||
IsChecked="{x:Bind GraphingControl.ActiveTracing, Mode=TwoWay}"
|
||||
Unchecked="ActiveTracing_Unchecked">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{x:Bind ActiveTracing.(AutomationProperties.Name), Mode=OneWay}"/>
|
||||
</ToolTipService.ToolTip>
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
|
||||
FontSize="18"
|
||||
Glyph=""/>
|
||||
</ToggleButton>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<CornerRadius x:Key="TopButtonCornerRadius">4,4,0,0</CornerRadius>
|
||||
<CornerRadius x:Key="BottomButtonCornerRadius">0,0,4,4</CornerRadius>
|
||||
<CornerRadius x:Key="LeftButtonCornerRadius">4,0,0,4</CornerRadius>
|
||||
<CornerRadius x:Key="RightButtonCornerRadius">0,4,4,0</CornerRadius>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<CornerRadius x:Key="TopButtonCornerRadius">0</CornerRadius>
|
||||
<CornerRadius x:Key="BottomButtonCornerRadius">0</CornerRadius>
|
||||
<CornerRadius x:Key="LeftButtonCornerRadius">0</CornerRadius>
|
||||
<CornerRadius x:Key="RightButtonCornerRadius">0</CornerRadius>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Grid.Resources>
|
||||
<graphControl:Grapher Name="GraphingControl"
|
||||
AutomationProperties.Name="{x:Bind GraphControlAutomationName, Mode=OneWay}"
|
||||
ForceProportionalAxes="False"
|
||||
GraphPlottedEvent="GraphingControl_GraphPlottedEvent"
|
||||
GraphViewChangedEvent="GraphingControl_GraphViewChangedEvent"
|
||||
LosingFocus="GraphingControl_LosingFocus"
|
||||
LostFocus="GraphingControl_LostFocus"
|
||||
RequestedTheme="Light"
|
||||
UseSystemFocusVisuals="True"
|
||||
VariablesUpdated="GraphingControl_VariablesUpdated">
|
||||
<graphControl:Grapher.ContextFlyout>
|
||||
<MenuFlyout Placement="Bottom">
|
||||
<MenuFlyoutItem x:Uid="GraphCopyMenuItem"
|
||||
Click="GraphMenuFlyoutItem_Click"
|
||||
Icon="Copy"/>
|
||||
</MenuFlyout>
|
||||
</graphControl:Grapher.ContextFlyout>
|
||||
</graphControl:Grapher>
|
||||
<Border MinHeight="36"
|
||||
Margin="0,12,12,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{ThemeResource GraphControlCommandPanel}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ToggleButton x:Name="ActiveTracing"
|
||||
MinWidth="40"
|
||||
Margin="0,-1"
|
||||
Style="{ThemeResource ThemedGraphToggleButtonStyle}"
|
||||
contract7Present:CornerRadius="{ThemeResource LeftButtonCornerRadius}"
|
||||
AutomationProperties.Name="{x:Bind local:GraphingCalculator.GetTracingLegend(GraphingControl.ActiveTracing), Mode=OneWay}"
|
||||
Checked="ActiveTracing_Checked"
|
||||
IsChecked="{x:Bind GraphingControl.ActiveTracing, Mode=TwoWay}"
|
||||
Unchecked="ActiveTracing_Unchecked">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{x:Bind ActiveTracing.(AutomationProperties.Name), Mode=OneWay}"/>
|
||||
</ToolTipService.ToolTip>
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
|
||||
FontSize="18"
|
||||
Glyph=""/>
|
||||
</ToggleButton>
|
||||
|
||||
<Button x:Uid="shareButton"
|
||||
MinWidth="40"
|
||||
Style="{ThemeResource ThemedGraphButtonStyle}"
|
||||
Click="OnShareClick">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="18"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
<Button x:Uid="shareButton"
|
||||
MinWidth="40"
|
||||
Style="{ThemeResource ThemedGraphButtonStyle}"
|
||||
Click="OnShareClick">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="18"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="GraphSettingsButton"
|
||||
x:Uid="graphSettingsButton"
|
||||
MinWidth="40"
|
||||
Style="{ThemeResource ThemedGraphButtonStyle}"
|
||||
contract7Present:CornerRadius="{ThemeResource RightButtonCornerRadius}"
|
||||
Click="GraphSettingsButton_Click">
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
|
||||
FontSize="18"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Canvas x:Name="TraceCanvas"
|
||||
SizeChanged="Canvas_SizeChanged"
|
||||
x:Load="False">
|
||||
<Grid x:Name="TracePointer" Visibility="Collapsed">
|
||||
<Border x:Name="CursorShadow"/>
|
||||
<Path x:Name="CursorPath"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Style="{ThemeResource TracePointerPathStyle}"
|
||||
Data="M0 0 l1371 1371 H538 l-538 538 Z"
|
||||
Stretch="Uniform"/>
|
||||
</Grid>
|
||||
</Canvas>
|
||||
<Border MinWidth="36"
|
||||
Margin="0,0,12,12"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Style="{ThemeResource GraphControlCommandPanel}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<RepeatButton x:Name="ZoomInButton"
|
||||
x:Uid="zoomInButton"
|
||||
MinHeight="40"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{ThemeResource ThemedGraphRepeatButtonStyle}"
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
contract7Present:CornerRadius="{ThemeResource TopButtonCornerRadius}"
|
||||
AutomationProperties.AutomationId="zoomInButton"
|
||||
Command="{x:Bind ZoomInButtonPressed, Mode=OneTime}">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Glyph=""/>
|
||||
<RepeatButton.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="Add" Modifiers="Control"/>
|
||||
</RepeatButton.KeyboardAccelerators>
|
||||
</RepeatButton>
|
||||
|
||||
<RepeatButton x:Name="ZoomOutButton"
|
||||
x:Uid="zoomOutButton"
|
||||
MinHeight="40"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{ThemeResource ThemedGraphRepeatButtonStyle}"
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
AutomationProperties.AutomationId="zoomOutButton"
|
||||
Command="{x:Bind ZoomOutButtonPressed, Mode=OneTime}">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Glyph=""/>
|
||||
<RepeatButton.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="Subtract" Modifiers="Control"/>
|
||||
</RepeatButton.KeyboardAccelerators>
|
||||
</RepeatButton>
|
||||
|
||||
<Button x:Uid="zoomResetButton"
|
||||
MinHeight="40"
|
||||
Style="{ThemeResource ThemedGraphButtonStyle}"
|
||||
contract7Present:CornerRadius="{ThemeResource BottomButtonCornerRadius}"
|
||||
AutomationProperties.AutomationId="zoomResetButton"
|
||||
Command="{x:Bind ZoomResetButtonPressed, Mode=OneTime}">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Glyph=""/>
|
||||
<Button.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="Number0" Modifiers="Control"/>
|
||||
</Button.KeyboardAccelerators>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border x:Name="TraceValuePopup"
|
||||
Padding="{ThemeResource ToolTipBorderThemePadding}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Style="{ThemeResource GraphTooltipStyle}"
|
||||
IsHitTestVisible="False"
|
||||
SizeChanged="TraceValuePopup_SizeChanged"
|
||||
Visibility="Collapsed">
|
||||
<Border.RenderTransform>
|
||||
<TranslateTransform x:Name="TraceValuePopupTransform"/>
|
||||
</Border.RenderTransform>
|
||||
<TextBlock x:Name="TraceValue"
|
||||
Foreground="{ThemeResource ToolTipForeground}"
|
||||
FontSize="{ThemeResource ToolTipContentThemeFontSize}"
|
||||
AutomationProperties.LiveSetting="Polite"/>
|
||||
</Border>
|
||||
<Button x:Name="GraphSettingsButton"
|
||||
x:Uid="graphSettingsButton"
|
||||
MinWidth="40"
|
||||
Style="{ThemeResource ThemedGraphButtonStyle}"
|
||||
contract7Present:CornerRadius="{ThemeResource RightButtonCornerRadius}"
|
||||
Click="GraphSettingsButton_Click">
|
||||
<FontIcon FontFamily="{StaticResource CalculatorFontFamily}"
|
||||
FontSize="18"
|
||||
Glyph=""/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Canvas x:Name="TraceCanvas"
|
||||
SizeChanged="Canvas_SizeChanged"
|
||||
x:Load="False">
|
||||
<Grid x:Name="TracePointer" Visibility="Collapsed">
|
||||
<Border x:Name="CursorShadow"/>
|
||||
<Path x:Name="CursorPath"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Style="{ThemeResource TracePointerPathStyle}"
|
||||
Data="M0 0 l1371 1371 H538 l-538 538 Z"
|
||||
Stretch="Uniform"/>
|
||||
</Grid>
|
||||
</controls:TwoPaneViewCX.Pane1>
|
||||
<controls:TwoPaneViewCX.Pane2>
|
||||
<Grid x:Name="RightGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="2.2*" MaxHeight="400"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Canvas>
|
||||
<Border MinWidth="36"
|
||||
Margin="0,0,12,12"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Style="{ThemeResource GraphControlCommandPanel}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<RepeatButton x:Name="ZoomInButton"
|
||||
x:Uid="zoomInButton"
|
||||
MinHeight="40"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{ThemeResource ThemedGraphRepeatButtonStyle}"
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
contract7Present:CornerRadius="{ThemeResource TopButtonCornerRadius}"
|
||||
AutomationProperties.AutomationId="zoomInButton"
|
||||
Command="{x:Bind ZoomInButtonPressed, Mode=OneTime}">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Glyph=""/>
|
||||
<RepeatButton.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="Add" Modifiers="Control"/>
|
||||
</RepeatButton.KeyboardAccelerators>
|
||||
</RepeatButton>
|
||||
|
||||
<!-- 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"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,4,0,0"
|
||||
KeyGraphFeaturesClosed="OnKeyGraphFeaturesClosed"
|
||||
ViewModel="{x:Bind ViewModel.SelectedEquation, Mode=OneWay}"
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"
|
||||
x:Load="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"/>
|
||||
<RepeatButton x:Name="ZoomOutButton"
|
||||
x:Uid="zoomOutButton"
|
||||
MinHeight="40"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{ThemeResource ThemedGraphRepeatButtonStyle}"
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
AutomationProperties.AutomationId="zoomOutButton"
|
||||
Command="{x:Bind ZoomOutButtonPressed, Mode=OneTime}">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Glyph=""/>
|
||||
<RepeatButton.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="Subtract" Modifiers="Control"/>
|
||||
</RepeatButton.KeyboardAccelerators>
|
||||
</RepeatButton>
|
||||
|
||||
<Button x:Uid="zoomResetButton"
|
||||
MinHeight="40"
|
||||
Style="{ThemeResource ThemedGraphButtonStyle}"
|
||||
contract7Present:CornerRadius="{ThemeResource BottomButtonCornerRadius}"
|
||||
AutomationProperties.AutomationId="zoomResetButton"
|
||||
Command="{x:Bind ZoomResetButtonPressed, Mode=OneTime}">
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Glyph=""/>
|
||||
<Button.KeyboardAccelerators>
|
||||
<KeyboardAccelerator Key="Number0" Modifiers="Control"/>
|
||||
</Button.KeyboardAccelerators>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border x:Name="TraceValuePopup"
|
||||
Padding="{ThemeResource ToolTipBorderThemePadding}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Style="{ThemeResource GraphTooltipStyle}"
|
||||
IsHitTestVisible="False"
|
||||
SizeChanged="TraceValuePopup_SizeChanged"
|
||||
Visibility="Collapsed">
|
||||
<Border.RenderTransform>
|
||||
<TranslateTransform x:Name="TraceValuePopupTransform"/>
|
||||
</Border.RenderTransform>
|
||||
<TextBlock x:Name="TraceValue"
|
||||
Foreground="{ThemeResource ToolTipForeground}"
|
||||
FontSize="{ThemeResource ToolTipContentThemeFontSize}"
|
||||
AutomationProperties.LiveSetting="Polite"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Right portion of the screen -->
|
||||
<Grid x:Name="RightGrid"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Visibility="{x:Bind local:GraphingCalculator.ShouldDisplayPanel(IsSmallState, SwitchModeToggleButton.IsOn, x:False), Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="2.2*" MaxHeight="400"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 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"
|
||||
Margin="0,4,0,0"
|
||||
KeyGraphFeaturesClosed="OnKeyGraphFeaturesClosed"
|
||||
ViewModel="{x:Bind ViewModel.SelectedEquation, Mode=OneWay}"
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"
|
||||
x:Load="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"/>
|
||||
|
||||
<!-- This control should be within a grid that limits the height to keep the sticky footer functionality from breaking -->
|
||||
<local:EquationInputArea x:Name="EquationInputAreaControl"
|
||||
@ -716,19 +669,16 @@
|
||||
Margin="0,4,0,0"
|
||||
EquationFormatRequested="OnEquationFormatRequested"
|
||||
Equations="{x:Bind ViewModel.Equations}"
|
||||
IsMatchAppTheme="{x:Bind IsMatchAppTheme, Mode=OneWay}"
|
||||
KeyGraphFeaturesRequested="OnEquationKeyGraphFeaturesRequested"
|
||||
Variables="{x:Bind ViewModel.Variables}"
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"
|
||||
IsMatchAppTheme="{x:Bind IsMatchAppTheme, Mode=OneWay}"/>
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
||||
|
||||
<local:GraphingNumPad x:Name="GraphingNumPad"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="2,0,2,2"
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
||||
<local:GraphingNumPad x:Name="GraphingNumPad"
|
||||
Grid.Row="1"
|
||||
Margin="2,0,2,2"
|
||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Converter={StaticResource BooleanToVisibilityNegationConverter}, Mode=OneWay}"/>
|
||||
|
||||
</Grid>
|
||||
</controls:TwoPaneViewCX.Pane2>
|
||||
</controls:TwoPaneViewCX>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
@ -51,7 +51,6 @@ using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Media::Imaging;
|
||||
using namespace Windows::UI::Popups;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
namespace MUXC = Microsoft::UI::Xaml::Controls;
|
||||
|
||||
constexpr auto sc_ViewModelPropertyName = L"ViewModel";
|
||||
constexpr auto sc_IsGraphThemeMatchApp = L"IsGraphThemeMatchApp";
|
||||
@ -462,9 +461,9 @@ void GraphingCalculator::OnKeyGraphFeaturesClosed(Object ^ sender, RoutedEventAr
|
||||
ViewModel->SelectedEquation->GraphEquation->IsSelected = false;
|
||||
}
|
||||
|
||||
MUXC::TwoPaneViewPriority GraphingCalculator::GetPanePriority(bool isEquationModeActivated)
|
||||
Visibility GraphingCalculator::ShouldDisplayPanel(bool isSmallState, bool isEquationModeActivated, bool isGraphPanel)
|
||||
{
|
||||
return isEquationModeActivated ? MUXC::TwoPaneViewPriority::Pane2 : MUXC::TwoPaneViewPriority::Pane1;
|
||||
return (!isSmallState || isEquationModeActivated ^ isGraphPanel) ? ::Visibility::Visible : ::Visibility::Collapsed;
|
||||
}
|
||||
|
||||
Platform::String ^ GraphingCalculator::GetInfoForSwitchModeToggleButton(bool isChecked)
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include "Views\GraphingCalculator\KeyGraphFeaturesPanel.xaml.h"
|
||||
#include "Views\GraphingCalculator\GraphingNumPad.xaml.h"
|
||||
#include "Views\GraphingCalculator\GraphingSettings.xaml.h"
|
||||
#include "Views\StateTriggers\ApplicationViewModeTrigger.h"
|
||||
#include "Controls\TwoPaneViewCX.h"
|
||||
#include "CalcViewModel\Common\TraceLogger.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
@ -39,7 +37,7 @@ public ref class GraphingCalculator sealed : public Windows::UI::Xaml::Data::INo
|
||||
void set(CalculatorApp::ViewModel::GraphingCalculatorViewModel^ vm);
|
||||
}
|
||||
|
||||
static Microsoft::UI::Xaml::Controls::TwoPaneViewPriority GetPanePriority(bool isEquationModeActivated);
|
||||
static Windows::UI::Xaml::Visibility ShouldDisplayPanel(bool isSmallState, bool isEquationModeActivated, bool isGraphPanel);
|
||||
static Platform::String ^ GetInfoForSwitchModeToggleButton(bool isChecked);
|
||||
static Windows::UI::Xaml::Visibility ManageEditVariablesButtonVisibility(unsigned int numberOfVariables);
|
||||
static Platform::String ^ GetTracingLegend(Platform::IBox<bool> ^ isTracing);
|
||||
|
@ -1,80 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "ApplicationViewModeTrigger.h"
|
||||
using namespace CalculatorApp::Views::StateTriggers;
|
||||
using namespace Windows::System::Profile;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::UI::Xaml;
|
||||
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(ApplicationViewModeTrigger, ViewMode);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(ApplicationViewModeTrigger, MinWindowHeight);
|
||||
DEPENDENCY_PROPERTY_INITIALIZATION(ApplicationViewModeTrigger, MinWindowWidth);
|
||||
|
||||
ApplicationViewModeTrigger::ApplicationViewModeTrigger()
|
||||
{
|
||||
m_windowSizeEventToken = Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &ApplicationViewModeTrigger::WindowSizeChanged);
|
||||
UpdateTrigger();
|
||||
}
|
||||
|
||||
void ApplicationViewModeTrigger::WindowSizeChanged(_In_ Platform::Object ^ /*sender*/, _In_ Windows::UI::Core::WindowSizeChangedEventArgs ^ /*e*/)
|
||||
{
|
||||
// We don't use layout aware page's view states, we have our own
|
||||
UpdateTrigger();
|
||||
}
|
||||
void ApplicationViewModeTrigger::OnViewModePropertyChanged(_In_ AppViewMode /*oldValue*/, _In_ AppViewMode /*newValue*/)
|
||||
{
|
||||
UpdateTrigger();
|
||||
}
|
||||
void ApplicationViewModeTrigger::OnMinWindowHeightPropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||
{
|
||||
UpdateTrigger();
|
||||
}
|
||||
|
||||
void ApplicationViewModeTrigger::OnMinWindowWidthPropertyChanged(double /*oldValue*/, double /*newValue*/)
|
||||
{
|
||||
UpdateTrigger();
|
||||
}
|
||||
|
||||
void ApplicationViewModeTrigger::UpdateTrigger()
|
||||
{
|
||||
auto applicationView = ApplicationView::GetForCurrentView();
|
||||
auto viewMode = applicationView->ViewMode;
|
||||
if (applicationView->VisibleBounds.Width < this->MinWindowWidth || applicationView->VisibleBounds.Height < this->MinWindowHeight)
|
||||
{
|
||||
SetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (static_cast<int>(viewMode))
|
||||
{
|
||||
case 0 /*ApplicationViewMode::Default*/:
|
||||
SetActive(this->ViewMode == AppViewMode::Normal);
|
||||
break;
|
||||
case 1 /*ApplicationViewMode::CompactOverlay*/:
|
||||
SetActive(this->ViewMode == AppViewMode::CompactOverlay);
|
||||
break;
|
||||
case 2 /*ApplicationViewMode::Spanning*/:
|
||||
|
||||
// We will need to update this code to use new SpanningRects API instead of DisplayRegions when the app will use the SDK for windows 10 2004.
|
||||
auto displayRegions = applicationView->GetDisplayRegions();
|
||||
if (displayRegions->Size == 2)
|
||||
{
|
||||
auto display1 = displayRegions->GetAt(0);
|
||||
auto display2 = displayRegions->GetAt(1);
|
||||
if (display1->WorkAreaOffset.X < display2->WorkAreaOffset.X && display1->WorkAreaOffset.Y == display2->WorkAreaOffset.Y)
|
||||
{
|
||||
this->SetActive(this->ViewMode == AppViewMode::DoublePortrait);
|
||||
return;
|
||||
}
|
||||
else if (display1->WorkAreaOffset.X == display2->WorkAreaOffset.X && display1->WorkAreaOffset.Y < display2->WorkAreaOffset.Y)
|
||||
{
|
||||
this->SetActive(this->ViewMode == AppViewMode::DoubleLandscape);
|
||||
return;
|
||||
}
|
||||
}
|
||||
SetActive(this->ViewMode == AppViewMode::Normal);
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
#include "CalcViewModel/Common/Utils.h"
|
||||
|
||||
namespace CalculatorApp::Views::StateTriggers
|
||||
{
|
||||
public
|
||||
enum class AppViewMode
|
||||
{
|
||||
Normal = 0,
|
||||
CompactOverlay = 1,
|
||||
DoublePortrait = 2,
|
||||
DoubleLandscape = 3
|
||||
};
|
||||
|
||||
public
|
||||
ref class ApplicationViewModeTrigger sealed : public Windows::UI::Xaml::StateTriggerBase
|
||||
{
|
||||
public:
|
||||
ApplicationViewModeTrigger();
|
||||
DEPENDENCY_PROPERTY_OWNER(ApplicationViewModeTrigger);
|
||||
|
||||
/* The view mode that will cause the trigger to fire. */
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(AppViewMode, ViewMode, AppViewMode::Normal);
|
||||
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MinWindowHeight, -1);
|
||||
|
||||
DEPENDENCY_PROPERTY_WITH_DEFAULT_AND_CALLBACK(double, MinWindowWidth, -1);
|
||||
private:
|
||||
void OnViewModePropertyChanged(AppViewMode oldValue, AppViewMode newValue);
|
||||
void OnMinWindowHeightPropertyChanged(double oldValue, double newValue);
|
||||
void OnMinWindowWidthPropertyChanged(double oldValue, double newValue);
|
||||
void WindowSizeChanged(_In_ Platform::Object ^ sender, _In_ Windows::UI::Core::WindowSizeChangedEventArgs ^ e);
|
||||
void UpdateTrigger();
|
||||
private:
|
||||
Windows::Foundation::EventRegistrationToken m_windowSizeEventToken;
|
||||
};
|
||||
}
|
@ -5,11 +5,9 @@
|
||||
#include "TitleBar.xaml.h"
|
||||
#include "CalcViewModel/Common/AppResourceProvider.h"
|
||||
#include "CalcViewModel/Common/Utils.h"
|
||||
#include "CalcViewModel/Utils/DeviceFamilyHelper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Platform;
|
||||
using namespace CalculatorApp::ViewModel::Utils;
|
||||
using namespace Windows::ApplicationModel;
|
||||
using namespace Windows::ApplicationModel::Core;
|
||||
using namespace Windows::Foundation;
|
||||
@ -85,25 +83,12 @@ namespace CalculatorApp
|
||||
|
||||
void TitleBar::SetTitleBarVisibility()
|
||||
{
|
||||
// CoreApplication::GetCurrentView()->TitleBar->IsVisible currently returns False instead of True on Windows 10X.
|
||||
// This issue is already tracked and will be fixed in a future preview version of 10X.
|
||||
this->LayoutRoot->Visibility = m_coreTitleBar->IsVisible || DeviceFamilyHelper::GetDeviceFamily() == DeviceFamily::WindowsCore || IsAlwaysOnTopMode
|
||||
? ::Visibility::Visible
|
||||
: ::Visibility::Collapsed;
|
||||
this->LayoutRoot->Visibility = m_coreTitleBar->IsVisible || IsAlwaysOnTopMode ? ::Visibility::Visible : ::Visibility::Collapsed;
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBarHeight()
|
||||
{
|
||||
if (m_coreTitleBar->Height == 0 && DeviceFamilyHelper::GetDeviceFamily() == DeviceFamily::WindowsCore)
|
||||
{
|
||||
// CoreApplication::GetCurrentView()->TitleBar doesn't return the correct height on Windows 10X.
|
||||
// This issue is already tracked and will be fixed in a future preview version of 10X.
|
||||
this->LayoutRoot->Height = 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->LayoutRoot->Height = m_coreTitleBar->Height;
|
||||
}
|
||||
this->LayoutRoot->Height = m_coreTitleBar->Height;
|
||||
}
|
||||
|
||||
void TitleBar::SetTitleBarPadding()
|
||||
|
@ -27,7 +27,6 @@ public
|
||||
void OnLoaded(_In_ Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnUnloaded(_In_ Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
|
||||
void SetTitleBarText(Platform::String ^ text);
|
||||
void SetTitleBarVisibility();
|
||||
void SetTitleBarHeight();
|
||||
void SetTitleBarPadding();
|
||||
|
@ -277,47 +277,36 @@
|
||||
<Grid x:Name="UnitConverterRootGrid"
|
||||
HorizontalAlignment="Stretch"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="RowTopNav" Height="{StaticResource HamburgerHeightGridLength}"/>
|
||||
<RowDefinition x:Name="RowDisplay1"
|
||||
Height="56*"
|
||||
MinHeight="56"/>
|
||||
<RowDefinition x:Name="RowUnit1"
|
||||
Height="32*"
|
||||
MinHeight="32"/>
|
||||
<RowDefinition x:Name="RowDisplay2"
|
||||
Height="56*"
|
||||
MinHeight="56"/>
|
||||
<RowDefinition x:Name="RowUnit2"
|
||||
Height="32*"
|
||||
MinHeight="32"/>
|
||||
<RowDefinition x:Name="RowDltrUnits"
|
||||
Height="Auto"
|
||||
MinHeight="48"/>
|
||||
<RowDefinition x:Name="RowNumPad" Height="272*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="GutterLeft" Width="0"/>
|
||||
<ColumnDefinition x:Name="ColumnLeft" Width="1*"/>
|
||||
<ColumnDefinition x:Name="ColumnRight" Width="0"/>
|
||||
<ColumnDefinition x:Name="GutterRight" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- End ConverterNumPad -->
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="Layout">
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<triggers:ApplicationViewModeTrigger ViewMode="DoubleLandscape"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Pane2Panel.Margin" Value="12"/>
|
||||
<Setter Target="Pane1Panel.Margin" Value="24,48,0,48"/>
|
||||
<Setter Target="SupplementaryResults.VerticalAlignment" Value="Top"/>
|
||||
<Setter Target="Value1.Style" Value="{ThemeResource ValueLargeStyle}"/>
|
||||
<Setter Target="Value2.Style" Value="{ThemeResource ValueLargeStyle}"/>
|
||||
<Setter Target="CurrencySymbol1Block.Style" Value="{ThemeResource CurrencySymbolLargeStyle}"/>
|
||||
<Setter Target="CurrencySymbol2Block.Style" Value="{ThemeResource CurrencySymbolLargeStyle}"/>
|
||||
<Setter Target="Units1.Height" Value="44"/>
|
||||
<Setter Target="Units2.Height" Value="44"/>
|
||||
<Setter Target="ConverterNegateButton.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="ClearEntryButtonPos0.FontSize" Value="{StaticResource CalcStandardOperatorCaptionSize}"/>
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle34}"/>
|
||||
<Setter Target="SupplementaryResultsPanelInGrid.Padding" Value="12,0"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<triggers:ApplicationViewModeTrigger ViewMode="DoublePortrait"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Pane2Panel.Margin" Value="12"/>
|
||||
<Setter Target="Pane1Panel.Margin" Value="24,48,0,0"/>
|
||||
<Setter Target="RowDisplay1.Height" Value="4*"/>
|
||||
<Setter Target="RowUnit1.Height" Value="2*"/>
|
||||
<Setter Target="RowDisplay2.Height" Value="4*"/>
|
||||
<Setter Target="RowUnit2.Height" Value="2*"/>
|
||||
<Setter Target="RowDltrUnits.Height" Value="2*"/>
|
||||
<Setter Target="ConverterNumPad.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="ConverterNumPad.(Grid.RowSpan)" Value="5"/>
|
||||
<Setter Target="SupplementaryResults.VerticalAlignment" Value="Top"/>
|
||||
<Setter Target="Pane2RowTopNav.Height" Value="{StaticResource HamburgerHeightGridLength}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PortraitLayout"/>
|
||||
<VisualState x:Name="LandscapeLayout">
|
||||
<VisualState.StateTriggers>
|
||||
<triggers:AspectRatioTrigger ActiveIfEqual="True"
|
||||
@ -326,21 +315,23 @@
|
||||
Threshold="1"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="TwoPaneView.MinWideModeWidth" Value="0"/>
|
||||
<Setter Target="TwoPaneView.MinTallModeHeight" Value="Infinity"/>
|
||||
<Setter Target="TwoPaneView.Pane1Length" Value="*"/>
|
||||
<Setter Target="TwoPaneView.Pane1MinLength" Value="0"/>
|
||||
<Setter Target="TwoPaneView.Pane2Length" Value="*"/>
|
||||
<Setter Target="GutterLeft.Width" Value="48"/>
|
||||
<Setter Target="GutterRight.Width" Value="48"/>
|
||||
<Setter Target="ColumnLeft.Width" Value="1*"/>
|
||||
<Setter Target="ColumnRight.Width" Value="1*"/>
|
||||
<Setter Target="RowDisplay1.Height" Value="4*"/>
|
||||
<Setter Target="RowUnit1.Height" Value="2*"/>
|
||||
<Setter Target="RowDisplay2.Height" Value="4*"/>
|
||||
<Setter Target="RowUnit2.Height" Value="2*"/>
|
||||
<Setter Target="RowDltrUnits.Height" Value="2*"/>
|
||||
<Setter Target="CurrencyLoadingGrid.(Grid.ColumnSpan)" Value="2"/>
|
||||
<Setter Target="ConverterNumPad.(Grid.Row)" Value="1"/>
|
||||
<Setter Target="ConverterNumPad.(Grid.RowSpan)" Value="5"/>
|
||||
<Setter Target="ConverterNumPad.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="ConverterNumPad.(Grid.ColumnSpan)" Value="2"/>
|
||||
<Setter Target="SupplementaryResults.VerticalAlignment" Value="Top"/>
|
||||
<Setter Target="Pane2RowTopNav.Height" Value="{StaticResource HamburgerHeightGridLength}"/>
|
||||
<Setter Target="Pane1Panel.Margin" Value="48,0,0,0"/>
|
||||
<Setter Target="RowNumPad.MinHeight" Value="0"/>
|
||||
<Setter Target="RowNumPad.Height" Value="0"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@ -409,6 +400,7 @@
|
||||
<Setter Target="ClearEntryButtonPos0.Margin" Value="1"/>
|
||||
<Setter Target="BackSpaceButtonSmall.Margin" Value="1"/>
|
||||
<Setter Target="ConverterNegateButton.Margin" Value="1"/>
|
||||
|
||||
<Setter Target="NumberPad.ButtonStyle" Value="{StaticResource NumericButtonStyle18}"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
@ -445,8 +437,8 @@
|
||||
<VisualState.Setters>
|
||||
<Setter Target="CurrencySymbol1Block.Padding" Value="0,0,12,0"/>
|
||||
<Setter Target="CurrencySymbol2Block.Padding" Value="0,0,12,0"/>
|
||||
<Setter Target="CurrencySymbol1Block.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="CurrencySymbol2Block.(Grid.Column)" Value="1"/>
|
||||
<Setter Target="CurrencySymbol1Block.(Grid.Column)" Value="2"/>
|
||||
<Setter Target="CurrencySymbol2Block.(Grid.Column)" Value="2"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@ -514,287 +506,259 @@
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
|
||||
<controls:TwoPaneViewCX x:Name="TwoPaneView"
|
||||
MinTallModeHeight="0"
|
||||
MinWideModeWidth="Infinity"
|
||||
Pane1Length="16*"
|
||||
Pane1MinLength="260"
|
||||
Pane2Length="18*">
|
||||
<controls:TwoPaneViewCX.Pane1>
|
||||
<Grid x:Name="Pane1Panel">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="RowTopNav" Height="{StaticResource HamburgerHeightGridLength}"/>
|
||||
<RowDefinition x:Name="RowDisplay1"
|
||||
Height="56*"
|
||||
MinHeight="56"/>
|
||||
<RowDefinition x:Name="RowUnit1"
|
||||
Height="32*"
|
||||
MinHeight="32"/>
|
||||
<RowDefinition x:Name="RowDisplay2"
|
||||
Height="56*"
|
||||
MinHeight="56"/>
|
||||
<RowDefinition x:Name="RowUnit2"
|
||||
Height="32*"
|
||||
MinHeight="32"/>
|
||||
<RowDefinition x:Name="RowDltrUnits"
|
||||
Height="Auto"
|
||||
MinHeight="48"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid x:Name="CurrencyLoadingGrid"
|
||||
<Grid x:Name="CurrencyLoadingGrid"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="5"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="7*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ProgressRing x:Name="CurrencyLoadingProgressRing"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="5"
|
||||
Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="7*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ProgressRing x:Name="CurrencyLoadingProgressRing"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
MaxWidth="140"
|
||||
MaxHeight="140"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
IsActive="False"/>
|
||||
</Grid>
|
||||
Grid.Column="1"
|
||||
MaxWidth="140"
|
||||
MaxHeight="140"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
IsActive="False"/>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="Value1Container"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ValueContainerStyle}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="CurrencySymbol1Block"
|
||||
Grid.Column="0"
|
||||
Padding="12,0,0,0"
|
||||
Style="{ThemeResource CurrencySymbolMediumStyle}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{x:Bind Model.CurrencySymbol1, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.CurrencySymbolVisibility, Mode=OneWay}"/>
|
||||
<controls:CalculationResult x:Name="Value1"
|
||||
Grid.Column="1"
|
||||
Style="{ThemeResource ValueMediumStyle}"
|
||||
AutomationProperties.AutomationId="Value1"
|
||||
AutomationProperties.Name="{x:Bind Model.Value1AutomationName, Mode=OneWay}"
|
||||
ContextCanceled="OnContextCanceled"
|
||||
ContextRequested="OnContextRequested"
|
||||
DisplayValue="{x:Bind Model.Value1, Mode=OneWay}"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsActive="{Binding Value1Active, Mode=TwoWay}"
|
||||
KeyDown="OnValueKeyDown"
|
||||
Selected="OnValueSelected"
|
||||
TabIndex="1"/>
|
||||
</Grid>
|
||||
<Grid x:Name="Value1Container"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ValueContainerStyle}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="CurrencySymbol1Block"
|
||||
Grid.Column="0"
|
||||
Padding="12,0,0,0"
|
||||
Style="{ThemeResource CurrencySymbolMediumStyle}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{x:Bind Model.CurrencySymbol1, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.CurrencySymbolVisibility, Mode=OneWay}"/>
|
||||
<controls:CalculationResult x:Name="Value1"
|
||||
Grid.Column="1"
|
||||
Style="{ThemeResource ValueMediumStyle}"
|
||||
AutomationProperties.AutomationId="Value1"
|
||||
AutomationProperties.Name="{x:Bind Model.Value1AutomationName, Mode=OneWay}"
|
||||
ContextCanceled="OnContextCanceled"
|
||||
ContextRequested="OnContextRequested"
|
||||
DisplayValue="{x:Bind Model.Value1, Mode=OneWay}"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsActive="{Binding Value1Active, Mode=TwoWay}"
|
||||
KeyDown="OnValueKeyDown"
|
||||
Selected="OnValueSelected"
|
||||
TabIndex="1"/>
|
||||
</Grid>
|
||||
|
||||
<ComboBox x:Name="Units1"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ComboStyle}"
|
||||
AutomationProperties.AutomationId="Units1"
|
||||
AutomationProperties.Name="{x:Bind Model.Unit1AutomationName, Mode=OneWay}"
|
||||
DropDownClosed="UpdateDropDownState"
|
||||
DropDownOpened="UpdateDropDownState"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsEnabledChanged="Units1_IsEnabledChanged"
|
||||
ItemTemplate="{StaticResource UnitTemplate}"
|
||||
ItemsSource="{Binding Units, Converter={StaticResource AlwaysSelectedConverter}}"
|
||||
SelectedItem="{Binding Unit1, Mode=TwoWay, Converter={StaticResource ValidSelectedItemConverter}}"
|
||||
TabIndex="2"
|
||||
IsEnabled="{Binding IsDropDownEnabled}"/>
|
||||
<ComboBox x:Name="Units1"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ComboStyle}"
|
||||
AutomationProperties.AutomationId="Units1"
|
||||
AutomationProperties.Name="{x:Bind Model.Unit1AutomationName, Mode=OneWay}"
|
||||
DropDownClosed="UpdateDropDownState"
|
||||
DropDownOpened="UpdateDropDownState"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsEnabledChanged="Units1_IsEnabledChanged"
|
||||
ItemTemplate="{StaticResource UnitTemplate}"
|
||||
ItemsSource="{Binding Units, Converter={StaticResource AlwaysSelectedConverter}}"
|
||||
SelectedItem="{Binding Unit1, Mode=TwoWay, Converter={StaticResource ValidSelectedItemConverter}}"
|
||||
TabIndex="2"
|
||||
IsEnabled="{Binding IsDropDownEnabled}"/>
|
||||
|
||||
<Grid x:Name="Value2Container"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ValueContainerStyle}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="CurrencySymbol2Block"
|
||||
Grid.Column="0"
|
||||
Padding="12,0,0,0"
|
||||
Style="{ThemeResource CurrencySymbolMediumStyle}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{x:Bind Model.CurrencySymbol2, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.CurrencySymbolVisibility, Mode=OneWay}"/>
|
||||
<controls:CalculationResult x:Name="Value2"
|
||||
Grid.Column="1"
|
||||
Style="{ThemeResource ValueMediumStyle}"
|
||||
AutomationProperties.AutomationId="Value2"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
AutomationProperties.Name="{x:Bind Model.Value2AutomationName, Mode=OneWay}"
|
||||
ContextCanceled="OnContextCanceled"
|
||||
ContextRequested="OnContextRequested"
|
||||
DisplayValue="{x:Bind Model.Value2, Mode=OneWay}"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsActive="{Binding Value2Active, Mode=TwoWay}"
|
||||
KeyDown="OnValueKeyDown"
|
||||
Selected="OnValueSelected"
|
||||
TabIndex="3"/>
|
||||
</Grid>
|
||||
<Grid x:Name="Value2Container"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ValueContainerStyle}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="CurrencySymbol2Block"
|
||||
Grid.Column="0"
|
||||
Padding="12,0,0,0"
|
||||
Style="{ThemeResource CurrencySymbolMediumStyle}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{x:Bind Model.CurrencySymbol2, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.CurrencySymbolVisibility, Mode=OneWay}"/>
|
||||
<controls:CalculationResult x:Name="Value2"
|
||||
Grid.Column="1"
|
||||
Style="{ThemeResource ValueMediumStyle}"
|
||||
AutomationProperties.AutomationId="Value2"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
AutomationProperties.Name="{x:Bind Model.Value2AutomationName, Mode=OneWay}"
|
||||
ContextCanceled="OnContextCanceled"
|
||||
ContextRequested="OnContextRequested"
|
||||
DisplayValue="{x:Bind Model.Value2, Mode=OneWay}"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsActive="{Binding Value2Active, Mode=TwoWay}"
|
||||
KeyDown="OnValueKeyDown"
|
||||
Selected="OnValueSelected"
|
||||
TabIndex="3"/>
|
||||
</Grid>
|
||||
|
||||
<ComboBox x:Name="Units2"
|
||||
Grid.Row="4"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ComboStyle}"
|
||||
AutomationProperties.AutomationId="Units2"
|
||||
AutomationProperties.Name="{x:Bind Model.Unit2AutomationName, Mode=OneWay}"
|
||||
DropDownClosed="UpdateDropDownState"
|
||||
DropDownOpened="UpdateDropDownState"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
ItemTemplate="{StaticResource UnitTemplate}"
|
||||
ItemsSource="{Binding Units, Converter={StaticResource AlwaysSelectedConverter}}"
|
||||
SelectedItem="{Binding Unit2, Mode=TwoWay, Converter={StaticResource ValidSelectedItemConverter}}"
|
||||
TabIndex="4"
|
||||
IsEnabled="{Binding IsDropDownEnabled}"/>
|
||||
<ComboBox x:Name="Units2"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
Style="{ThemeResource ComboStyle}"
|
||||
AutomationProperties.AutomationId="Units2"
|
||||
AutomationProperties.Name="{x:Bind Model.Unit2AutomationName, Mode=OneWay}"
|
||||
DropDownClosed="UpdateDropDownState"
|
||||
DropDownOpened="UpdateDropDownState"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
ItemTemplate="{StaticResource UnitTemplate}"
|
||||
ItemsSource="{Binding Units, Converter={StaticResource AlwaysSelectedConverter}}"
|
||||
SelectedItem="{Binding Unit2, Mode=TwoWay, Converter={StaticResource ValidSelectedItemConverter}}"
|
||||
TabIndex="4"
|
||||
IsEnabled="{Binding IsDropDownEnabled}"/>
|
||||
|
||||
<StackPanel x:Name="SupplementaryResultsPanelInGrid"
|
||||
Grid.Row="5"
|
||||
MinHeight="48"
|
||||
Padding="12,0,6,0"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
VerticalAlignment="Top"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
SizeChanged="SupplementaryResultsPanelInGrid_SizeChanged">
|
||||
<local:SupplementaryResults x:Name="SupplementaryResults"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Results="{x:Bind Model.SupplementaryResults, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.SupplementaryVisibility, Mode=OneWay}"/>
|
||||
<StackPanel Visibility="{x:Bind Model.IsCurrencyCurrentCategory, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<!-- Currency Ratio Equality -->
|
||||
<TextBlock x:Name="CurrencyRatioEqualityBlock"
|
||||
Style="{ThemeResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
AutomationProperties.Name="{x:Bind Model.CurrencyRatioEqualityAutomationName, Mode=OneWay}"
|
||||
Text="{x:Bind Model.CurrencyRatioEquality, Mode=OneWay}"/>
|
||||
<StackPanel x:Name="SupplementaryResultsPanelInGrid"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
MinHeight="48"
|
||||
Padding="12,0,6,0"
|
||||
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
|
||||
VerticalAlignment="Top"
|
||||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
SizeChanged="SupplementaryResultsPanelInGrid_SizeChanged">
|
||||
<local:SupplementaryResults x:Name="SupplementaryResults"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Results="{x:Bind Model.SupplementaryResults, Mode=OneWay}"
|
||||
Visibility="{x:Bind Model.SupplementaryVisibility, Mode=OneWay}"/>
|
||||
<StackPanel Visibility="{x:Bind Model.IsCurrencyCurrentCategory, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<!-- Currency Ratio Equality -->
|
||||
<TextBlock x:Name="CurrencyRatioEqualityBlock"
|
||||
Style="{ThemeResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
AutomationProperties.Name="{x:Bind Model.CurrencyRatioEqualityAutomationName, Mode=OneWay}"
|
||||
Text="{x:Bind Model.CurrencyRatioEquality, Mode=OneWay}"/>
|
||||
|
||||
<!-- Currency Timestamp -->
|
||||
<TextBlock x:Name="CurrencyTimestampTextBlock"
|
||||
Style="{ThemeResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind Model.CurrencyTimestamp, Mode=OneWay}"/>
|
||||
<!-- Currency Timestamp -->
|
||||
<TextBlock x:Name="CurrencyTimestampTextBlock"
|
||||
Style="{ThemeResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind Model.CurrencyTimestamp, Mode=OneWay}"/>
|
||||
|
||||
<!-- Currency Refresh button and additional status text -->
|
||||
<ContentControl x:Name="CurrencyRefreshBlockControl"
|
||||
IsTabStop="False"
|
||||
TabIndex="5"
|
||||
Visibility="Collapsed">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<HyperlinkButton x:Name="CurrencyRefreshBlock"
|
||||
x:Uid="RefreshButtonText"
|
||||
Foreground="{ThemeResource SystemControlHyperlinkBaseHighBrush}"
|
||||
Click="CurrencyRefreshButton_Click"/>
|
||||
<TextBlock Margin="3,7,0,0" Style="{ThemeResource CaptionTextBlockStyle}">
|
||||
<Run x:Name="CurrencySecondaryStatus"
|
||||
FontWeight="SemiBold"
|
||||
Text=""/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</ContentControl>
|
||||
|
||||
<!-- Offline TextBlock -->
|
||||
<ContentControl x:Name="OfflineBlock"
|
||||
IsTabStop="False"
|
||||
TabIndex="5"
|
||||
Visibility="Collapsed">
|
||||
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
AutomationProperties.AccessibilityView="Raw">
|
||||
<Run x:Name="OfflineRunBeforeLink"/>
|
||||
<Hyperlink NavigateUri="ms-settings:network-status">
|
||||
<Run x:Name="OfflineRunLink"/>
|
||||
</Hyperlink>
|
||||
<Run x:Name="OfflineRunAfterLink"/>
|
||||
</TextBlock>
|
||||
</ContentControl>
|
||||
</StackPanel>
|
||||
<!-- Currency Refresh button and additional status text -->
|
||||
<ContentControl x:Name="CurrencyRefreshBlockControl"
|
||||
IsTabStop="False"
|
||||
TabIndex="5"
|
||||
Visibility="Collapsed">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<HyperlinkButton x:Name="CurrencyRefreshBlock"
|
||||
x:Uid="RefreshButtonText"
|
||||
Foreground="{ThemeResource SystemControlHyperlinkBaseHighBrush}"
|
||||
Click="CurrencyRefreshButton_Click"/>
|
||||
<TextBlock Margin="3,7,0,0" Style="{ThemeResource CaptionTextBlockStyle}">
|
||||
<Run x:Name="CurrencySecondaryStatus"
|
||||
FontWeight="SemiBold"
|
||||
Text=""/>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</controls:TwoPaneViewCX.Pane1>
|
||||
<controls:TwoPaneViewCX.Pane2>
|
||||
<Grid x:Name="Pane2Panel">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="Pane2RowTopNav" Height="0"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid x:Name="ConverterNumPad"
|
||||
Grid.Row="1"
|
||||
Margin="3,0,3,3"
|
||||
FlowDirection="LeftToRight"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
XYFocusKeyboardNavigation="Enabled">
|
||||
<Grid.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</Grid.RenderTransform>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid x:Uid="DisplayControls"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
AutomationProperties.HeadingLevel="Level1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="ClearEntryButtonPos0"
|
||||
x:Uid="clearEntryButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
FontSize="16"
|
||||
ButtonId="Clear"
|
||||
Content="CE"
|
||||
TabIndex="7"/>
|
||||
<controls:CalculatorButton x:Name="BackSpaceButtonSmall"
|
||||
x:Uid="backSpaceButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
ButtonId="Backspace"
|
||||
Content=""
|
||||
TabIndex="8"/>
|
||||
</Grid>
|
||||
</ContentControl>
|
||||
|
||||
<local:NumberPad x:Name="NumberPad"
|
||||
x:Uid="NumberPad"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="4"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
VerticalAlignment="Stretch"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
ButtonStyle="{StaticResource NumericButtonStyle24}"
|
||||
TabIndex="10"
|
||||
TabNavigation="Local"/>
|
||||
<controls:CalculatorButton x:Name="ConverterNegateButton"
|
||||
x:Uid="converterNegateButton"
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource SymbolOperatorKeypadButtonStyle}"
|
||||
FontSize="16"
|
||||
ButtonId="Negate"
|
||||
Content=""
|
||||
TabIndex="6"
|
||||
Visibility="{x:Bind Model.CurrentCategory.NegateVisibility, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</controls:TwoPaneViewCX.Pane2>
|
||||
</controls:TwoPaneViewCX>
|
||||
<!-- Offline TextBlock -->
|
||||
<ContentControl x:Name="OfflineBlock"
|
||||
IsTabStop="False"
|
||||
TabIndex="5"
|
||||
Visibility="Collapsed">
|
||||
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}"
|
||||
Foreground="{ThemeResource SystemControlPageTextBaseHighBrush}"
|
||||
AutomationProperties.AccessibilityView="Raw">
|
||||
<Run x:Name="OfflineRunBeforeLink"/>
|
||||
<Hyperlink NavigateUri="ms-settings:network-status">
|
||||
<Run x:Name="OfflineRunLink"/>
|
||||
</Hyperlink>
|
||||
<Run x:Name="OfflineRunAfterLink"/>
|
||||
</TextBlock>
|
||||
</ContentControl>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<Grid x:Name="ConverterNumPad"
|
||||
Grid.Row="6"
|
||||
Grid.Column="1"
|
||||
Margin="3,0,3,3"
|
||||
FlowDirection="LeftToRight"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
XYFocusKeyboardNavigation="Enabled">
|
||||
<Grid.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</Grid.RenderTransform>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid x:Uid="DisplayControls"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
AutomationProperties.HeadingLevel="Level1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:CalculatorButton x:Name="ClearEntryButtonPos0"
|
||||
x:Uid="clearEntryButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
Style="{StaticResource OperatorButtonStyle}"
|
||||
FontSize="16"
|
||||
ButtonId="Clear"
|
||||
Content="CE"
|
||||
TabIndex="7"/>
|
||||
<controls:CalculatorButton x:Name="BackSpaceButtonSmall"
|
||||
x:Uid="backSpaceButton"
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource SymbolOperatorButtonStyle}"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
ButtonId="Backspace"
|
||||
Content=""
|
||||
TabIndex="8"/>
|
||||
</Grid>
|
||||
|
||||
<local:NumberPad x:Name="NumberPad"
|
||||
x:Uid="NumberPad"
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="4"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
VerticalAlignment="Stretch"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
ButtonStyle="{StaticResource NumericButtonStyle24}"
|
||||
TabIndex="10"
|
||||
TabNavigation="Local"/>
|
||||
<controls:CalculatorButton x:Name="ConverterNegateButton"
|
||||
x:Uid="converterNegateButton"
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
Style="{StaticResource SymbolOperatorKeypadButtonStyle}"
|
||||
FontSize="16"
|
||||
ButtonId="Negate"
|
||||
Content=""
|
||||
TabIndex="6"
|
||||
Visibility="{x:Bind Model.CurrentCategory.NegateVisibility, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
<!-- End ConverterNumPad -->
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "Converters/VisibilityNegationConverter.h"
|
||||
#include "CalcViewModel/UnitConverterViewModel.h"
|
||||
#include "Views/StateTriggers/AspectRatioTrigger.h"
|
||||
#include "Views/StateTriggers/ApplicationViewModeTrigger.h"
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "winrt/Windows.System.UserProfile.h"
|
||||
#include "winrt/Windows.UI.ViewManagement.h"
|
||||
#include "winrt/Windows.UI.Xaml.h"
|
||||
#include "winrt/Windows.System.Profile.h"
|
||||
#include "winrt/Windows.Foundation.h"
|
||||
|
||||
// Project Headers
|
||||
|
Loading…
Reference in New Issue
Block a user