Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/SettingsControls/samples/SettingsPageExample.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@
<controls:SettingsCard ContentAlignment="Left">
<CheckBox Content="Here the ContentAlignment is set to Left. This is great for e.g. CheckBoxes or RadioButtons" />
</controls:SettingsCard>
<controls:SettingsCard ContentAlignment="Stretch">
<Border>
<StackPanel>
<TextBlock TextWrapping="WrapWholeWords"
Text="Here the ContentAlignment is set to Stretch, so the content fills the entire card. This is great for controls like Sliders that benefit from having more space." />
<Slider Margin="0,10,0,0"
HorizontalAlignment="Stretch" />
</StackPanel>
</Border>
</controls:SettingsCard>
</controls:SettingsExpander.Items>
</controls:SettingsExpander>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,10 @@ public enum ContentAlignment
/// <summary>
/// The Content is vertically aligned.
/// </summary>
Vertical
Vertical,

/// <summary>
/// The Content stretches and fills all the available space.
/// </summary>
Stretch
}
16 changes: 16 additions & 0 deletions components/SettingsControls/src/SettingsCard/SettingsCard.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,22 @@
<Setter Target="PART_ContentPresenter.HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource TemplatedParent}}" />
</VisualState.Setters>
</VisualState>

<!-- Union Left and Vertical, HeaderIcon/Header/Description collapsed, Content stretches and fills all the available space -->
<VisualState x:Name="Stretch">
<VisualState.StateTriggers>
<tk:IsEqualStateTrigger Value="{Binding ContentAlignment, RelativeSource={RelativeSource TemplatedParent}}"
To="Stretch" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="PART_HeaderIconPresenterHolder.Visibility" Value="Collapsed" />
<Setter Target="PART_DescriptionPresenter.Visibility" Value="Collapsed" />
<Setter Target="PART_HeaderPresenter.Visibility" Value="Collapsed" />
<Setter Target="PART_ContentPresenter.(Grid.Row)" Value="1" />
<Setter Target="PART_ContentPresenter.(Grid.Column)" Value="1" />
<Setter Target="PART_ContentPresenter.HorizontalAlignment" Value="Stretch" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>

<!-- Collapsing the Content presenter whenever it's empty -->
Expand Down