Skip to content

Commit

Permalink
Add an InitialSelectionMode test
Browse files Browse the repository at this point in the history
  • Loading branch information
DHancock committed Dec 1, 2023
1 parent 09fc03a commit c03dcea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
<Setter Property="Padding" Value="6"/>
</Style>

<Style TargetType="w3c:SimpleColorPicker">
<Setter Property="ShouldConstrainToRootBounds" Value="false"/>
</Style>

<Style TargetType="TextBlock">
<Setter Property="Margin" Value="0,0,10,0"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
Expand All @@ -72,16 +68,19 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Button Grid.Column="4" HorizontalAlignment="Right" Content="Toggle Theme" Click="Button_Click"/>
<Button Grid.Column="5" HorizontalAlignment="Right" Content="Toggle Theme" Click="Button_Click"/>

<TextBlock Grid.Row="1" Text="Defaults:"/>
<w3c:SimpleColorPicker Grid.Row="1" Grid.Column="1" Color="{x:Bind BC, Mode=TwoWay}" ColorChanged="SimpleColorPicker_ColorChanged"/>

<TextBlock Grid.Row="2" Text="Mini palette:"/>
<w3c:SimpleColorPicker Grid.Row="2" Grid.Column="1" IsMiniPalette="True" Color="{x:Bind BC, Mode=TwoWay}"/>
<w3c:SimpleColorPicker x:Name="MiniPaletePicker" Grid.Row="2" Grid.Column="1" IsMiniPalette="True" Color="{x:Bind BC, Mode=TwoWay}" />
<TextBlock Text="Initial selection mode" Grid.Row="2" Grid.Column="2"/>
<ComboBox x:Name="InitialSelectionComboBox" Loaded="InitialSelectionComboBox_Loaded" SelectionChanged="InitialSelectionComboBox_SelectionChanged" Grid.Row="2" Grid.Column="3"/>

<TextBlock Grid.Row="3" Text="Vertical palette orientation:"/>
<w3c:SimpleColorPicker Grid.Row="3" Grid.Column="1" PaletteOrientation="Vertical" Color="{x:Bind BC, Mode=TwoWay}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Windows.Foundation.Collections;
using Windows.UI;


// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

Expand Down Expand Up @@ -141,5 +142,17 @@ private void SimpleColorPicker_FlyoutClosed(AssyntSoftware.WinUI3Controls.Simple
{
eventReceivedFeedback.Text = "event received: Closed";
}

private void InitialSelectionComboBox_Loaded(object sender, RoutedEventArgs e)
{
InitialSelectionComboBox.ItemsSource = Enum.GetNames<AssyntSoftware.WinUI3Controls.SimpleColorPicker.InitialSelection>();
InitialSelectionComboBox.SelectedItem = InitialSelectionComboBox.Items[0];
}

private void InitialSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
String value = (String)InitialSelectionComboBox.SelectedItem;
MiniPaletePicker.InitialSelectionMode = Enum.Parse<AssyntSoftware.WinUI3Controls.SimpleColorPicker.InitialSelection>(value);
}
}
}

0 comments on commit c03dcea

Please sign in to comment.