Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadioButtons: Wrap custom ItemTemplate in a RadioButton if required #3194

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MUXControls.sln
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RadioButtons", "dev\RadioBu
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_TestUI", "dev\RadioButtons\TestUI\RadioButtons_TestUI.shproj", "{833A6892-A079-469A-81C7-54D4CD88029B}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_APITests", "dev\RadioButtons\APITests\RadioButtons_APITests.shproj", "{0352711A-D79A-4D82-8255-916D29522AE0}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_InteractionTests", "dev\RadioButtons\InteractionTests\RadioButtons_InteractionTests.shproj", "{42D6E8F9-59FE-4CA5-83EB-69A7622F5742}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommonStyles", "CommonStyles", "{807E57C8-F3E8-4049-AB88-BE3D3285B441}"
Expand Down Expand Up @@ -661,6 +663,7 @@ Global
dev\ComboBox\ComboBox.vcxitems*{00523caf-422a-4185-9392-d374b72a019a}*SharedItemsImports = 9
dev\ParallaxView\TestUI\ParallaxView_TestUI.projitems*{00c52fd5-42fd-33b4-84a0-795c9b5a014d}*SharedItemsImports = 13
dev\lights\ApiTests\Lights_ApiTests\Lights_ApiTests.projitems*{02ed27be-97e4-4327-bb96-8b3fa6869c48}*SharedItemsImports = 13
dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{0352711a-d79a-4d82-8255-916d29522ae0}*SharedItemsImports = 13
dev\Telemetry\Telemetry.vcxitems*{0db22ba9-6053-459b-baf5-e82ea1c78ab3}*SharedItemsImports = 9
dev\ScrollPresenter\TestUI\ScrollPresenter_TestUI.projitems*{0ec52fd5-42fe-3eb4-84e0-79ec9b5a014e}*SharedItemsImports = 13
dev\ProgressBar\ProgressBar.vcxitems*{0f61c8bd-d066-4812-a02b-e95ce18a985d}*SharedItemsImports = 9
Expand Down Expand Up @@ -923,6 +926,7 @@ Global
dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\TestUI\ScrollViewerAdapter_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\PullToRefresh\TestUI\PTR_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\RadialGradientBrush\TestUI\RadialGradientBrush_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\RadioButtons\TestUI\RadioButtons_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\RadioMenuFlyoutItem\TestUI\RadioMenuFlyoutItem_TestUI.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
dev\RatingControl\APITests\RatingControl_APITests.projitems*{dedc1e4f-cfa5-4443-83eb-e79d425df7e7}*SharedItemsImports = 4
Expand Down Expand Up @@ -1016,6 +1020,7 @@ Global
dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\TestUI\ScrollViewerAdapter_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PullToRefresh\TestUI\PTR_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RadialGradientBrush\TestUI\RadialGradientBrush_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RadioButtons\TestUI\RadioButtons_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RadioMenuFlyoutItem\TestUI\RadioMenuFlyoutItem_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RatingControl\APITests\RatingControl_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
Expand Down Expand Up @@ -1507,6 +1512,7 @@ Global
{D232C226-CD18-4509-B848-80083AA9892B} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{E770A6D3-7252-4E8A-BD10-FA8524DF8C83} = {D232C226-CD18-4509-B848-80083AA9892B}
{833A6892-A079-469A-81C7-54D4CD88029B} = {D232C226-CD18-4509-B848-80083AA9892B}
{0352711A-D79A-4D82-8255-916D29522AE0} = {D232C226-CD18-4509-B848-80083AA9892B}
{42D6E8F9-59FE-4CA5-83EB-69A7622F5742} = {D232C226-CD18-4509-B848-80083AA9892B}
{807E57C8-F3E8-4049-AB88-BE3D3285B441} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{3A07FA59-C5C1-4B46-8B31-043F9CA91226} = {807E57C8-F3E8-4049-AB88-BE3D3285B441}
Expand Down
5 changes: 4 additions & 1 deletion MUXControlsInnerLoop.sln
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RadioButtons", "dev\RadioBu
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_TestUI", "dev\RadioButtons\TestUI\RadioButtons_TestUI.shproj", "{833A6892-A079-469A-81C7-54D4CD88029B}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_APITests", "dev\RadioButtons\APITests\RadioButtons_APITests.shproj", "{0352711A-D79A-4D82-8255-916D29522AE0}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "RadioButtons_InteractionTests", "dev\RadioButtons\InteractionTests\RadioButtons_InteractionTests.shproj", "{42D6E8F9-59FE-4CA5-83EB-69A7622F5742}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommonStyles", "CommonStyles", "{807E57C8-F3E8-4049-AB88-BE3D3285B441}"
Expand Down Expand Up @@ -468,6 +470,7 @@ Global
dev\ComboBox\ComboBox.vcxitems*{00523caf-422a-4185-9392-d374b72a019a}*SharedItemsImports = 9
dev\ParallaxView\TestUI\ParallaxView_TestUI.projitems*{00c52fd5-42fd-33b4-84a0-795c9b5a014d}*SharedItemsImports = 13
dev\lights\ApiTests\Lights_ApiTests\Lights_ApiTests.projitems*{02ed27be-97e4-4327-bb96-8b3fa6869c48}*SharedItemsImports = 13
dev\RadioButtons\APITests\RadioButtons_APITests.projitems*{0352711a-d79a-4d82-8255-916d29522ae0}*SharedItemsImports = 13
dev\Telemetry\Telemetry.vcxitems*{0db22ba9-6053-459b-baf5-e82ea1c78ab3}*SharedItemsImports = 9
dev\ScrollPresenter\TestUI\ScrollPresenter_TestUI.projitems*{0ec52fd5-42fe-3eb4-84e0-79ec9b5a014e}*SharedItemsImports = 13
dev\ProgressBar\ProgressBar.vcxitems*{0f61c8bd-d066-4812-a02b-e95ce18a985d}*SharedItemsImports = 9
Expand Down Expand Up @@ -928,6 +931,7 @@ Global
{D232C226-CD18-4509-B848-80083AA9892B} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{E770A6D3-7252-4E8A-BD10-FA8524DF8C83} = {D232C226-CD18-4509-B848-80083AA9892B}
{833A6892-A079-469A-81C7-54D4CD88029B} = {D232C226-CD18-4509-B848-80083AA9892B}
{0352711A-D79A-4D82-8255-916D29522AE0} = {D232C226-CD18-4509-B848-80083AA9892B}
{42D6E8F9-59FE-4CA5-83EB-69A7622F5742} = {D232C226-CD18-4509-B848-80083AA9892B}
{807E57C8-F3E8-4049-AB88-BE3D3285B441} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{3A07FA59-C5C1-4B46-8B31-043F9CA91226} = {807E57C8-F3E8-4049-AB88-BE3D3285B441}
Expand Down Expand Up @@ -1007,7 +1011,6 @@ Global
{8B056B8F-C1AB-4A80-BD17-DEACE9897E6A} = {2165C785-9365-4615-B227-8E9C7444ECE1}
{AE308818-AF18-48BA-BF33-89779083D297} = {2165C785-9365-4615-B227-8E9C7444ECE1}
{74D18B1B-5F6B-4534-945B-131E8E3206FB} = {2165C785-9365-4615-B227-8E9C7444ECE1}
{80AF98CA-BC1D-4011-8460-5671799EC419} = {E95C2CA1-FF23-47CC-A896-CC5175B37890}
{6F7831A4-48F8-41E8-A573-C567A1223CB5} = {05CB5DBD-A481-4DFF-B1A3-642F049D165C}
{0EC260CC-03C7-4790-B16A-43428EBCF5AD} = {67599AD5-51EC-44CB-85CE-B60CD8CBA270}
{3566798E-9E24-44EF-B89D-2A62AE8F697A} = {0EC260CC-03C7-4790-B16A-43428EBCF5AD}
Expand Down
2 changes: 1 addition & 1 deletion dev/Generated/RadioButtons.properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void RadioButtonsProperties::EnsureProperties()
winrt::name_of<winrt::IInspectable>(),
winrt::name_of<winrt::RadioButtons>(),
false /* isAttached */,
ValueHelper<winrt::IInspectable>::BoxValueIfNecessary(winrt::make<RadioButtonsElementFactory>()),
ValueHelper<winrt::IInspectable>::BoxedDefaultValue(),
winrt::PropertyChangedCallback(&OnItemTemplatePropertyChanged));
}
if (!s_MaxColumnsProperty)
Expand Down
83 changes: 83 additions & 0 deletions dev/RadioButtons/APITests/RadioButtonsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using MUXControlsTestApp.Utilities;

using Windows.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls;
using Common;
using Windows.UI.Xaml.Markup;
using System.Collections.Generic;
using Windows.UI.Xaml.Media;

#if USING_TAEF
using WEX.TestExecution;
using WEX.TestExecution.Markup;
using WEX.Logging.Interop;
#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.Logging;
#endif

namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
{
[TestClass]
public class RadioButtonsTests : ApiTestBase
{
[TestMethod]
public void VerifyCustomItemTemplate()
{
RadioButtons radioButtons = null;
RadioButtons radioButtons2 = null;
RunOnUIThread.Execute(() =>
{
radioButtons = new RadioButtons();
radioButtons.ItemsSource = new List<string>() { "Option 1", "Option 2" };

// Set a custom ItemTemplate to be wrapped in a RadioButton.
var itemTemplate = (DataTemplate)XamlReader.Load(
@"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
<TextBlock Text = '{Binding}'/>
</DataTemplate>");

radioButtons.ItemTemplate = itemTemplate;

radioButtons2 = new RadioButtons();
radioButtons2.ItemsSource = new List<string>() { "Option 1", "Option 2" };

// Set a custom ItemTemplate which is already a RadioButton. No wrapping should be performed.
var itemTemplate2 = (DataTemplate)XamlReader.Load(
@"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
<RadioButton Foreground='Blue'>
<TextBlock Text = '{Binding}'/>
</RadioButton>
</DataTemplate>");

radioButtons2.ItemTemplate = itemTemplate2;

var stackPanel = new StackPanel();
stackPanel.Children.Add(radioButtons);
stackPanel.Children.Add(radioButtons2);

Content = stackPanel;
Content.UpdateLayout();
});

IdleSynchronizer.Wait();

RunOnUIThread.Execute(() =>
{
var radioButton1 = radioButtons.ContainerFromIndex(0) as RadioButton;
var radioButton2 = radioButtons2.ContainerFromIndex(0) as RadioButton;
Verify.IsNotNull(radioButton1, "Our custom ItemTemplate should have been wrapped in a RadioButton.");
Verify.IsNotNull(radioButton2, "Our custom ItemTemplate should have been wrapped in a RadioButton.");

bool testCondition = !(radioButton1.Foreground is SolidColorBrush brush && brush.Color == Colors.Blue);
StephenLPeters marked this conversation as resolved.
Show resolved Hide resolved
Verify.IsTrue(testCondition, "Default foreground color of the RadioButton should not have been [blue].");

testCondition = radioButton2.Foreground is SolidColorBrush brush2 && brush2.Color == Colors.Blue;
Verify.IsTrue(testCondition, "The foreground color of the RadioButton should have been [blue].");
});
}
}
}
14 changes: 14 additions & 0 deletions dev/RadioButtons/APITests/RadioButtons_APITests.projitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>0352711a-d79a-4d82-8255-916d29522ae0</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>RadioButtons_APITests</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)RadioButtonsTests.cs" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions dev/RadioButtons/APITests/RadioButtons_APITests.shproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>0352711a-d79a-4d82-8255-916d29522ae0</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="RadioButtons_APITests.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
13 changes: 13 additions & 0 deletions dev/RadioButtons/RadioButtons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ RadioButtons::RadioButtons()
AccessKeyInvoked({ this, &RadioButtons::OnAccessKeyInvoked });
GettingFocus({ this, &RadioButtons::OnGettingFocus });

m_radioButtonsElementFactory = winrt::make_self<RadioButtonsElementFactory>();
Felix-Dev marked this conversation as resolved.
Show resolved Hide resolved

// RadioButtons adds handlers to its child radio button elements' checked and unchecked events.
// To ensure proper lifetime management we create revokers for these elements and attach
// the revokers to the child radio button via this attached property. This way, if/when the child
Expand All @@ -50,6 +52,8 @@ void RadioButtons::OnApplyTemplate()
m_repeater.set([this, controlProtected]() {
if (auto const repeater = GetTemplateChildT<winrt::ItemsRepeater>(s_repeaterName, controlProtected))
{
repeater.ItemTemplate(*m_radioButtonsElementFactory);

m_repeaterElementPreparedRevoker = repeater.ElementPrepared(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementPrepared });
m_repeaterElementClearingRevoker = repeater.ElementClearing(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementClearing });
m_repeaterElementIndexChangedRevoker = repeater.ElementIndexChanged(winrt::auto_revoke, { this, &RadioButtons::OnRepeaterElementIndexChanged });
Expand Down Expand Up @@ -479,6 +483,10 @@ void RadioButtons::OnPropertyChanged(const winrt::DependencyPropertyChangedEvent
{
UpdateSelectedItem();
}
else if (property == s_ItemTemplateProperty)
{
UpdateItemTemplate();
}
}

winrt::UIElement RadioButtons::ContainerFromIndex(int index)
Expand Down Expand Up @@ -539,6 +547,11 @@ void RadioButtons::UpdateSelectedItem()
}
}

void RadioButtons::UpdateItemTemplate()
{
m_radioButtonsElementFactory->UserElementFactory(ItemTemplate());
}

// Test Hooks helpers, only function when m_testHooksEnabled == true
void RadioButtons::SetTestHooksEnabled(bool enabled)
{
Expand Down
4 changes: 4 additions & 0 deletions dev/RadioButtons/RadioButtons.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class RadioButtons :
void Select(int index);
winrt::IInspectable GetDataAtIndex(int index, bool containerIsChecked);

void UpdateItemTemplate();

winrt::FindNextElementOptions GetFindNextElementOptions();
bool MoveFocusNext();
bool MoveFocusPrevious();
Expand All @@ -83,6 +85,8 @@ class RadioButtons :

tracker_ref<winrt::ItemsRepeater> m_repeater{ this };

com_ptr<RadioButtonsElementFactory> m_radioButtonsElementFactory{ nullptr };

winrt::Control::Loaded_revoker m_repeaterLoadedRevoker{};
winrt::ItemsSourceView::CollectionChanged_revoker m_itemsSourceChanged{};
winrt::ItemsRepeater::ElementPrepared_revoker m_repeaterElementPreparedRevoker{};
Expand Down
1 change: 0 additions & 1 deletion dev/RadioButtons/RadioButtons.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ unsealed runtimeclass RadioButtons : Windows.UI.Xaml.Controls.Control

Object ItemsSource;
Windows.Foundation.Collections.IVector<Object> Items{ get; };
[MUX_DEFAULT_VALUE("winrt::make<RadioButtonsElementFactory>()")]
Object ItemTemplate;

Windows.UI.Xaml.UIElement ContainerFromIndex(Int32 index);
Expand Down
2 changes: 1 addition & 1 deletion dev/RadioButtons/RadioButtons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ContentPresenter
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"/>
<local:ItemsRepeater x:Name="InnerRepeater" ItemTemplate="{TemplateBinding ItemTemplate}">
<local:ItemsRepeater x:Name="InnerRepeater">
<local:ItemsRepeater.Layout>
<primitives:ColumnMajorUniformToLargestGridLayout
MaxColumns="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MaxColumns}"
Expand Down
39 changes: 34 additions & 5 deletions dev/RadioButtons/RadioButtonsElementFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "pch.h"
#include "common.h"
#include "ItemTemplateWrapper.h"
#include "ResourceAccessor.h"
#include "Utils.h"
#include "RadioButtonsElementFactory.h"
Expand All @@ -11,18 +12,46 @@ RadioButtonsElementFactory::RadioButtonsElementFactory()
{
}

void RadioButtonsElementFactory::UserElementFactory(const winrt::IInspectable& newValue)
{
m_itemTemplateWrapper = newValue.try_as<winrt::IElementFactoryShim>();
if (!m_itemTemplateWrapper)
{
// ItemTemplate set does not implement IElementFactoryShim. We also want to support DataTemplate.
if (auto const dataTemplate = newValue.try_as<winrt::DataTemplate>())
{
m_itemTemplateWrapper = winrt::make<ItemTemplateWrapper>(dataTemplate);
}
}
}

winrt::UIElement RadioButtonsElementFactory::GetElementCore(const winrt::ElementFactoryGetArgs& args)
{
if (auto const radioButton = args.Data().try_as<winrt::RadioButton>())
auto const newContent = [itemTemplateWrapper = m_itemTemplateWrapper, args]() {
if (itemTemplateWrapper)
{
return itemTemplateWrapper.GetElement(args).as<winrt::IInspectable>();
}
return args.Data();
}();

// Element is already a RadioButton, so we just return it.
if (auto const radioButton = newContent.try_as<winrt::RadioButton>())
{
return radioButton;
}
else

// Element is not a RadioButton. We'll wrap it in a RadioButton now.
auto const newRadioButton = winrt::RadioButton{};
newRadioButton.Content(args.Data());

// If a user provided item template exists, we pass the template down to the ContentPresenter of the RadioButton.
if (auto const itemTemplateWrapper = m_itemTemplateWrapper.try_as<ItemTemplateWrapper>())
{
auto const newRadioButton = winrt::RadioButton{};
newRadioButton.Content(args.Data());
return newRadioButton;
newRadioButton.ContentTemplate(itemTemplateWrapper->Template());
}

return newRadioButton;
}

void RadioButtonsElementFactory::RecycleElementCore(const winrt::ElementFactoryRecycleArgs& args)
Expand Down
5 changes: 4 additions & 1 deletion dev/RadioButtons/RadioButtonsElementFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ class RadioButtonsElementFactory :
{
public:
RadioButtonsElementFactory();


void UserElementFactory(const winrt::IInspectable& newValue);
winrt::UIElement GetElementCore(const winrt::ElementFactoryGetArgs& args) override;
void RecycleElementCore(const winrt::ElementFactoryRecycleArgs& args) override;

private:
winrt::IElementFactoryShim m_itemTemplateWrapper{ nullptr };
};

1 change: 1 addition & 0 deletions test/MUXControlsTestApp/MUXControlsTestApp.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\PersonPicture\APITests\PersonPicture_APITests.projitems" Label="Shared" Condition="$(FeaturePersonPictureEnabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\PullToRefresh\RefreshVisualizer\APITests\RefreshVisualizer_APITests.projitems" Label="Shared" Condition="$(FeaturePullToRefreshEnabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\APITests\APITests.projitems" Label="Shared" Condition="$(FeaturePullToRefreshEnabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\RadioButtons\APITests\RadioButtons_APITests.projitems" Label="Shared" Condition="$(FeatureRadioButtonsEnabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\RadioButtons\TestUI\RadioButtons_TestUI.projitems" Label="Shared" Condition="$(FeatureRadioButtonsEnabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\RatingControl\APITests\RatingControl_APITests.projitems" Label="Shared" Condition="$(FeatureRatingControlEnabled) == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\..\..\dev\Repeater\APITests\Repeater_APITests.projitems" Label="Shared" Condition="$(FeatureRepeaterEnabled) == 'true'" />
Expand Down