From 3bde759ad98bc81fe25a4268c8e9d1bcc1970aeb Mon Sep 17 00:00:00 2001 From: Arlo Date: Fri, 10 Mar 2023 17:50:28 -0600 Subject: [PATCH] Updated the default namespace for new components (#394) * Updated default root namespace and PackageId * Doc fix * Renamed template csproj * Move PackageId prefix to property in Directory.Build.props * Moved code / docs to new default namespace * Use xmlns:controls instead of xmlns:labs * Use xmlns:controls instead of xmlns:labs * Fixed xaml styling * Removed default component namespace from global usings * Unify default package ID * Fixed missing using directive * Fixed missing using directive --- Directory.Build.props | 1 + common/GlobalUsings_WinUI.cs | 2 -- common/ToolkitComponent.SourceProject.props | 2 +- .../samples/CanvasLayoutSample.xaml.cs | 2 ++ .../tests/ExampleCanvasLayoutTestClass.cs | 1 + .../CanvasView/tests/ExampleCanvasViewTestClass.cs | 1 + .../samples/SegmentedControlBasicSample.xaml.cs | 1 + .../tests/ExampleSegmentedControlTestClass.cs | 1 + .../tests/ExampleSettingsControlsTestClass.cs | 1 + .../Shimmer/tests/ExampleShimmerTestClass.cs | 1 + .../SizerBase/tests/ExampleSizerBaseTestClass.cs | 1 + ...tackedNotificationsBehaviorCustomSample.xaml.cs | 2 ++ ...ExampleStackedNotificationsBehaviorTestClass.cs | 1 + .../samples/ProjectTemplateCustomSample.xaml | 6 +++--- .../samples/ProjectTemplateCustomSample.xaml.cs | 2 ++ .../samples/ProjectTemplateTemplatedSample.xaml | 10 +++++----- .../ProjectTemplateTemplatedStyleCustomSample.xaml | 14 +++++++------- .../samples/ProjectTemplateXbindBackedSample.xaml | 10 +++++----- ...rojectTemplateXbindBackedStyleCustomSample.xaml | 14 +++++++------- ...yToolkit.WinUI.Controls.ProjectTemplate.csproj} | 2 +- template/ProjectTemplate/src/ProjectTemplate.cs | 2 +- .../src/ProjectTemplateStyle_ClassicBinding.xaml | 10 +++++----- .../src/ProjectTemplateStyle_xBind.xaml | 14 +++++++------- .../src/ProjectTemplateStyle_xBind.xaml.cs | 2 +- .../src/ProjectTemplate_ClassicBinding.cs | 2 +- .../ProjectTemplate/src/ProjectTemplate_xBind.cs | 2 +- template/ProjectTemplate/src/Themes/Generic.xaml | 6 +++--- .../tests/ExampleProjectTemplateTestClass.cs | 1 + .../tests/ExampleProjectTemplateTestPage.xaml | 4 ++-- template/README.md | 6 +++--- 30 files changed, 69 insertions(+), 55 deletions(-) rename template/ProjectTemplate/src/{CommunityToolkit.Labs.WinUI.ProjectTemplate.csproj => CommunityToolkit.WinUI.Controls.ProjectTemplate.csproj} (86%) diff --git a/Directory.Build.props b/Directory.Build.props index 158ebd1f0..1b9915078 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,6 @@ + CommunityToolkit.Labs $(MSBuildThisFileDirectory) true diff --git a/common/GlobalUsings_WinUI.cs b/common/GlobalUsings_WinUI.cs index 24d4eb16a..547158a0a 100644 --- a/common/GlobalUsings_WinUI.cs +++ b/common/GlobalUsings_WinUI.cs @@ -7,8 +7,6 @@ global using System.Runtime.InteropServices.WindowsRuntime; -global using CommunityToolkit.Labs.WinUI; - global using Windows.Foundation; global using Windows.Foundation.Collections; diff --git a/common/ToolkitComponent.SourceProject.props b/common/ToolkitComponent.SourceProject.props index a9f7d6578..1e87977be 100644 --- a/common/ToolkitComponent.SourceProject.props +++ b/common/ToolkitComponent.SourceProject.props @@ -10,7 +10,7 @@ - CommunityToolkit.Labs.$(PackageIdVariant).$(ToolkitComponentName) + $(PackageIdPrefix).$(PackageIdVariant).$(ToolkitComponentName) diff --git a/components/CanvasLayout/samples/CanvasLayoutSample.xaml.cs b/components/CanvasLayout/samples/CanvasLayoutSample.xaml.cs index 025fd8e4a..38b0f02a0 100644 --- a/components/CanvasLayout/samples/CanvasLayoutSample.xaml.cs +++ b/components/CanvasLayout/samples/CanvasLayoutSample.xaml.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; + namespace CanvasLayoutExperiment.Samples; /// diff --git a/components/CanvasLayout/tests/ExampleCanvasLayoutTestClass.cs b/components/CanvasLayout/tests/ExampleCanvasLayoutTestClass.cs index a6e227807..2978c1d68 100644 --- a/components/CanvasLayout/tests/ExampleCanvasLayoutTestClass.cs +++ b/components/CanvasLayout/tests/ExampleCanvasLayoutTestClass.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; using CommunityToolkit.Tooling.TestGen; using CommunityToolkit.Tests; diff --git a/components/CanvasView/tests/ExampleCanvasViewTestClass.cs b/components/CanvasView/tests/ExampleCanvasViewTestClass.cs index 4780c6c78..f1881fa85 100644 --- a/components/CanvasView/tests/ExampleCanvasViewTestClass.cs +++ b/components/CanvasView/tests/ExampleCanvasViewTestClass.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; using CommunityToolkit.Tooling.TestGen; using CommunityToolkit.Tests; diff --git a/components/SegmentedControl/samples/SegmentedControlBasicSample.xaml.cs b/components/SegmentedControl/samples/SegmentedControlBasicSample.xaml.cs index 09fd29bb9..9a8904f7d 100644 --- a/components/SegmentedControl/samples/SegmentedControlBasicSample.xaml.cs +++ b/components/SegmentedControl/samples/SegmentedControlBasicSample.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.UI.Xaml.Controls; +using CommunityToolkit.Labs.WinUI; namespace SegmentedControlExperiment.Samples; diff --git a/components/SegmentedControl/tests/ExampleSegmentedControlTestClass.cs b/components/SegmentedControl/tests/ExampleSegmentedControlTestClass.cs index fa1fb4826..c11be1ea8 100644 --- a/components/SegmentedControl/tests/ExampleSegmentedControlTestClass.cs +++ b/components/SegmentedControl/tests/ExampleSegmentedControlTestClass.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; using CommunityToolkit.Tooling.TestGen; using CommunityToolkit.Tests; diff --git a/components/SettingsControls/tests/ExampleSettingsControlsTestClass.cs b/components/SettingsControls/tests/ExampleSettingsControlsTestClass.cs index f3d5b608d..29a8030f7 100644 --- a/components/SettingsControls/tests/ExampleSettingsControlsTestClass.cs +++ b/components/SettingsControls/tests/ExampleSettingsControlsTestClass.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; using CommunityToolkit.Tooling.TestGen; using CommunityToolkit.Tests; diff --git a/components/Shimmer/tests/ExampleShimmerTestClass.cs b/components/Shimmer/tests/ExampleShimmerTestClass.cs index 7e5dc44dd..243e820d3 100644 --- a/components/Shimmer/tests/ExampleShimmerTestClass.cs +++ b/components/Shimmer/tests/ExampleShimmerTestClass.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; using CommunityToolkit.Tooling.TestGen; using CommunityToolkit.Tests; diff --git a/components/SizerBase/tests/ExampleSizerBaseTestClass.cs b/components/SizerBase/tests/ExampleSizerBaseTestClass.cs index c4a6b8b2a..951b3b6a5 100644 --- a/components/SizerBase/tests/ExampleSizerBaseTestClass.cs +++ b/components/SizerBase/tests/ExampleSizerBaseTestClass.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; using CommunityToolkit.Tooling.TestGen; using CommunityToolkit.Tests; using CommunityToolkit.Labs.WinUI.Automation.Peers; diff --git a/components/StackedNotificationsBehavior/samples/StackedNotificationsBehaviorCustomSample.xaml.cs b/components/StackedNotificationsBehavior/samples/StackedNotificationsBehaviorCustomSample.xaml.cs index 2ac06da19..09c9d2792 100644 --- a/components/StackedNotificationsBehavior/samples/StackedNotificationsBehaviorCustomSample.xaml.cs +++ b/components/StackedNotificationsBehavior/samples/StackedNotificationsBehaviorCustomSample.xaml.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; + namespace StackedNotificationsBehaviorExperiment.Samples; /// diff --git a/components/StackedNotificationsBehavior/tests/ExampleStackedNotificationsBehaviorTestClass.cs b/components/StackedNotificationsBehavior/tests/ExampleStackedNotificationsBehaviorTestClass.cs index d3e5a55c7..fe7b0fff3 100644 --- a/components/StackedNotificationsBehavior/tests/ExampleStackedNotificationsBehaviorTestClass.cs +++ b/components/StackedNotificationsBehavior/tests/ExampleStackedNotificationsBehaviorTestClass.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.Labs.WinUI; using CommunityToolkit.Tooling.TestGen; using CommunityToolkit.Tests; diff --git a/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml b/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml index c744fd697..ebaf1b730 100644 --- a/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml +++ b/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml @@ -2,8 +2,8 @@ @@ -11,13 +11,13 @@ - + - + diff --git a/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml.cs b/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml.cs index 26484e6b3..c5adf1769 100644 --- a/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml.cs +++ b/template/ProjectTemplate/samples/ProjectTemplateCustomSample.xaml.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using CommunityToolkit.WinUI.Controls; + namespace ProjectTemplateExperiment.Samples; /// diff --git a/template/ProjectTemplate/samples/ProjectTemplateTemplatedSample.xaml b/template/ProjectTemplate/samples/ProjectTemplateTemplatedSample.xaml index 06374b718..be0e62ea5 100644 --- a/template/ProjectTemplate/samples/ProjectTemplateTemplatedSample.xaml +++ b/template/ProjectTemplate/samples/ProjectTemplateTemplatedSample.xaml @@ -2,15 +2,15 @@ - + diff --git a/template/ProjectTemplate/samples/ProjectTemplateTemplatedStyleCustomSample.xaml b/template/ProjectTemplate/samples/ProjectTemplateTemplatedStyleCustomSample.xaml index 12d353f09..50f1c6768 100644 --- a/template/ProjectTemplate/samples/ProjectTemplateTemplatedStyleCustomSample.xaml +++ b/template/ProjectTemplate/samples/ProjectTemplateTemplatedStyleCustomSample.xaml @@ -2,8 +2,8 @@ @@ -11,16 +11,16 @@ - + - + diff --git a/template/ProjectTemplate/samples/ProjectTemplateXbindBackedSample.xaml b/template/ProjectTemplate/samples/ProjectTemplateXbindBackedSample.xaml index c7661a1b4..ee1ac3c6d 100644 --- a/template/ProjectTemplate/samples/ProjectTemplateXbindBackedSample.xaml +++ b/template/ProjectTemplate/samples/ProjectTemplateXbindBackedSample.xaml @@ -2,15 +2,15 @@ - + diff --git a/template/ProjectTemplate/samples/ProjectTemplateXbindBackedStyleCustomSample.xaml b/template/ProjectTemplate/samples/ProjectTemplateXbindBackedStyleCustomSample.xaml index ecfb01deb..8782b94e6 100644 --- a/template/ProjectTemplate/samples/ProjectTemplateXbindBackedStyleCustomSample.xaml +++ b/template/ProjectTemplate/samples/ProjectTemplateXbindBackedStyleCustomSample.xaml @@ -2,8 +2,8 @@ @@ -11,16 +11,16 @@ - + - + diff --git a/template/ProjectTemplate/src/CommunityToolkit.Labs.WinUI.ProjectTemplate.csproj b/template/ProjectTemplate/src/CommunityToolkit.WinUI.Controls.ProjectTemplate.csproj similarity index 86% rename from template/ProjectTemplate/src/CommunityToolkit.Labs.WinUI.ProjectTemplate.csproj rename to template/ProjectTemplate/src/CommunityToolkit.WinUI.Controls.ProjectTemplate.csproj index b9fb7aace..5dc2b1e98 100644 --- a/template/ProjectTemplate/src/CommunityToolkit.Labs.WinUI.ProjectTemplate.csproj +++ b/template/ProjectTemplate/src/CommunityToolkit.WinUI.Controls.ProjectTemplate.csproj @@ -5,7 +5,7 @@ 0.0.1 - CommunityToolkit.Labs.WinUI.ProjectTemplateRns + CommunityToolkit.WinUI.Controls.ProjectTemplateRns diff --git a/template/ProjectTemplate/src/ProjectTemplate.cs b/template/ProjectTemplate/src/ProjectTemplate.cs index 0f3f02d0d..87911049f 100644 --- a/template/ProjectTemplate/src/ProjectTemplate.cs +++ b/template/ProjectTemplate/src/ProjectTemplate.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace CommunityToolkit.Labs.WinUI; +namespace CommunityToolkit.WinUI.Controls; /// /// This is an example control based off of the BoxPanel sample here: https://docs.microsoft.com/windows/apps/design/layout/boxpanel-example-custom-panel. If you need this similar sort of layout component for an application, see UniformGrid in the Toolkit. diff --git a/template/ProjectTemplate/src/ProjectTemplateStyle_ClassicBinding.xaml b/template/ProjectTemplate/src/ProjectTemplateStyle_ClassicBinding.xaml index b609a5716..78c1c522c 100644 --- a/template/ProjectTemplate/src/ProjectTemplateStyle_ClassicBinding.xaml +++ b/template/ProjectTemplate/src/ProjectTemplateStyle_ClassicBinding.xaml @@ -1,7 +1,7 @@  + xmlns:controls="using:CommunityToolkit.WinUI.Controls"> @@ -22,16 +22,16 @@