Skip to content

Commit

Permalink
Updated the default namespace for new components (#394)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Arlodotexe authored Mar 10, 2023
1 parent c9ad7b7 commit 3bde759
Show file tree
Hide file tree
Showing 30 changed files with 69 additions and 55 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project>
<PropertyGroup>
<PackageIdPrefix>CommunityToolkit.Labs</PackageIdPrefix>
<RepositoryDirectory>$(MSBuildThisFileDirectory)</RepositoryDirectory>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions common/GlobalUsings_WinUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

global using System.Runtime.InteropServices.WindowsRuntime;

global using CommunityToolkit.Labs.WinUI;

global using Windows.Foundation;
global using Windows.Foundation.Collections;

Expand Down
2 changes: 1 addition & 1 deletion common/ToolkitComponent.SourceProject.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Import Project="$(RepositoryDirectory)common\MultiTarget\MultiTarget.props" />

<PropertyGroup>
<PackageId Condition="'$(PackageId)' == ''">CommunityToolkit.Labs.$(PackageIdVariant).$(ToolkitComponentName)</PackageId>
<PackageId Condition="'$(PackageId)' == ''">$(PackageIdPrefix).$(PackageIdVariant).$(ToolkitComponentName)</PackageId>
</PropertyGroup>

<!-- XAML Pages are automatically included, and don't need to be specified here. -->
Expand Down
2 changes: 2 additions & 0 deletions components/CanvasLayout/samples/CanvasLayoutSample.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions components/CanvasView/tests/ExampleCanvasViewTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions components/Shimmer/tests/ExampleShimmerTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions components/SizerBase/tests/ExampleSizerBaseTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
<Page x:Class="ProjectTemplateExperiment.Samples.ProjectTemplateCustomSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:local="using:ProjectTemplateExperiment.Samples"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Spacing="15">
<TextBlock Style="{StaticResource BodyStrongTextBlockStyle}"
Text="{x:Bind TitleText, Mode=OneWay}" />
<labs:ProjectTemplate Orientation="{x:Bind local:ProjectTemplateCustomSample.ConvertStringToOrientation(LayoutOrientation), Mode=OneWay}">
<controls:ProjectTemplate Orientation="{x:Bind local:ProjectTemplateCustomSample.ConvertStringToOrientation(LayoutOrientation), Mode=OneWay}">
<TextBlock Text="1" />
<TextBlock Text="2" />
<TextBlock Text="3" />
<TextBlock Text="4" />
<TextBlock Text="5" />
<TextBlock Text="6" />
</labs:ProjectTemplate>
</controls:ProjectTemplate>
</StackPanel>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<Page x:Class="ProjectTemplateExperiment.Samples.ProjectTemplateTemplatedSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Spacing="16">
<labs:ProjectTemplate_ClassicBinding FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
<controls:ProjectTemplate_ClassicBinding FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
</StackPanel>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<Page x:Class="ProjectTemplateExperiment.Samples.ProjectTemplateTemplatedStyleCustomSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Import custom styles -->
<ResourceDictionary Source="ms-appx:///CommunityToolkit.Labs.WinUI.ProjectTemplate/ProjectTemplateStyle_ClassicBinding.xaml" />
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.ProjectTemplate/ProjectTemplateStyle_ClassicBinding.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>

<StackPanel Spacing="16">
<labs:ProjectTemplate_ClassicBinding FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Style="{StaticResource CustomClassicBindingProjectTemplateStyle}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
<controls:ProjectTemplate_ClassicBinding FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Style="{StaticResource CustomClassicBindingProjectTemplateStyle}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
</StackPanel>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<Page x:Class="ProjectTemplateExperiment.Samples.ProjectTemplateXbindBackedSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Spacing="16">
<labs:ProjectTemplate_xBind FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
<controls:ProjectTemplate_xBind FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
</StackPanel>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<Page x:Class="ProjectTemplateExperiment.Samples.ProjectTemplateXbindBackedStyleCustomSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Import custom styles -->
<labs:ProjectTemplateStyle_xBind />
<controls:ProjectTemplateStyle_xBind />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>

<StackPanel Spacing="16">
<labs:ProjectTemplate_xBind FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Style="{StaticResource CustomxBindProjectTemplateStyle}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
<controls:ProjectTemplate_xBind FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
FontSize="{x:Bind TextSize, Mode=OneWay}"
Foreground="{x:Bind TextForeground, Mode=OneWay}"
Style="{StaticResource CustomxBindProjectTemplateStyle}"
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
</StackPanel>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Version>0.0.1</Version>

<!-- Rns suffix is required for namespaces shared across projects. See https://github.com/CommunityToolkit/Labs-Windows/issues/152 -->
<RootNamespace>CommunityToolkit.Labs.WinUI.ProjectTemplateRns</RootNamespace>
<RootNamespace>CommunityToolkit.WinUI.Controls.ProjectTemplateRns</RootNamespace>
</PropertyGroup>

<!-- Sets this up as a toolkit component's source project -->
Expand Down
2 changes: 1 addition & 1 deletion template/ProjectTemplate/src/ProjectTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:labs="using:CommunityToolkit.Labs.WinUI">
xmlns:controls="using:CommunityToolkit.WinUI.Controls">

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
Expand All @@ -22,16 +22,16 @@

<!-- Implicitly applied default style -->
<Style BasedOn="{StaticResource DefaultClassicBindingProjectTemplateStyle}"
TargetType="labs:ProjectTemplate_ClassicBinding" />
TargetType="controls:ProjectTemplate_ClassicBinding" />

<Style x:Key="DefaultClassicBindingProjectTemplateStyle"
TargetType="labs:ProjectTemplate_ClassicBinding">
TargetType="controls:ProjectTemplate_ClassicBinding">
<Style.Setters>
<Setter Property="MyProperty" Value="This property has been overriden by the style template" />
<Setter Property="ItemPadding" Value="{StaticResource DefaultProjectTemplateItemPadding}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="labs:ProjectTemplate_ClassicBinding">
<ControlTemplate TargetType="controls:ProjectTemplate_ClassicBinding">
<Grid Padding="{TemplateBinding ItemPadding}">
<StackPanel Spacing="20">
<TextBlock x:Name="PART_HelloWorld"
Expand All @@ -52,7 +52,7 @@
<!-- Minimal, custom style -->
<Style x:Key="CustomClassicBindingProjectTemplateStyle"
BasedOn="{StaticResource DefaultClassicBindingProjectTemplateStyle}"
TargetType="labs:ProjectTemplate_ClassicBinding">
TargetType="controls:ProjectTemplate_ClassicBinding">
<Style.Setters>
<Setter Property="MyProperty" Value="This property has been overriden by a custom style!" />
<Setter Property="ItemPadding" Value="25" />
Expand Down
14 changes: 7 additions & 7 deletions template/ProjectTemplate/src/ProjectTemplateStyle_xBind.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<ResourceDictionary x:Class="CommunityToolkit.Labs.WinUI.ProjectTemplateStyle_xBind"
<ResourceDictionary x:Class="CommunityToolkit.WinUI.Controls.ProjectTemplateStyle_xBind"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:labs="using:CommunityToolkit.Labs.WinUI">
xmlns:controls="using:CommunityToolkit.WinUI.Controls">

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
Expand All @@ -23,21 +23,21 @@

<!-- Implicitly applied default style -->
<Style BasedOn="{StaticResource DefaultxBindProjectTemplateStyle}"
TargetType="labs:ProjectTemplate_xBind" />
TargetType="controls:ProjectTemplate_xBind" />

<Style x:Key="DefaultxBindProjectTemplateStyle"
TargetType="labs:ProjectTemplate_xBind">
TargetType="controls:ProjectTemplate_xBind">
<Style.Setters>
<Setter Property="MyProperty" Value="This property has been overriden by the style template" />
<Setter Property="ItemPadding" Value="{StaticResource DefaultProjectTemplateItemPadding}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="labs:ProjectTemplate_xBind">
<ControlTemplate TargetType="controls:ProjectTemplate_xBind">
<ContentControl x:Name="ContentContainer"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<ContentControl.ContentTemplate>
<DataTemplate x:DataType="labs:ProjectTemplate_xBind">
<DataTemplate x:DataType="controls:ProjectTemplate_xBind">
<Grid Padding="{x:Bind ItemPadding}"
PointerEntered="{x:Bind Element_PointerEntered}">
<StackPanel Spacing="20">
Expand All @@ -59,7 +59,7 @@
<!-- Minimal, custom style -->
<Style x:Key="CustomxBindProjectTemplateStyle"
BasedOn="{StaticResource DefaultxBindProjectTemplateStyle}"
TargetType="labs:ProjectTemplate_xBind">
TargetType="controls:ProjectTemplate_xBind">
<Style.Setters>
<Setter Property="MyProperty" Value="This property has been overriden by a custom style!" />
<Setter Property="ItemPadding" Value="25" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// Backing code for this resource dictionary.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// An example templated control.
Expand Down
2 changes: 1 addition & 1 deletion template/ProjectTemplate/src/ProjectTemplate_xBind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// An example templated control.
Expand Down
6 changes: 3 additions & 3 deletions template/ProjectTemplate/src/Themes/Generic.xaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:labs="using:CommunityToolkit.Labs.WinUI">
xmlns:controls="using:CommunityToolkit.WinUI.Controls">

<ResourceDictionary.MergedDictionaries>
<labs:ProjectTemplateStyle_xBind />
<ResourceDictionary Source="ms-appx:///CommunityToolkit.Labs.WinUI.ProjectTemplate/ProjectTemplateStyle_ClassicBinding.xaml" />
<controls:ProjectTemplateStyle_xBind />
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.ProjectTemplate/ProjectTemplateStyle_ClassicBinding.xaml" />
</ResourceDictionary.MergedDictionaries>

</ResourceDictionary>
Loading

0 comments on commit 3bde759

Please sign in to comment.