Skip to content

Commit

Permalink
feat: Support for ComboBox.SelectionChangedTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Oct 5, 2024
1 parent add8b01 commit 0d016e2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public string Text
}
}
#endif
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Microsoft.UI.Xaml.Controls.ComboBoxSelectionChangedTrigger SelectionChangedTrigger
{
Expand Down Expand Up @@ -141,7 +141,7 @@ public object SelectionBoxItem
new Microsoft.UI.Xaml.FrameworkPropertyMetadata(default(global::Microsoft.UI.Xaml.Media.Brush)));
#endif
// Skipping already declared property PlaceholderTextProperty
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Microsoft.UI.Xaml.DependencyProperty SelectionChangedTriggerProperty { get; } =
Microsoft.UI.Xaml.DependencyProperty.Register(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#pragma warning disable 114 // new keyword hiding
namespace Microsoft.UI.Xaml.Controls
{
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
public enum ComboBoxSelectionChangedTrigger
{
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
Expand Down
16 changes: 16 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/ComboBox/ComboBox.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,22 @@ public Brush PlaceholderForeground
/// </summary>
public DataTemplate SelectionBoxItemTemplate { get; private set; }

/// <summary>
/// Gets or sets a value that indicates what action causes a SelectionChanged event to occur.
/// </summary>
public ComboBoxSelectionChangedTrigger SelectionChangedTrigger
{
get => (ComboBoxSelectionChangedTrigger)GetValue(SelectionChangedTriggerProperty);
set => SetValue(SelectionChangedTriggerProperty, value);
}

public static DependencyProperty SelectionChangedTriggerProperty { get; } =
DependencyProperty.Register(
nameof(SelectionChangedTrigger),
typeof(ComboBoxSelectionChangedTrigger),
typeof(ComboBox),
new FrameworkPropertyMetadata(default(ComboBoxSelectionChangedTrigger)));

/// <summary>
/// Gets an object that provides calculated values that can be referenced
/// as TemplateBinding sources when defining templates for a ComboBox control.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Microsoft.UI.Xaml.Controls;

/// <summary>
/// Defines constants that specify what action causes a SelectionChanged event to occur.
/// </summary>
public enum ComboBoxSelectionChangedTrigger
{
/// <summary>
/// A change event occurs when the user commits a selection in the combo box.
/// </summary>
Committed = 0,

/// <summary>
/// A change event occurs each time the user navigates to a new selection in the combo box.
/// </summary>
Always = 1,
}

0 comments on commit 0d016e2

Please sign in to comment.