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
7 changes: 7 additions & 0 deletions components/Sizers/src/ContentSizer/ContentSizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ namespace CommunityToolkit.WinUI.Controls;
/// </summary>
public partial class ContentSizer : SizerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="ContentSizer"/> class.
/// </summary>
public ContentSizer()
{
DefaultStyleKey = typeof(ContentSizer);
}
}
4 changes: 2 additions & 2 deletions components/Sizers/src/GridSplitter/GridSplitter.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override bool OnDragVertical(double verticalChange)
var currentChange = _currentSize + verticalChange;
var siblingChange = _siblingSize + (verticalChange * -1); // sibling moves opposite

// Would changing the columnn sizes violate the constraints?
// Would changing the column sizes violate the constraints?
if (!IsValidRowHeight(CurrentRow, currentChange) || !IsValidRowHeight(SiblingRow, siblingChange))
{
return false;
Expand Down Expand Up @@ -125,7 +125,7 @@ protected override bool OnDragHorizontal(double horizontalChange)
var currentChange = _currentSize + horizontalChange;
var siblingChange = _siblingSize + (horizontalChange * -1); // sibling moves opposite

// Would changing the columnn sizes violate the constraints?
// Would changing the column sizes violate the constraints?
if (!IsValidColumnWidth(CurrentColumn, currentChange) || !IsValidColumnWidth(SiblingColumn, siblingChange))
{
return false;
Expand Down
8 changes: 8 additions & 0 deletions components/Sizers/src/GridSplitter/GridSplitter.cs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move the constructor up after the private fields to align with the structure used in other components?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, adding this to DefaultStyleKey for consistency with the other controls in this solution. (I realize not all controls use this but aligning here might help maintain consistency.)

Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,12 @@ private RowDefinition? SiblingRow
return null;
}
}

/// <summary>
/// Initializes a new instance of the <see cref="GridSplitter"/> class.
/// </summary>
public GridSplitter()
{
DefaultStyleKey = typeof(GridSplitter);
}
}
7 changes: 7 additions & 0 deletions components/Sizers/src/PropertySizer/PropertySizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ namespace CommunityToolkit.WinUI.Controls;
/// </summary>
public partial class PropertySizer : SizerBase
{
/// <summary>
/// Initializes a new instance of the <see cref="PropertySizer"/> class.
/// </summary>
public PropertySizer()
{
DefaultStyleKey = typeof(PropertySizer);
}
}
2 changes: 1 addition & 1 deletion components/Sizers/src/SizerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected override void OnApplyTemplate()
// Ensure we have the proper cursor value setup, as we can only set now for WinUI 3
OnOrientationPropertyChanged(this, null!);

// Ensure we set the Thumb visiblity
// Ensure we set the Thumb visibility
OnIsThumbVisiblePropertyChanged(this, null!);
}

Expand Down
25 changes: 24 additions & 1 deletion components/Sizers/src/SizerBase.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,23 @@
ResourceKey="SystemColorButtonTextColorBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<x:Double x:Key="SizerBaseThumbHeight">24</x:Double>
<x:Double x:Key="SizerBaseThumbWidth">4</x:Double>
<x:Double x:Key="SizerBaseThumbRadius">2</x:Double>
<Thickness x:Key="SizerBasePadding">4</Thickness>

<Style TargetType="controls:SizerBase">
<Style BasedOn="{StaticResource DefaultSizerBaseStyle}"
TargetType="controls:SizerBase" />
<Style BasedOn="{StaticResource DefaultContentSizerStyle}"
TargetType="controls:ContentSizer" />
<Style BasedOn="{StaticResource DefaultGridSplitterStyle}"
TargetType="controls:GridSplitter" />
<Style BasedOn="{StaticResource DefaultPropertySizerStyle}"
TargetType="controls:PropertySizer" />

<Style x:Key="DefaultSizerBaseStyle"
TargetType="controls:SizerBase">
<Setter Property="IsTabStop" Value="True" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
Expand Down Expand Up @@ -124,4 +135,16 @@
</Setter>
</Style>

<Style x:Key="DefaultContentSizerStyle"
BasedOn="{StaticResource DefaultSizerBaseStyle}"
TargetType="controls:ContentSizer" />

<Style x:Key="DefaultGridSplitterStyle"
BasedOn="{StaticResource DefaultSizerBaseStyle}"
TargetType="controls:GridSplitter" />

<Style x:Key="DefaultPropertySizerStyle"
BasedOn="{StaticResource DefaultSizerBaseStyle}"
TargetType="controls:PropertySizer" />

</ResourceDictionary>
Loading