Skip to content

Commit 819071d

Browse files
niels9001michael-hawker
authored andcommitted
Sample tweaks
1 parent b47b447 commit 819071d

File tree

6 files changed

+35
-61
lines changed

6 files changed

+35
-61
lines changed

components/SettingsControls/samples/ClickableSettingsCardSample.xaml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,28 @@
55
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="using:CommunityToolkit.WinUI"
89
mc:Ignorable="d">
910
<StackPanel Spacing="4">
1011
<controls:SettingsCard x:Name="settingsCard"
1112
Description="A SettingsCard can be made clickable and you can leverage the Command property or Click event."
1213
Header="A clickable SettingsCard"
14+
HeaderIcon="{ui:FontIcon Glyph=&#xE799;}"
1315
IsClickEnabled="True"
14-
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}">
15-
<controls:SettingsCard.HeaderIcon>
16-
<FontIcon Glyph="&#xE799;" />
17-
</controls:SettingsCard.HeaderIcon>
18-
</controls:SettingsCard>
16+
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}" />
1917

20-
<controls:SettingsCard ActionIconToolTip="Open in new window"
18+
<controls:SettingsCard ActionIcon="{ui:FontIcon Glyph=&#xE8A7;}"
19+
ActionIconToolTip="Open in new window"
2120
Description="You can customize the ActionIcon and ActionIconToolTip."
2221
Header="Customizing the ActionIcon"
22+
HeaderIcon="{ui:FontIcon Glyph=&#xE774;}"
2323
IsClickEnabled="True"
24-
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}">
25-
<controls:SettingsCard.HeaderIcon>
26-
<FontIcon Glyph="&#xE774;" />
27-
</controls:SettingsCard.HeaderIcon>
28-
<controls:SettingsCard.ActionIcon>
29-
<FontIcon Glyph="&#xE8A7;" />
30-
</controls:SettingsCard.ActionIcon>
31-
</controls:SettingsCard>
24+
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}" />
25+
3226
<controls:SettingsCard Header="Hiding the ActionIcon"
27+
HeaderIcon="{ui:FontIcon Glyph=&#xE72E;}"
3328
IsActionIconVisible="False"
3429
IsClickEnabled="True"
35-
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}">
36-
<controls:SettingsCard.HeaderIcon>
37-
<FontIcon Glyph="&#xE72E;" />
38-
</controls:SettingsCard.HeaderIcon>
39-
</controls:SettingsCard>
30+
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}" />
4031
</StackPanel>
4132
</Page>

components/SettingsControls/samples/SettingsCardSample.xaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="using:CommunityToolkit.WinUI"
89
mc:Ignorable="d">
910
<StackPanel Spacing="4">
1011
<controls:SettingsCard x:Name="settingsCard"
1112
Description="This is a default card, with the Header, HeaderIcon, Description and Content set."
1213
Header="This is the Header"
14+
HeaderIcon="{ui:FontIcon Glyph=&#xE799;}"
1315
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}">
14-
<controls:SettingsCard.HeaderIcon>
15-
<FontIcon Glyph="&#xE799;" />
16-
</controls:SettingsCard.HeaderIcon>
1716
<ComboBox SelectedIndex="0">
1817
<ComboBoxItem>Option 1</ComboBoxItem>
1918
<ComboBoxItem>Option 2</ComboBoxItem>
@@ -23,11 +22,8 @@
2322

2423
<controls:SettingsCard Description="You can use a FontIcon, SymbolIcon or BitmapIcon to set the cards HeaderIcon."
2524
Header="Icon options"
25+
HeaderIcon="{ui:BitmapIcon Source=ms-appx:///Assets/AppTitleBar.scale-200.png}"
2626
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}">
27-
<controls:SettingsCard.HeaderIcon>
28-
<BitmapIcon ShowAsMonochrome="False"
29-
UriSource="ms-appx:///Assets/SettingsCard.png" />
30-
</controls:SettingsCard.HeaderIcon>
3127
<ToggleSwitch />
3228
</controls:SettingsCard>
3329

@@ -42,10 +38,8 @@
4238

4339
<controls:SettingsCard Description="When resizing a SettingsCard, the Content will wrap vertically. You can override this breakpoint by setting the SettingsCardWrapThreshold resource. For edge cases, you can also hide the icon by setting SettingsCardWrapNoIconThreshold."
4440
Header="Adaptive layouts"
41+
HeaderIcon="{ui:FontIcon Glyph=&#xE745;}"
4542
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}">
46-
<controls:SettingsCard.HeaderIcon>
47-
<FontIcon Glyph="&#xE745;" />
48-
</controls:SettingsCard.HeaderIcon>
4943
<controls:SettingsCard.Resources>
5044
<x:Double x:Key="SettingsCardWrapThreshold">800</x:Double>
5145
<x:Double x:Key="SettingsCardWrapNoIconThreshold">600</x:Double>

components/SettingsControls/samples/SettingsControls.Samples.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55

66
<!-- Sets this up as a toolkit component's sample project -->
77
<Import Project="$(ToolingDirectory)\ToolkitComponent.SampleProject.props" />
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\..\Extensions\src\CommunityToolkit.WinUI.Extensions.csproj"></ProjectReference>
11+
</ItemGroup>
812
</Project>

components/SettingsControls/samples/SettingsExpanderItemsSourceSample.xaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:local="using:SettingsControlsExperiment.Samples"
88
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
99
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
10+
xmlns:ui="using:CommunityToolkit.WinUI"
1011
mc:Ignorable="d">
1112
<Page.Resources>
1213
<ResourceDictionary>
@@ -18,10 +19,8 @@
1819
<StackPanel Spacing="4">
1920
<controls:SettingsExpander Description="The SettingsExpander can use ItemsSource to define its Items."
2021
Header="Settings Expander with ItemsSource"
22+
HeaderIcon="{ui:FontIcon Glyph=&#xEA37;}"
2123
ItemsSource="{x:Bind MyDataSet}">
22-
<controls:SettingsExpander.HeaderIcon>
23-
<FontIcon Glyph="&#xEA37;" />
24-
</controls:SettingsExpander.HeaderIcon>
2524
<controls:SettingsExpander.ItemTemplate>
2625
<DataTemplate x:DataType="local:MyDataModel">
2726
<controls:SettingsCard Description="{x:Bind Info}"
@@ -53,10 +52,8 @@
5352

5453
<controls:SettingsExpander Description="SettingsExpander can use a DataTemplate, DataTemplateSelector, or IElementFactory for its ItemTemplate."
5554
Header="Settings Expander with a custom ItemTemplate"
55+
HeaderIcon="{ui:FontIcon Glyph=&#xE8FD;}"
5656
ItemsSource="{x:Bind MyDataSet}">
57-
<controls:SettingsExpander.HeaderIcon>
58-
<FontIcon Glyph="&#xEA37;" />
59-
</controls:SettingsExpander.HeaderIcon>
6057
<controls:SettingsExpander.ItemTemplate>
6158
<local:MyDataModelTemplateSelector>
6259
<local:MyDataModelTemplateSelector.ButtonTemplate>

components/SettingsControls/samples/SettingsExpanderSample.xaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:local="using:CommunityToolkit.WinUI.Controls"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="using:CommunityToolkit.WinUI"
89
mc:Ignorable="d">
910

1011
<local:SettingsExpander x:Name="settingsCard"
1112
Description="The SettingsExpander has the same properties as a Card, and you can set SettingsCard as part of the Items collection."
1213
Header="SettingsExpander"
14+
HeaderIcon="{ui:FontIcon Glyph=&#xE91B;}"
1315
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}"
1416
IsExpanded="{x:Bind IsCardExpanded, Mode=OneWay}">
1517
<!-- TODO: This should be TwoWay bound but throws compile error in Uno. -->
16-
<local:SettingsExpander.HeaderIcon>
17-
<FontIcon Glyph="&#xE91B;" />
18-
</local:SettingsExpander.HeaderIcon>
1918
<ComboBox SelectedIndex="0">
2019
<ComboBoxItem>Option 1</ComboBoxItem>
2120
<ComboBoxItem>Option 2</ComboBoxItem>

components/SettingsControls/samples/SettingsPageExample.xaml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="using:CommunityToolkit.WinUI"
89
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
910
mc:Ignorable="d">
1011
<Page.Resources>
@@ -34,18 +35,14 @@
3435
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
3536
Text="Section 1" />
3637
<controls:SettingsCard Description="This is a default card, with the Header, HeaderIcon, Description and Content set"
37-
Header="This is the Header">
38-
<controls:SettingsCard.HeaderIcon>
39-
<FontIcon Glyph="&#xE716;" />
40-
</controls:SettingsCard.HeaderIcon>
38+
Header="This is the Header"
39+
HeaderIcon="{ui:FontIcon Glyph=&#xE716;}">
4140
<ToggleSwitch IsOn="True" />
4241
</controls:SettingsCard>
4342

4443
<controls:SettingsExpander Description="The SettingsExpander has the same properties as a SettingsCard"
45-
Header="SettingsExpander">
46-
<controls:SettingsExpander.HeaderIcon>
47-
<FontIcon Glyph="&#xE91B;" />
48-
</controls:SettingsExpander.HeaderIcon>
44+
Header="SettingsExpander"
45+
HeaderIcon="{ui:FontIcon Glyph=&#xE91B;}">
4946
<Button Content="Content"
5047
Style="{StaticResource AccentButtonStyle}" />
5148

@@ -66,10 +63,8 @@
6663
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
6764
Text="Section 2" />
6865
<controls:SettingsCard Description="Another card to show grouping of cards"
69-
Header="Another SettingsCard">
70-
<controls:SettingsCard.HeaderIcon>
71-
<FontIcon Glyph="&#xE799;" />
72-
</controls:SettingsCard.HeaderIcon>
66+
Header="Another SettingsCard"
67+
HeaderIcon="{ui:FontIcon Glyph=&#xE799;}">
7368
<ComboBox SelectedIndex="0">
7469
<ComboBoxItem>Option 1</ComboBoxItem>
7570
<ComboBoxItem>Option 2</ComboBoxItem>
@@ -78,10 +73,8 @@
7873
</controls:SettingsCard>
7974

8075
<controls:SettingsCard Description="Another card to show grouping of cards"
81-
Header="Yet another SettingsCard">
82-
<controls:SettingsCard.HeaderIcon>
83-
<FontIcon Glyph="&#xE768;" />
84-
</controls:SettingsCard.HeaderIcon>
76+
Header="Yet another SettingsCard"
77+
HeaderIcon="{ui:FontIcon Glyph=&#xE768;}">
8578
<Button Content="Content" />
8679
</controls:SettingsCard>
8780

@@ -90,15 +83,11 @@
9083
Text="About" />
9184

9285
<controls:SettingsExpander Description="© 2023. All rights reserved."
93-
Header="Community Toolkit Gallery">
94-
<controls:SettingsExpander.HeaderIcon>
95-
<BitmapIcon ShowAsMonochrome="False"
96-
UriSource="ms-appx:///Assets/AppTitleBar.scale-200.png" />
97-
</controls:SettingsExpander.HeaderIcon>
86+
Header="Community Toolkit Gallery"
87+
HeaderIcon="{ui:BitmapIcon Source=ms-appx:///Assets/AppTitleBar.scale-200.png}">
9888
<TextBlock win:IsTextSelectionEnabled="True"
9989
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
100-
Style="{StaticResource CaptionTextBlockStyle}"
101-
Text="Version 1.0.0.0" />
90+
Text="Version 8.0.0" />
10291
<controls:SettingsExpander.Items>
10392
<controls:SettingsCard HorizontalContentAlignment="Left"
10493
ContentAlignment="Left">

0 commit comments

Comments
 (0)