Skip to content

Commit 5ae673a

Browse files
committed
push
1 parent a37acd3 commit 5ae673a

34 files changed

+1475
-2
lines changed

components/Behaviors/OpenSolution.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
3+
powershell ..\..\tooling\ProjectHeads\GenerateSingleSampleHeads.ps1 -componentPath %CD% %*
2.16 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" Condition="Exists('$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))')" />
3+
4+
<PropertyGroup>
5+
<ToolkitComponentName>Behaviors</ToolkitComponentName>
6+
</PropertyGroup>
7+
8+
<!-- Sets this up as a toolkit component's sample project -->
9+
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />
10+
<ItemGroup Condition="'$(IsWinAppSdk)' != 'true'">
11+
<None Remove="NeedMoreItemTriggerBehavior.xaml" />
12+
<Page Remove="NeedMoreItemTriggerBehavior.xaml" />
13+
<Content Remove="NeedMoreItemTriggerBehavior.xaml" />
14+
<Resource Remove="NeedMoreItemTriggerBehavior.xaml" />
15+
<Compile Remove="NeedMoreItemTriggerBehavior.xaml.cs" />
16+
<Content Remove="NeedMoreItemTriggerBehavior.xaml.cs" />
17+
<AdditionalFiles Remove="ItemsView Behaviors.md" />
18+
<Content Remove="ItemsView Behaviors.md" />
19+
<None Remove="ItemsView Behaviors.md" />
20+
</ItemGroup>
21+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- 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. -->
2+
<Page x:Class="BehaviorsExperiment.Samples.BehaviorsTemplatedSample"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d">
9+
10+
<StackPanel Spacing="16">
11+
<controls:Behaviors_ClassicBinding FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
12+
FontSize="{x:Bind TextSize, Mode=OneWay}"
13+
Foreground="{x:Bind TextForeground, Mode=OneWay}"
14+
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
15+
</StackPanel>
16+
</Page>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace BehaviorsExperiment.Samples;
6+
7+
[ToolkitSampleBoolOption("IsTextVisible", true, Title = "IsVisible")]
8+
// Single values without a colon are used for both label and value.
9+
// To provide a different label for the value, separate with a colon surrounded by a single space on both sides ("label : value").
10+
[ToolkitSampleNumericOption("TextSize", 12, 8, 48, 2, false, Title = "FontSize")]
11+
[ToolkitSampleMultiChoiceOption("TextFontFamily", "Segoe UI", "Arial", "Consolas", Title = "Font family")]
12+
[ToolkitSampleMultiChoiceOption("TextForeground", "Teal : #0ddc8c", "Sand : #e7a676", "Dull green : #5d7577", Title = "Text foreground")]
13+
14+
[ToolkitSample(id: nameof(BehaviorsTemplatedSample), "Templated control", description: "A sample for showing how to create and use a templated control.")]
15+
public sealed partial class BehaviorsTemplatedSample : Page
16+
{
17+
public BehaviorsTemplatedSample()
18+
{
19+
this.InitializeComponent();
20+
}
21+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!-- 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. -->
2+
<Page x:Class="BehaviorsExperiment.Samples.BehaviorsTemplatedStyleCustomSample"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d">
9+
10+
<Page.Resources>
11+
<ResourceDictionary>
12+
<ResourceDictionary.MergedDictionaries>
13+
<!-- Import custom styles -->
14+
<ResourceDictionary Source="ms-appx:///CommunityToolkit.WinUI.Controls.Behaviors/BehaviorsStyle_ClassicBinding.xaml" />
15+
</ResourceDictionary.MergedDictionaries>
16+
</ResourceDictionary>
17+
</Page.Resources>
18+
19+
<StackPanel Spacing="16">
20+
<controls:Behaviors_ClassicBinding FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
21+
FontSize="{x:Bind TextSize, Mode=OneWay}"
22+
Foreground="{x:Bind TextForeground, Mode=OneWay}"
23+
Style="{StaticResource CustomClassicBindingBehaviorsStyle}"
24+
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
25+
</StackPanel>
26+
</Page>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace BehaviorsExperiment.Samples;
6+
7+
[ToolkitSampleBoolOption("IsTextVisible", true, Title = "IsVisible")]
8+
// Single values without a colon are used for both label and value.
9+
// To provide a different label for the value, separate with a colon surrounded by a single space on both sides ("label : value").
10+
[ToolkitSampleNumericOption("TextSize", 12, 8, 48, 2, true, Title = "FontSize")]
11+
[ToolkitSampleMultiChoiceOption("TextFontFamily", "Segoe UI", "Arial", "Consolas", Title = "Font family")]
12+
[ToolkitSampleMultiChoiceOption("TextForeground", "Teal : #0ddc8c", "Sand : #e7a676", "Dull green : #5d7577", Title = "Text foreground")]
13+
14+
[ToolkitSample(id: nameof(BehaviorsTemplatedStyleCustomSample), "Templated control (restyled)", description: "A sample for showing how to create a use and templated control with a custom style.")]
15+
public sealed partial class BehaviorsTemplatedStyleCustomSample : Page
16+
{
17+
public BehaviorsTemplatedStyleCustomSample()
18+
{
19+
this.InitializeComponent();
20+
}
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- 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. -->
2+
<Page x:Class="BehaviorsExperiment.Samples.BehaviorsXbindBackedSample"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d">
9+
10+
<StackPanel Spacing="16">
11+
<controls:Behaviors_xBind FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
12+
FontSize="{x:Bind TextSize, Mode=OneWay}"
13+
Foreground="{x:Bind TextForeground, Mode=OneWay}"
14+
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
15+
</StackPanel>
16+
</Page>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace BehaviorsExperiment.Samples;
6+
7+
[ToolkitSampleBoolOption("IsTextVisible", true, Title = "IsVisible")]
8+
// Single values without a colon are used for both label and value.
9+
// To provide a different label for the value, separate with a colon surrounded by a single space on both sides ("label : value").
10+
[ToolkitSampleNumericOption("TextSize", 12, 8, 48, 2, false, Title = "FontSize")]
11+
[ToolkitSampleMultiChoiceOption("TextFontFamily", "Segoe UI", "Arial", "Consolas", Title = "Font family")]
12+
[ToolkitSampleMultiChoiceOption("TextForeground", "Teal : #0ddc8c", "Sand : #e7a676", "Dull green : #5d7577", Title = "Text foreground")]
13+
14+
[ToolkitSample(id: nameof(BehaviorsXbindBackedSample), "Backed templated control", description: "A sample for showing how to create and use a templated control with a backed resource dictionary.")]
15+
public sealed partial class BehaviorsXbindBackedSample : Page
16+
{
17+
public BehaviorsXbindBackedSample()
18+
{
19+
this.InitializeComponent();
20+
}
21+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!-- 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. -->
2+
<Page
3+
x:Class="BehaviorsExperiment.Samples.BehaviorsXbindBackedStyleCustomSample"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
mc:Ignorable="d">
10+
11+
<Page.Resources>
12+
<ResourceDictionary>
13+
<ResourceDictionary.MergedDictionaries>
14+
<!-- Import custom styles -->
15+
<controls:BehaviorsStyle_xBind />
16+
</ResourceDictionary.MergedDictionaries>
17+
</ResourceDictionary>
18+
</Page.Resources>
19+
20+
<StackPanel Spacing="16">
21+
<controls:Behaviors_xBind
22+
FontFamily="{x:Bind TextFontFamily, Mode=OneWay}"
23+
FontSize="{x:Bind TextSize, Mode=OneWay}"
24+
Foreground="{x:Bind TextForeground, Mode=OneWay}"
25+
Style="{StaticResource CustomxBindBehaviorsStyle}"
26+
Visibility="{x:Bind IsTextVisible, Mode=OneWay}" />
27+
</StackPanel>
28+
</Page>

0 commit comments

Comments
 (0)