Skip to content

Commit 3669d4c

Browse files
authored
Merge pull request #346 from CommunityToolkit/niels9001/settingscontrols
[SettingsControls] Minor tweaks
2 parents fa89b58 + 04613b0 commit 3669d4c

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@
4343
Style="{StaticResource AccentButtonStyle}" />
4444
</labs:SettingsCard>
4545

46-
<labs:SettingsCard Description="When resizing a SettingsCard, the Content will wrap vertically. You can override this breakpoint by setting the SettingsCardWrapThreshold resource."
46+
<labs: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."
4747
Header="Adaptive layouts"
4848
IsEnabled="{x:Bind IsCardEnabled, Mode=OneWay}">
4949
<labs:SettingsCard.HeaderIcon>
5050
<FontIcon Glyph="&#xE745;" />
5151
</labs:SettingsCard.HeaderIcon>
5252
<labs:SettingsCard.Resources>
5353
<x:Double x:Key="SettingsCardWrapThreshold">800</x:Double>
54+
<x:Double x:Key="SettingsCardWrapNoIconThreshold">600</x:Double>
5455
</labs:SettingsCard.Resources>
5556
<Button Content="This control will wrap vertically!"
5657
Style="{StaticResource AccentButtonStyle}" />

labs/SettingsControls/samples/SettingsControls.Samples/SettingsExpanderSample.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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. -->
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. -->
22
<Page x:Class="SettingsControlsExperiment.Samples.SettingsExpanderSample"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

labs/SettingsControls/src/CommunityToolkit.Labs.WinUI.SettingsControls.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<Description>
1919
This package contains the SettingsCard and SettingsExpander controls.
2020
</Description>
21-
<Version>0.0.10</Version>
21+
<Version>0.0.11</Version>
2222
<LangVersion>10.0</LangVersion>
2323
</PropertyGroup>
2424

labs/SettingsControls/src/SettingsCard/SettingsCard.xaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@
9797
<Thickness x:Key="SettingsCardBorderThickness">1</Thickness>
9898
<Thickness x:Key="SettingsCardPadding">16,16,16,16</Thickness>
9999
<Thickness x:Key="SettingsCardIconMargin">2,0,20,0</Thickness>
100-
<x:Double x:Key="SettingsCardMaxWidth">1000</x:Double>
101-
<x:Double x:Key="SettingsCardMinWidth">360</x:Double>
100+
<x:Double x:Key="SettingsCardMinWidth">148</x:Double>
102101
<x:Double x:Key="SettingsCardMinHeight">68</x:Double>
103102
<x:Double x:Key="SettingsCardActionButtonWidth">32</x:Double>
104103
<x:Double x:Key="SettingsCardActionButtonHeight">32</x:Double>
@@ -110,6 +109,7 @@
110109
<Thickness x:Key="SettingsCardHeaderIconMargin">2,0,20,0</Thickness>
111110
<Thickness x:Key="SettingsCardVerticalHeaderContentSpacing">0,4,0,0</Thickness>
112111
<x:Double x:Key="SettingsCardWrapThreshold">460</x:Double>
112+
<x:Double x:Key="SettingsCardWrapNoIconThreshold">286</x:Double>
113113

114114
<Style BasedOn="{StaticResource DefaultSettingsCardStyle}"
115115
TargetType="labs:SettingsCard" />
@@ -125,7 +125,6 @@
125125
<Setter Property="MinHeight" Value="{ThemeResource SettingsCardMinHeight}" />
126126
<!--<Setter Property="win:AutomationProperties.AutomationControlType" Value="Group" />-->
127127
<!--<Setter Property="win:AutomationProperties.Name" Value="{TemplateBinding Header}" />-->
128-
<Setter Property="MaxWidth" Value="{ThemeResource SettingsCardMaxWidth}" />
129128
<Setter Property="MinWidth" Value="{ThemeResource SettingsCardMinWidth}" />
130129
<Setter Property="IsTabStop" Value="False" />
131130
<Setter Property="HorizontalAlignment" Value="Stretch" />
@@ -313,7 +312,8 @@
313312
</VisualState>
314313
<VisualState x:Name="RightWrapped">
315314
<VisualState.StateTriggers>
316-
<labs:ControlSizeTrigger MaxWidth="{ThemeResource SettingsCardWrapThreshold}"
315+
<labs:ControlSizeTrigger MinWidth="{ThemeResource SettingsCardWrapNoIconThreshold}"
316+
MaxWidth="{ThemeResource SettingsCardWrapThreshold}"
317317
TargetElement="{Binding ElementName=PART_RootGrid}" />
318318
</VisualState.StateTriggers>
319319
<VisualState.Setters>
@@ -324,6 +324,20 @@
324324
<Setter Target="PART_ContentPresenter.Margin" Value="{ThemeResource SettingsCardVerticalHeaderContentSpacing}" />
325325
</VisualState.Setters>
326326
</VisualState>
327+
<VisualState x:Name="RightWrappedNoIcon">
328+
<VisualState.StateTriggers>
329+
<labs:ControlSizeTrigger MaxWidth="{ThemeResource SettingsCardWrapNoIconThreshold}"
330+
TargetElement="{Binding ElementName=PART_RootGrid}" />
331+
</VisualState.StateTriggers>
332+
<VisualState.Setters>
333+
<Setter Target="PART_HeaderIconPresenterHolder.Visibility" Value="Collapsed" />
334+
<Setter Target="PART_ContentPresenter.(Grid.Row)" Value="1" />
335+
<Setter Target="PART_ContentPresenter.(Grid.Column)" Value="1" />
336+
<Setter Target="PART_ContentPresenter.HorizontalAlignment" Value="Stretch" />
337+
<Setter Target="PART_ContentPresenter.HorizontalContentAlignment" Value="Left" />
338+
<Setter Target="PART_ContentPresenter.Margin" Value="{ThemeResource SettingsCardVerticalHeaderContentSpacing}" />
339+
</VisualState.Setters>
340+
</VisualState>
327341
<VisualState x:Name="Vertical">
328342
<VisualState.StateTriggers>
329343
<labs:IsEqualStateTrigger Value="{Binding ContentAlignment, RelativeSource={RelativeSource TemplatedParent}}"

labs/SettingsControls/src/SettingsExpander/SettingsExpander.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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. -->
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. -->
22
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
@@ -53,7 +53,6 @@
5353
<Setter Property="BorderThickness" Value="{ThemeResource SettingsCardBorderThickness}" />
5454
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
5555
<Setter Property="MinHeight" Value="{ThemeResource SettingsCardMinHeight}" />
56-
<Setter Property="MaxWidth" Value="{ThemeResource SettingsCardMaxWidth}" />
5756
<Setter Property="MinWidth" Value="{ThemeResource SettingsCardMinWidth}" />
5857
<Setter Property="IsTabStop" Value="False" />
5958
<Setter Property="HorizontalAlignment" Value="Stretch" />

0 commit comments

Comments
 (0)