Revert dual screen (#1134)

This commit is contained in:
Rudy Huyn 2020-04-01 11:18:04 -07:00 committed by GitHub
parent ded99f87b4
commit b0565f90f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 1237 additions and 2377 deletions

View File

@ -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">

View File

@ -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">

View File

@ -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;
}
}

View File

@ -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;
};
}

View File

@ -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>

View File

@ -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">

View File

@ -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" />

View File

@ -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;
}
}
}
}

View File

@ -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 };
};
}

View File

@ -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" />

View File

@ -8,7 +8,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:CalculatorApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:triggers="using:CalculatorApp.Views.StateTriggers"
Loaded="OnLoaded"
mc:Ignorable="d">
@ -383,7 +382,15 @@
Icon="Paste"/>
</MenuFlyout>
</UserControl.Resources>
<Grid AutomationProperties.LandmarkType="Main">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnMain"/>
<ColumnDefinition x:Name="ColumnHistory"
Width="0"
MaxWidth="320"/>
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<!-- Error Layout specific -->
<VisualStateGroup x:Name="ErrorVisualStates">
@ -408,13 +415,18 @@
<Setter Target="MemPlus.IsEnabled" Value="False"/>
<Setter Target="MemMinus.IsEnabled" Value="False"/>
<Setter Target="MemButton.IsEnabled" Value="False"/>
<Setter Target="RowExpression.Height" Value="0"/>
<Setter Target="RowExpression.Height" Value="0*"/>
<Setter Target="RowHamburger.Height" Value="0"/>
<Setter Target="RowMemoryControls.Height" Value="0"/>
<Setter Target="RowMemoryControls.Height" Value="0*"/>
</VisualState.Setters>
<Storyboard Completed="OnDisplayVisualStateCompleted"/>
</VisualState>
<VisualState x:Name="DisplayModeNormal">
<VisualState.Setters>
<Setter Target="RowExpression.Height" Value="20*"/>
<Setter Target="RowHamburger.Height" Value="{StaticResource HamburgerHeightGridLength}"/>
<Setter Target="RowMemoryControls.Height" Value="32*"/>
</VisualState.Setters>
<Storyboard Completed="OnDisplayVisualStateCompleted"/>
</VisualState>
</VisualStateGroup>
@ -448,44 +460,12 @@
</VisualStateGroup>
<!-- Layout specific -->
<VisualStateGroup x:Name="LayoutVisualStates" CurrentStateChanged="OnVisualStateChanged">
<VisualState>
<VisualState.StateTriggers>
<triggers:ApplicationViewModeTrigger ViewMode="DoubleLandscape"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="DockPanel.Visibility" Value="Visible"/>
<Setter Target="M6.Width" Value="0"/>
<Setter Target="ExpressionText.Visibility" Value="Collapsed"/>
<Setter Target="Results.Visibility" Value="Collapsed"/>
<Setter Target="RowExpression.Height" Value="0"/>
<Setter Target="RowMemoryControls.Height" Value="64"/>
<Setter Target="RowHamburger.Height" Value="0"/>
<Setter Target="RowDisplayControls.Height" Value="0"/>
<Setter Target="DualScreenResultPanel.Visibility" Value="Visible"/>
<Setter Target="DockPanel.BorderThickness" Value="1,0,0,0"/>
<Setter Target="DockPanel.(Grid.ColumnSpan)" Value="1"/>
<Setter Target="DockPanel.(Grid.Column)" Value="1"/>
<Setter Target="Pane1Panel.Margin" Value="12,0,12,12"/>
</VisualState.Setters>
</VisualState>
<VisualState>
<VisualState.StateTriggers>
<triggers:ApplicationViewModeTrigger ViewMode="DoublePortrait"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="Pane1Panel.Margin" Value="12"/>
<Setter Target="Pane2Panel.Margin" Value="12"/>
<Setter Target="DockPanel.Visibility" Value="Visible"/>
<Setter Target="M6.Width" Value="0"/>
</VisualState.Setters>
<Storyboard Completed="OnLayoutVisualStateCompleted"/>
</VisualState>
<VisualState x:Name="Portrait768x1366">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="1366" MinWindowWidth="768"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="PaneView.Pane2Length" Value="320"/>
<Setter Target="ColumnHistory.Width" Value="320"/>
<Setter Target="DockPanel.Visibility" Value="Visible"/>
<Setter Target="M6.Width" Value="0"/>
</VisualState.Setters>
@ -496,7 +476,7 @@
<AdaptiveTrigger MinWindowHeight="768" MinWindowWidth="1024"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="PaneView.Pane2Length" Value="320"/>
<Setter Target="ColumnHistory.Width" Value="320"/>
<Setter Target="DockPanel.Visibility" Value="Visible"/>
<Setter Target="M6.Width" Value="0"/>
</VisualState.Setters>
@ -507,8 +487,8 @@
<AdaptiveTrigger MinWindowHeight="0" MinWindowWidth="560"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="PaneView.Pane1Length" Value="320*"/>
<Setter Target="PaneView.Pane2Length" Value="240*"/>
<Setter Target="ColumnMain.Width" Value="320*"/>
<Setter Target="ColumnHistory.Width" Value="240*"/>
<Setter Target="DockPanel.Visibility" Value="Visible"/>
<Setter Target="M6.Width" Value="0"/>
</VisualState.Setters>
@ -536,18 +516,11 @@
<Storyboard Completed="OnLayoutVisualStateCompleted"/>
</VisualState>
</VisualStateGroup>
<!-- Results display specific -->
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<triggers:ApplicationViewModeTrigger ViewMode="DoubleLandscape"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RowResult.Height" Value="0"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="RegularAlwaysOnTop">
<VisualState.StateTriggers>
<triggers:ApplicationViewModeTrigger MinWindowHeight="260" ViewMode="CompactOverlay"/>
<AdaptiveTrigger MinWindowHeight="260"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RowResult.MinHeight" Value="54"/>
@ -556,7 +529,7 @@
</VisualState>
<VisualState x:Name="MinAlwaysOnTop">
<VisualState.StateTriggers>
<triggers:ApplicationViewModeTrigger MinWindowHeight="0" ViewMode="CompactOverlay"/>
<AdaptiveTrigger MinWindowHeight="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RowResult.MinHeight" Value="20"/>
@ -566,6 +539,8 @@
<Setter Target="AlwaysOnTopResults.ScrollButtonsFontSize" Value="12"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup>
<VisualState x:Name="ResultsL">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowHeight="800"/>
@ -599,16 +574,7 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<controls:TwoPaneViewCX x:Name="PaneView"
Grid.RowSpan="2"
MinTallModeHeight="Infinity"
MinWideModeWidth="0"
Pane1Length="*"
Pane2Length="0"
Pane2MaxLength="320"
TallModeConfiguration="BottomTop">
<controls:TwoPaneViewCX.Pane1>
<Grid x:Name="Pane1Panel" FlowDirection="LeftToRight">
<Grid FlowDirection="LeftToRight">
<Grid.RowDefinitions>
<RowDefinition x:Name="RowHamburger" Height="{StaticResource HamburgerHeightGridLength}"/>
<RowDefinition x:Name="RowExpression"
@ -815,47 +781,12 @@
<local:OperatorsPanel x:Name="OpsPanel" IsBitFlipChecked="{x:Bind Model.IsBitFlipChecked, Mode=OneWay}"/>
</Grid>
</Grid>
</controls:TwoPaneViewCX.Pane1>
<controls:TwoPaneViewCX.Pane2>
<Grid x:Name="Pane2Panel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="248"/>
</Grid.ColumnDefinitions>
<StackPanel x:Name="DualScreenResultPanel"
Padding="0,0,12,0"
VerticalAlignment="Center"
Visibility="Collapsed"
x:Load="False">
<controls:OverflowTextBlock x:Name="DualScreenExpressionText"
Margin="6,0,6,0"
VerticalAlignment="Bottom"
Style="{StaticResource NormalStyle}"
AutomationProperties.AutomationId="CalculatorExpression"
AutomationProperties.Name="{x:Bind Model.CalculationExpressionAutomationName, Mode=OneWay}"
IsTabStop="False"
TokensUpdated="{x:Bind Model.AreTokensUpdated, Mode=OneWay}"/>
<controls:CalculationResult x:Uid="CalculatorResults"
Style="{StaticResource ResultsStyle}"
AutomationProperties.AutomationId="CalculatorResults"
AutomationProperties.HeadingLevel="Level1"
AutomationProperties.Name="{x:Bind Model.CalculationResultAutomationName, Mode=OneWay}"
ContextCanceled="OnContextCanceled"
ContextRequested="OnContextRequested"
DisplayValue="{x:Bind Model.DisplayValue, Mode=OneWay}"
IsInError="{x:Bind Model.IsInError, Mode=OneWay}"
IsOperatorCommand="{x:Bind Model.IsOperatorCommand, Mode=OneWay}"
MaxFontSize="72"/>
</StackPanel>
<!-- Docked Pivot panel for history/memory -->
<Border x:Name="DockPanel"
x:Uid="DockPanel"
Grid.ColumnSpan="2"
BorderBrush="{ThemeResource DividerBrush}"
BorderThickness="0"
Grid.Row="1"
Grid.Column="1"
AutomationProperties.HeadingLevel="Level1"
Visibility="Collapsed">
<Border.Resources>
@ -1343,7 +1274,4 @@
</Pivot>
</Border>
</Grid>
</controls:TwoPaneViewCX.Pane2>
</controls:TwoPaneViewCX>
</Grid>
</UserControl>

View File

@ -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)

View File

@ -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
{

View File

@ -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>

View File

@ -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">
@ -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,6 +450,7 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- Top panel -->
<Grid Grid.ColumnSpan="2">
<ToggleSwitch x:Name="SwitchModeToggleButton"
x:Uid="SwitchModeToggleButton"
Margin="0,0,12,2"
@ -501,19 +462,12 @@
Toggled="SwitchModeToggleButton_Toggled"
ToolTipService.ToolTip="{x:Bind local:GraphingCalculator.GetInfoForSwitchModeToggleButton(SwitchModeToggleButton.IsOn), Mode=OneWay}"
Visibility="Collapsed"/>
<controls:TwoPaneViewCX x:Name="PaneView"
</Grid>
<!-- Left portion of the screen -->
<Grid x:Name="LeftGrid"
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">
Padding="0,4,0,0"
Visibility="{x:Bind ShouldDisplayPanel(IsSmallState, SwitchModeToggleButton.IsOn, x:True), Mode=OneWay}">
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
@ -688,22 +642,21 @@
AutomationProperties.LiveSetting="Polite"/>
</Border>
</Grid>
</controls:TwoPaneViewCX.Pane1>
<controls:TwoPaneViewCX.Pane2>
<Grid x:Name="RightGrid">
<!-- 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>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 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}"
@ -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}"/>
</Grid>
</controls:TwoPaneViewCX.Pane2>
</controls:TwoPaneViewCX>
</Grid>
</UserControl>

View File

@ -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)

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
};
}

View File

@ -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,26 +83,13 @@ 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;
}
}
void TitleBar::SetTitleBarPadding()
{

View File

@ -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();

View File

@ -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,36 +506,11 @@
</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.Row="1"
Grid.RowSpan="5"
Visibility="Collapsed">
Grid.Column="0"
Grid.ColumnSpan="4">
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="7*"/>
@ -561,6 +528,7 @@
<Grid x:Name="Value1Container"
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
Style="{ThemeResource ValueContainerStyle}">
<Grid.ColumnDefinitions>
@ -592,6 +560,7 @@
<ComboBox x:Name="Units1"
Grid.Row="2"
Grid.Column="1"
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
Style="{ThemeResource ComboStyle}"
AutomationProperties.AutomationId="Units1"
@ -608,6 +577,7 @@
<Grid x:Name="Value2Container"
Grid.Row="3"
Grid.Column="1"
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
Style="{ThemeResource ValueContainerStyle}">
<Grid.ColumnDefinitions>
@ -640,6 +610,7 @@
<ComboBox x:Name="Units2"
Grid.Row="4"
Grid.Column="1"
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
Style="{ThemeResource ComboStyle}"
AutomationProperties.AutomationId="Units2"
@ -655,6 +626,7 @@
<StackPanel x:Name="SupplementaryResultsPanelInGrid"
Grid.Row="5"
Grid.Column="1"
MinHeight="48"
Padding="12,0,6,0"
HorizontalAlignment="{x:Bind FlowDirectionHorizontalAlignment}"
@ -714,16 +686,10 @@
</ContentControl>
</StackPanel>
</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"
Grid.Row="6"
Grid.Column="1"
Margin="3,0,3,3"
FlowDirection="LeftToRight"
RenderTransformOrigin="0.5,0.5"
@ -793,8 +759,6 @@
TabIndex="6"
Visibility="{x:Bind Model.CurrentCategory.NegateVisibility, Mode=OneWay}"/>
</Grid>
</Grid>
</controls:TwoPaneViewCX.Pane2>
</controls:TwoPaneViewCX>
<!-- End ConverterNumPad -->
</Grid>
</UserControl>

View File

@ -13,7 +13,6 @@
#include "Converters/VisibilityNegationConverter.h"
#include "CalcViewModel/UnitConverterViewModel.h"
#include "Views/StateTriggers/AspectRatioTrigger.h"
#include "Views/StateTriggers/ApplicationViewModeTrigger.h"
namespace CalculatorApp
{

View File

@ -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