-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move radio buttons onto repeater (#1623)
* Move radio buttons onto repeater * clean up some mistakes * Remove the custom left and right focus movement code, replaced by XY focus which works basically just as well. Respond to CR feedback. * Remove SelectionModel in favor of managing selection myself. Because the selection model is so simple for radio buttons (single select, flat list) selection model was overly complex and wasn't worth the cost. Remove MissStrategy which is not longer used after the last commit. * Remove GetContainerFromItem from the ElementFactory * Remove the changes to SelectionModel, now that RadioButtons isn't using it. * Fix a few of the tests and respond to some more feedback. * Remove the m_isControlDown falg in favor of using GetAsyncKeyState. * Updates for minor API adjustments. * Fix an issue with the tests running down level and with the call to GetAsyncKeyState which was not being evaluated correctly resulting in the first control arrow key moving selection. * Fix RadioButtons to account for slightly different focus manager behavior down level. * Fix crash on RS2 due to the use of PreviewKeyDown which was introduced in RS3. This api is needed to get the keyboarding behavior we want so on RS2 I've changed the keyboarding behavior since the desired behavior isn't possible. Fix a crash on RS2 and RS3 due to the use of TrySetNewFocusedElement, this means that on RS2 and RS3 we will not focus the selected items when tabbing into the radio button's control. remove redundant radio button style from the theme resources and move the column and row spacing into the theme resources * Add an RS2 keyboarding test * Disable failing test on RS2. * Move maximum columns to a binding in the template * Fix a typo in the gamepad test.... * Fix an issue comparing pointer instead of value. * Move to validation callback to fix unboxing error
- Loading branch information
1 parent
94d5e09
commit 22adf4d
Showing
46 changed files
with
2,403 additions
and
625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
dev/Generated/ColumnMajorUniformToLargestGridLayout.properties.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
// DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen | ||
#include "pch.h" | ||
#include "common.h" | ||
#include "ColumnMajorUniformToLargestGridLayout.h" | ||
|
||
CppWinRTActivatableClassWithDPFactory(ColumnMajorUniformToLargestGridLayout) | ||
|
||
GlobalDependencyProperty ColumnMajorUniformToLargestGridLayoutProperties::s_ColumnSpacingProperty{ nullptr }; | ||
GlobalDependencyProperty ColumnMajorUniformToLargestGridLayoutProperties::s_MaximumColumnsProperty{ nullptr }; | ||
GlobalDependencyProperty ColumnMajorUniformToLargestGridLayoutProperties::s_RowSpacingProperty{ nullptr }; | ||
|
||
ColumnMajorUniformToLargestGridLayoutProperties::ColumnMajorUniformToLargestGridLayoutProperties() | ||
{ | ||
EnsureProperties(); | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::EnsureProperties() | ||
{ | ||
if (!s_ColumnSpacingProperty) | ||
{ | ||
s_ColumnSpacingProperty = | ||
InitializeDependencyProperty( | ||
L"ColumnSpacing", | ||
winrt::name_of<int>(), | ||
winrt::name_of<winrt::ColumnMajorUniformToLargestGridLayout>(), | ||
false /* isAttached */, | ||
ValueHelper<int>::BoxedDefaultValue(), | ||
winrt::PropertyChangedCallback(&OnColumnSpacingPropertyChanged)); | ||
} | ||
if (!s_MaximumColumnsProperty) | ||
{ | ||
s_MaximumColumnsProperty = | ||
InitializeDependencyProperty( | ||
L"MaximumColumns", | ||
winrt::name_of<int>(), | ||
winrt::name_of<winrt::ColumnMajorUniformToLargestGridLayout>(), | ||
false /* isAttached */, | ||
ValueHelper<int>::BoxedDefaultValue(), | ||
winrt::PropertyChangedCallback(&OnMaximumColumnsPropertyChanged)); | ||
} | ||
if (!s_RowSpacingProperty) | ||
{ | ||
s_RowSpacingProperty = | ||
InitializeDependencyProperty( | ||
L"RowSpacing", | ||
winrt::name_of<int>(), | ||
winrt::name_of<winrt::ColumnMajorUniformToLargestGridLayout>(), | ||
false /* isAttached */, | ||
ValueHelper<int>::BoxedDefaultValue(), | ||
winrt::PropertyChangedCallback(&OnRowSpacingPropertyChanged)); | ||
} | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::ClearProperties() | ||
{ | ||
s_ColumnSpacingProperty = nullptr; | ||
s_MaximumColumnsProperty = nullptr; | ||
s_RowSpacingProperty = nullptr; | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::OnColumnSpacingPropertyChanged( | ||
winrt::DependencyObject const& sender, | ||
winrt::DependencyPropertyChangedEventArgs const& args) | ||
{ | ||
auto owner = sender.as<winrt::ColumnMajorUniformToLargestGridLayout>(); | ||
winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->OnColumnSpacingPropertyChanged(args); | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::OnMaximumColumnsPropertyChanged( | ||
winrt::DependencyObject const& sender, | ||
winrt::DependencyPropertyChangedEventArgs const& args) | ||
{ | ||
auto owner = sender.as<winrt::ColumnMajorUniformToLargestGridLayout>(); | ||
|
||
auto value = winrt::unbox_value<int>(args.NewValue()); | ||
auto coercedValue = value; | ||
winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->ValidateGreaterThanZero(coercedValue); | ||
if (value != coercedValue) | ||
{ | ||
sender.SetValue(args.Property(), winrt::box_value<int>(coercedValue)); | ||
return; | ||
} | ||
|
||
winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->OnMaximumColumnsPropertyChanged(args); | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::OnRowSpacingPropertyChanged( | ||
winrt::DependencyObject const& sender, | ||
winrt::DependencyPropertyChangedEventArgs const& args) | ||
{ | ||
auto owner = sender.as<winrt::ColumnMajorUniformToLargestGridLayout>(); | ||
winrt::get_self<ColumnMajorUniformToLargestGridLayout>(owner)->OnRowSpacingPropertyChanged(args); | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::ColumnSpacing(int value) | ||
{ | ||
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_ColumnSpacingProperty, ValueHelper<int>::BoxValueIfNecessary(value)); | ||
} | ||
|
||
int ColumnMajorUniformToLargestGridLayoutProperties::ColumnSpacing() | ||
{ | ||
return ValueHelper<int>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_ColumnSpacingProperty)); | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::MaximumColumns(int value) | ||
{ | ||
int coercedValue = value; | ||
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->ValidateGreaterThanZero(coercedValue); | ||
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_MaximumColumnsProperty, ValueHelper<int>::BoxValueIfNecessary(coercedValue)); | ||
} | ||
|
||
int ColumnMajorUniformToLargestGridLayoutProperties::MaximumColumns() | ||
{ | ||
return ValueHelper<int>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_MaximumColumnsProperty)); | ||
} | ||
|
||
void ColumnMajorUniformToLargestGridLayoutProperties::RowSpacing(int value) | ||
{ | ||
static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->SetValue(s_RowSpacingProperty, ValueHelper<int>::BoxValueIfNecessary(value)); | ||
} | ||
|
||
int ColumnMajorUniformToLargestGridLayoutProperties::RowSpacing() | ||
{ | ||
return ValueHelper<int>::CastOrUnbox(static_cast<ColumnMajorUniformToLargestGridLayout*>(this)->GetValue(s_RowSpacingProperty)); | ||
} |
43 changes: 43 additions & 0 deletions
43
dev/Generated/ColumnMajorUniformToLargestGridLayout.properties.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
// DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen | ||
#pragma once | ||
|
||
class ColumnMajorUniformToLargestGridLayoutProperties | ||
{ | ||
public: | ||
ColumnMajorUniformToLargestGridLayoutProperties(); | ||
|
||
void ColumnSpacing(int value); | ||
int ColumnSpacing(); | ||
|
||
void MaximumColumns(int value); | ||
int MaximumColumns(); | ||
|
||
void RowSpacing(int value); | ||
int RowSpacing(); | ||
|
||
static winrt::DependencyProperty ColumnSpacingProperty() { return s_ColumnSpacingProperty; } | ||
static winrt::DependencyProperty MaximumColumnsProperty() { return s_MaximumColumnsProperty; } | ||
static winrt::DependencyProperty RowSpacingProperty() { return s_RowSpacingProperty; } | ||
|
||
static GlobalDependencyProperty s_ColumnSpacingProperty; | ||
static GlobalDependencyProperty s_MaximumColumnsProperty; | ||
static GlobalDependencyProperty s_RowSpacingProperty; | ||
|
||
static void EnsureProperties(); | ||
static void ClearProperties(); | ||
|
||
static void OnColumnSpacingPropertyChanged( | ||
winrt::DependencyObject const& sender, | ||
winrt::DependencyPropertyChangedEventArgs const& args); | ||
|
||
static void OnMaximumColumnsPropertyChanged( | ||
winrt::DependencyObject const& sender, | ||
winrt::DependencyPropertyChangedEventArgs const& args); | ||
|
||
static void OnRowSpacingPropertyChanged( | ||
winrt::DependencyObject const& sender, | ||
winrt::DependencyPropertyChangedEventArgs const& args); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
// DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen | ||
#include "pch.h" | ||
#include "common.h" | ||
#include "RadioButtonsElementFactory.h" | ||
|
||
CppWinRTActivatableClassWithDPFactory(RadioButtonsElementFactory) | ||
|
||
GlobalDependencyProperty RadioButtonsElementFactoryProperties::s_DataTemplateProperty{ nullptr }; | ||
|
||
RadioButtonsElementFactoryProperties::RadioButtonsElementFactoryProperties() | ||
{ | ||
EnsureProperties(); | ||
} | ||
|
||
void RadioButtonsElementFactoryProperties::EnsureProperties() | ||
{ | ||
if (!s_DataTemplateProperty) | ||
{ | ||
s_DataTemplateProperty = | ||
InitializeDependencyProperty( | ||
L"DataTemplate", | ||
winrt::name_of<winrt::DataTemplate>(), | ||
winrt::name_of<winrt::RadioButtonsElementFactory>(), | ||
false /* isAttached */, | ||
ValueHelper<winrt::DataTemplate>::BoxedDefaultValue(), | ||
nullptr); | ||
} | ||
} | ||
|
||
void RadioButtonsElementFactoryProperties::ClearProperties() | ||
{ | ||
s_DataTemplateProperty = nullptr; | ||
} | ||
|
||
void RadioButtonsElementFactoryProperties::DataTemplate(winrt::DataTemplate const& value) | ||
{ | ||
static_cast<RadioButtonsElementFactory*>(this)->SetValue(s_DataTemplateProperty, ValueHelper<winrt::DataTemplate>::BoxValueIfNecessary(value)); | ||
} | ||
|
||
winrt::DataTemplate RadioButtonsElementFactoryProperties::DataTemplate() | ||
{ | ||
return ValueHelper<winrt::DataTemplate>::CastOrUnbox(static_cast<RadioButtonsElementFactory*>(this)->GetValue(s_DataTemplateProperty)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
// DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen | ||
#pragma once | ||
|
||
class RadioButtonsElementFactoryProperties | ||
{ | ||
public: | ||
RadioButtonsElementFactoryProperties(); | ||
|
||
void DataTemplate(winrt::DataTemplate const& value); | ||
winrt::DataTemplate DataTemplate(); | ||
|
||
static winrt::DependencyProperty DataTemplateProperty() { return s_DataTemplateProperty; } | ||
|
||
static GlobalDependencyProperty s_DataTemplateProperty; | ||
|
||
static void EnsureProperties(); | ||
static void ClearProperties(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
// DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen | ||
#include "pch.h" | ||
#include "common.h" | ||
#include "RadioButtonsTestHooks.h" | ||
|
||
CppWinRTActivatableClassWithBasicFactory(RadioButtonsTestHooks) | ||
|
||
|
||
RadioButtonsTestHooksProperties::RadioButtonsTestHooksProperties() | ||
: m_layoutChangedEventSource{static_cast<RadioButtonsTestHooks*>(this)} | ||
{ | ||
} | ||
|
||
void RadioButtonsTestHooksProperties::EnsureProperties() | ||
{ | ||
} | ||
|
||
void RadioButtonsTestHooksProperties::ClearProperties() | ||
{ | ||
} | ||
|
||
winrt::event_token RadioButtonsTestHooksProperties::LayoutChanged(winrt::TypedEventHandler<winrt::RadioButtons, winrt::IInspectable> const& value) | ||
{ | ||
return m_layoutChangedEventSource.add(value); | ||
} | ||
|
||
void RadioButtonsTestHooksProperties::LayoutChanged(winrt::event_token const& token) | ||
{ | ||
m_layoutChangedEventSource.remove(token); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
// DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen | ||
#pragma once | ||
|
||
class RadioButtonsTestHooksProperties | ||
{ | ||
public: | ||
RadioButtonsTestHooksProperties(); | ||
|
||
|
||
|
||
winrt::event_token LayoutChanged(winrt::TypedEventHandler<winrt::RadioButtons, winrt::IInspectable> const& value); | ||
void LayoutChanged(winrt::event_token const& token); | ||
|
||
event_source<winrt::TypedEventHandler<winrt::RadioButtons, winrt::IInspectable>> m_layoutChangedEventSource; | ||
|
||
static void EnsureProperties(); | ||
static void ClearProperties(); | ||
}; |
Oops, something went wrong.