Skip to content

Commit aff1fb0

Browse files
committed
Merge branch 'main' into winui
# Conflicts: # CommunityToolkit.WinUI.UI.Controls.Input/ColorPicker/ColorPicker.cs # CommunityToolkit.WinUI.UI.Controls.Input/ColorPicker/ColorPicker.xaml # CommunityToolkit.WinUI.UI.Controls.Input/ColorPicker/ColorPickerButton.cs
2 parents 955d434 + 28444e9 commit aff1fb0

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

CommunityToolkit.WinUI.UI.Controls.Input/ColorPicker/ColorPicker.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Microsoft.UI.Xaml.Media;
1717
using Windows.UI;
1818
using ColorPickerSlider = CommunityToolkit.WinUI.UI.Controls.Primitives.ColorPickerSlider;
19+
using ColorSpectrum = Microsoft.UI.Xaml.Controls.Primitives.ColorSpectrum;
1920

2021
namespace CommunityToolkit.WinUI.UI.Controls
2122
{

CommunityToolkit.WinUI.UI.Controls.Input/ColorPicker/ColorPicker.xaml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
55
xmlns:localconverters="using:CommunityToolkit.WinUI.UI.Controls.ColorPickerConverters"
66
xmlns:primitives="using:CommunityToolkit.WinUI.UI.Controls.Primitives"
7-
xmlns:ui="using:CommunityToolkit.WinUI.UI">
7+
xmlns:ui="using:CommunityToolkit.WinUI.UI"
8+
xmlns:winuiprimitives="using:Microsoft.UI.Xaml.Controls.Primitives">
89

910
<SolidColorBrush x:Key="CheckerboardColor0">
1011
<SolidColorBrush.Color>
@@ -120,23 +121,23 @@
120121
Orientation="Vertical" />
121122
<!-- Keep in mind the spectrum is always HSV -->
122123
<!-- This must also not be named 'ColorSpectrum' to differentiate from the base class -->
123-
<ColorSpectrum x:Name="ColorSpectrumControl"
124-
Grid.Row="0"
125-
Grid.RowSpan="2"
126-
Grid.Column="1"
127-
MinWidth="256"
128-
MinHeight="256"
129-
HorizontalAlignment="Stretch"
130-
VerticalAlignment="Stretch"
131-
AutomationProperties.Name="Third Dimension"
132-
Components="{TemplateBinding ColorSpectrumComponents}"
133-
MaxHue="{TemplateBinding MaxHue}"
134-
MaxSaturation="{TemplateBinding MaxSaturation}"
135-
MaxValue="{TemplateBinding MaxValue}"
136-
MinHue="{TemplateBinding MinHue}"
137-
MinSaturation="{TemplateBinding MinSaturation}"
138-
MinValue="{TemplateBinding MinValue}"
139-
Shape="{TemplateBinding ColorSpectrumShape}" />
124+
<winuiprimitives:ColorSpectrum x:Name="ColorSpectrumControl"
125+
Grid.Row="0"
126+
Grid.RowSpan="2"
127+
Grid.Column="1"
128+
MinWidth="256"
129+
MinHeight="256"
130+
HorizontalAlignment="Stretch"
131+
VerticalAlignment="Stretch"
132+
AutomationProperties.Name="Third Dimension"
133+
Components="{TemplateBinding ColorSpectrumComponents}"
134+
MaxHue="{TemplateBinding MaxHue}"
135+
MaxSaturation="{TemplateBinding MaxSaturation}"
136+
MaxValue="{TemplateBinding MaxValue}"
137+
MinHue="{TemplateBinding MinHue}"
138+
MinSaturation="{TemplateBinding MinSaturation}"
139+
MinValue="{TemplateBinding MinValue}"
140+
Shape="{TemplateBinding ColorSpectrumShape}" />
140141
<primitives:ColorPickerSlider x:Name="ColorSpectrumAlphaSlider"
141142
Grid.Row="1"
142143
Grid.RowSpan="2"

CommunityToolkit.WinUI.UI.Controls.Input/ColorPicker/ColorPickerButton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected override void OnApplyTemplate()
140140
}
141141
}
142142

143-
private void ColorPicker_ColorChanged(Microsoft.UI.Xaml.Controls.ColorPicker sender, ColorChangedEventArgs args)
143+
private void ColorPicker_ColorChanged(Microsoft.UI.Xaml.Controls.ColorPicker sender, Microsoft.UI.Xaml.Controls.ColorChangedEventArgs args)
144144
{
145145
SelectedColor = args.NewColor;
146146
}

CommunityToolkit.WinUI.UI.Controls.Primitives/StaggeredLayout/StaggeredLayout.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,16 @@ protected override Size MeasureOverride(VirtualizingLayoutContext context, Size
145145
double availableWidth = availableSize.Width;
146146
double availableHeight = availableSize.Height;
147147

148-
double columnWidth = Math.Min(DesiredColumnWidth, availableWidth);
148+
// This ternary prevents the column width from being NaN, which would otherwise cause an exception when measuring item sizes
149+
double columnWidth = double.IsNaN(DesiredColumnWidth) ? availableWidth : Math.Min(DesiredColumnWidth, availableWidth);
149150
if (columnWidth != state.ColumnWidth)
150151
{
151152
// The items will need to be remeasured
152153
state.Clear();
153154
}
154155

155-
state.ColumnWidth = Math.Min(DesiredColumnWidth, availableWidth);
156+
// This ternary prevents the column width from being NaN, which would otherwise cause an exception when measuring item sizes
157+
state.ColumnWidth = double.IsNaN(DesiredColumnWidth) ? availableWidth : Math.Min(DesiredColumnWidth, availableWidth);
156158
int numColumns = Math.Max(1, (int)Math.Floor(availableWidth / state.ColumnWidth));
157159

158160
// adjust for column spacing on all columns expect the first

0 commit comments

Comments
 (0)