calculator/src/Calculator/Controls/SupplementaryItemsControl.cpp
Rudy Huyn ef3f5e9cbb Improve performance of SupplementaryResult + Modify the height of RowDltrUnits when UnitConverter is in Landscape (#249)
* Modify the height of RowDltrUnits when UnitConverter  is in LandscapeLayout mode

* clean

* Use the same layout than the existing one while fixing the issue

* Refactor SupplementaryItemsControl to improve performance, not rely on parents and not force the parent element to be HorizonAlignment="stretch"

* take feedback into account

* add HorizontalNoOverflowStackPanel to vcproj.filters

* format conditionals

* replace max by std::max
2019-03-26 11:24:36 -07:00

41 lines
1.3 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "SupplementaryItemsControl.h"
#include "CalcViewModel/UnitConverterViewModel.h"
using namespace CalculatorApp;
using namespace CalculatorApp::Controls;
using namespace CalculatorApp::ViewModel;
using namespace Windows::System;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Automation;
using namespace Windows::UI::Xaml::Automation::Peers;
using namespace Platform;
using namespace Windows::Foundation::Collections;
using namespace std;
DependencyObject^ SupplementaryItemsControl::GetContainerForItemOverride()
{
return ref new SupplementaryContentPresenter();
}
void SupplementaryItemsControl::PrepareContainerForItemOverride(DependencyObject^ element, Object^ item)
{
ItemsControl::PrepareContainerForItemOverride(element, item);
auto supplementaryResult = dynamic_cast<SupplementaryResult^>(item);
if (supplementaryResult)
{
AutomationProperties::SetName(element, supplementaryResult->GetLocalizedAutomationName());
}
}
AutomationPeer^ SupplementaryContentPresenter::OnCreateAutomationPeer()
{
return ref new SupplementaryContentPresenterAP(this);
}