diff --git a/src/SamplesApp/UITests.Shared/ItemExclusions.props b/src/SamplesApp/UITests.Shared/ItemExclusions.props
index 456f234bab92..d57b994c4db3 100644
--- a/src/SamplesApp/UITests.Shared/ItemExclusions.props
+++ b/src/SamplesApp/UITests.Shared/ItemExclusions.props
@@ -39,6 +39,9 @@
+
+
+
@@ -54,5 +57,9 @@
+
+
+
+
diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml
new file mode 100644
index 000000000000..686f0b6ba553
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ None
+ Info
+ Verbose
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml.cs
new file mode 100644
index 000000000000..1b065b0181d5
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarPage.xaml.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+using Common;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Private.Controls;
+
+//using WEX.TestExecution;
+//using WEX.TestExecution.Markup;
+//using WEX.Logging.Interop;
+using Uno.UI.Samples.Controls;
+
+namespace MUXControlsTestApp
+{
+ [Sample("SelectorBar")]
+ public sealed partial class SelectorBarPage : TestPage
+ {
+ public SelectorBarPage()
+ {
+ LogController.InitializeLogging();
+ this.InitializeComponent();
+
+ navigateToSummary.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SelectorBarSummaryPage), 0); };
+ navigateToSample.Click += delegate { Frame.NavigateWithoutAnimation(typeof(SelectorBarSamplePage), 0); };
+ }
+
+ private void CmbSelectorBarOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ //if (chkSelectorBar != null && chkSelectorBar.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetOutputDebugStringLevelForType(
+ // "SelectorBar",
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
+ //}
+
+ //if (chkItemsView != null && chkItemsView.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetOutputDebugStringLevelForType(
+ // "ItemsView",
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
+ //}
+
+ //if (chkItemContainer != null && chkItemContainer.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetOutputDebugStringLevelForType(
+ // "ItemContainer",
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
+ //}
+
+ //if (chkItemsRepeater != null && chkItemsRepeater.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetOutputDebugStringLevelForType(
+ // "ItemsRepeater",
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 1 || cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2,
+ // cmbSelectorBarOutputDebugStringLevel.SelectedIndex == 2);
+ //}
+ }
+ }
+}
diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml
new file mode 100644
index 000000000000..5e19a0944314
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml.cs
new file mode 100644
index 000000000000..8a6ea8805a3e
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSamplePage.xaml.cs
@@ -0,0 +1,71 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+using Microsoft.UI.Xaml.Controls;
+using MUXControlsTestApp.Samples.Model;
+using System;
+using System.Collections.ObjectModel;
+using Uno.UI.Samples.Controls;
+
+namespace MUXControlsTestApp
+{
+ [Sample("SelectorBar")]
+ public sealed partial class SelectorBarSamplePage : TestPage
+ {
+ private ObservableCollection _colRemotePhotos = null;
+ private ObservableCollection _colSharedPhotos = null;
+ private ObservableCollection _colFavoritePhotos = null;
+
+ public SelectorBarSamplePage()
+ {
+ this.InitializeComponent();
+
+ _colRemotePhotos = new ObservableCollection();
+ _colSharedPhotos = new ObservableCollection();
+ _colFavoritePhotos = new ObservableCollection();
+
+ int imageCount = 20;
+
+ for (int itemIndex = 0; itemIndex < imageCount; itemIndex++)
+ {
+ _colRemotePhotos.Add(new Recipe()
+ {
+ ImageUri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", itemIndex % 126 + 1))
+ });
+ _colSharedPhotos.Add(new Recipe()
+ {
+ ImageUri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", itemIndex % 126 + imageCount + 1))
+ });
+ _colFavoritePhotos.Add(new Recipe()
+ {
+ ImageUri = new Uri(string.Format("ms-appx:///Images/vette{0}.jpg", itemIndex % 126 + 2 * imageCount + 1))
+ });
+ }
+ }
+
+ ~SelectorBarSamplePage()
+ {
+ }
+
+ private void SelectorBar_SelectionChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs args)
+ {
+ if (sender.SelectedItem == selectorBarItemRemote)
+ {
+ photos.ItemsSource = _colRemotePhotos;
+ }
+ else if (sender.SelectedItem == selectorBarItemShared)
+ {
+ photos.ItemsSource = _colSharedPhotos;
+ }
+ else
+ {
+ photos.ItemsSource = _colFavoritePhotos;
+ }
+
+ if (tblSelectedSelectorBarItem != null)
+ {
+ tblSelectedSelectorBarItem.Text = sender.SelectedItem == null ? "null" : sender.SelectedItem.Name;
+ }
+ }
+ }
+}
diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml
new file mode 100644
index 000000000000..7ddcf2543f93
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml
@@ -0,0 +1,277 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ null
+ Transparent
+ AliceBlue
+ Aqua
+
+
+
+
+ null
+ Transparent
+ Blue
+ Green
+
+
+
+
+ Local
+ Cycle
+ Once
+
+
+
+
+ Auto
+ Enabled
+ Disabled
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ True
+
+
+
+
+
+
+ False
+ True
+
+
+
+
+
+
+ Visible
+ Collpased
+
+
+
+
+
+
+ null
+ Black
+ Red
+ Green
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ null
+ Cut
+ Copy
+ Paste
+ Bold
+ Italic
+ Underline
+
+
+
+
+
+
+ null
+ TextBlock
+ TextBox
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml.cs
new file mode 100644
index 000000000000..64a3656b5972
--- /dev/null
+++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/SelectorBarTests/SelectorBarSummaryPage.xaml.cs
@@ -0,0 +1,1779 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Microsoft.UI;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+using Microsoft.UI.Private.Controls;
+using Windows.Foundation;
+using MUXControlsTestApp.Samples.Model;
+using Uno.UI.Samples.Controls;
+
+namespace MUXControlsTestApp
+{
+ [Sample("SelectorBar")]
+ public sealed partial class SelectorBarSummaryPage : TestPage
+ {
+ private List _fullLogs = new List();
+ private SelectorBarItem _otherSelectorBarItem = new SelectorBarItem();
+
+ public SelectorBarSummaryPage()
+ {
+ this.InitializeComponent();
+
+ PopulateCmbSelectorBarSelectedItem();
+ UpdateBackground();
+ UpdateBorderBrush();
+ UpdateBorderThickness();
+ UpdateMargin();
+ UpdatePadding();
+ UpdateMaxWidth();
+ UpdateMaxHeight();
+ UpdateCornerRadius();
+ UpdateTabNavigation();
+ UpdateXYFocusKeyboardNavigation();
+ UpdateIsEnabled();
+ UpdateIsTabStop();
+ UpdateSelectedItem();
+
+ //if (chkLogItemContainerMessages.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetLoggingLevelForType("ItemContainer", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //}
+ //if (chkLogItemsRepeaterMessages.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //}
+ //if (chkLogItemsViewMessages.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //}
+ //if (chkLogSelectorBarMessages.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.SetLoggingLevelForType("SelectorBar", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //}
+
+ //if (chkLogSelectorBarMessages.IsChecked == true ||
+ // chkLogItemsViewMessages.IsChecked == true ||
+ // chkLogItemsRepeaterMessages.IsChecked == true ||
+ // chkLogItemContainerMessages.IsChecked == true)
+ //{
+ // MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
+ //}
+ }
+
+ ~SelectorBarSummaryPage()
+ {
+ }
+
+ protected internal override void OnNavigatedFrom(NavigationEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemContainer", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+ //MUXControlsTestHooks.SetLoggingLevelForType("SelectorBar", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+
+ //MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
+
+ if (selectorBar != null)
+ {
+ ItemsView itemsView = SelectorBarTestHooks.GetItemsViewPart(selectorBar);
+
+ if (itemsView != null)
+ {
+ ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
+
+ if (itemsRepeater != null)
+ {
+ UnhookItemsRepeaterEvents(itemsRepeater);
+ }
+
+ UnhookItemsViewEvents(itemsView);
+ }
+
+ UnhookSelectorBarEvents();
+ }
+
+ base.OnNavigatedFrom(e);
+ }
+
+ private void SelectorBar_Loaded(object sender, RoutedEventArgs e)
+ {
+ AppendEventMessage($"SelectorBar.Loaded");
+ }
+
+ private void SelectorBar_SelectionChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs args)
+ {
+ string selectedItem = (sender.SelectedItem == null) ? "" : GetStringFromSelectorBarItem(sender.SelectedItem);
+
+ AppendEventMessage($"SelectorBar.SelectionChanged SelectedItem={selectedItem}");
+ }
+
+ private void ItemsView_ItemInvoked(ItemsView sender, ItemsViewItemInvokedEventArgs args)
+ {
+ AppendEventMessage($"ItemsView.ItemInvoked InvokedItem={args.InvokedItem.ToString().Substring(0, 50)}");
+ }
+
+ private void ItemsView_Loaded(object sender, RoutedEventArgs e)
+ {
+ AppendEventMessage($"ItemsView.Loaded");
+ if (chkLogItemsRepeaterEvents.IsChecked == true)
+ {
+ LogItemsRepeaterInfo();
+ }
+
+ ItemsView itemsView = sender as ItemsView;
+
+ if (itemsView != null)
+ {
+ ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
+
+ if (itemsRepeater != null)
+ {
+ HookItemsRepeaterEvents(itemsRepeater);
+ }
+ }
+ }
+
+ private void ItemsView_SelectionChanged(ItemsView sender, ItemsViewSelectionChangedEventArgs args)
+ {
+ string selectedItems = String.Empty;
+
+ foreach (var selectedItem in sender.SelectedItems)
+ {
+ selectedItems += (selectedItem == null) ? ", " : selectedItem.ToString().Substring(0, 9) + ", ";
+ }
+
+ AppendEventMessage($"ItemsView.SelectionChanged SelectedItems={selectedItems}");
+ }
+
+ private void ItemsView_GettingFocus(UIElement sender, Microsoft.UI.Xaml.Input.GettingFocusEventArgs args)
+ {
+ FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
+ string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
+ FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
+ string newFEName = (newFE == null) ? "null" : newFE.Name;
+
+ AppendEventMessage($"ItemsView.GettingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
+ }
+
+ private void ItemsView_LostFocus(object sender, RoutedEventArgs e)
+ {
+ AppendEventMessage("ItemsView.LostFocus");
+ }
+
+ private void ItemsView_LosingFocus(UIElement sender, Microsoft.UI.Xaml.Input.LosingFocusEventArgs args)
+ {
+ FrameworkElement oldFE = args.OldFocusedElement as FrameworkElement;
+ string oldFEName = (oldFE == null) ? "null" : oldFE.Name;
+ FrameworkElement newFE = args.NewFocusedElement as FrameworkElement;
+ string newFEName = (newFE == null) ? "null" : newFE.Name;
+
+ AppendEventMessage($"ItemsView.LosingFocus FocusState={args.FocusState}, Direction={args.Direction}, InputDevice={args.InputDevice}, oldFE={oldFEName}, newFE={newFEName}");
+ }
+
+ private void ItemsView_GotFocus(object sender, RoutedEventArgs e)
+ {
+ AppendEventMessage("ItemsView.GotFocus");
+ }
+
+ private void ItemsRepeater_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (chkLogItemsRepeaterEvents.IsChecked == true)
+ {
+ AppendEventMessage($"ItemsRepeater.Loaded");
+ LogItemsRepeaterInfo();
+ }
+ }
+
+ private void ItemsRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args)
+ {
+ if (chkLogItemsRepeaterEvents.IsChecked == true)
+ {
+ AppendEventMessage($"ItemsRepeater.ElementPrepared Index={args.Index}, Element={args.Element}");
+ }
+ }
+
+ private void ItemsRepeater_ElementClearing(ItemsRepeater sender, ItemsRepeaterElementClearingEventArgs args)
+ {
+ if (chkLogItemsRepeaterEvents.IsChecked == true)
+ {
+ AppendEventMessage($"ItemsRepeater.ElementClearing Element={args.Element}");
+ }
+ }
+
+ private void LogItemsRepeaterInfo()
+ {
+ if (selectorBar != null)
+ {
+ ItemsView itemsView = SelectorBarTestHooks.GetItemsViewPart(selectorBar);
+
+ if (itemsView != null)
+ {
+ ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
+
+ if (itemsRepeater != null)
+ {
+ AppendEventMessage($"ItemsRepeater Info: ItemsSource={itemsRepeater.ItemsSource}, ItemTemplate={itemsRepeater.ItemTemplate}, Layout={itemsRepeater.Layout}, ChildrenCount={VisualTreeHelper.GetChildrenCount(itemsRepeater)}");
+ }
+ }
+ }
+ }
+
+ #region UI Controls Updates
+
+ private void UpdateMargin()
+ {
+ if (selectorBar != null && txtMargin != null)
+ {
+ txtMargin.Text = selectorBar.Margin.ToString();
+ }
+ }
+
+ private void UpdateMaxHeight()
+ {
+ if (selectorBar != null && txtMaxHeight != null)
+ {
+ txtMaxHeight.Text = selectorBar.MaxHeight.ToString();
+ }
+ }
+
+ private void UpdateMaxWidth()
+ {
+ if (selectorBar != null && txtMaxWidth != null)
+ {
+ txtMaxWidth.Text = selectorBar.MaxWidth.ToString();
+ }
+ }
+
+ private void UpdatePadding()
+ {
+ if (selectorBar != null && txtPadding != null)
+ {
+ txtPadding.Text = selectorBar.Padding.ToString();
+ }
+ }
+
+ private void UpdateBackground()
+ {
+ if (selectorBar != null && cmbBackground != null)
+ {
+ SolidColorBrush bg = selectorBar.Background as SolidColorBrush;
+
+ if (bg == null)
+ {
+ cmbBackground.SelectedIndex = 0;
+ }
+ else if (bg.Color == Colors.Transparent)
+ {
+ cmbBackground.SelectedIndex = 1;
+ }
+ else if (bg.Color == Colors.AliceBlue)
+ {
+ cmbBackground.SelectedIndex = 2;
+ }
+ else if (bg.Color == Colors.Aqua)
+ {
+ cmbBackground.SelectedIndex = 3;
+ }
+ else
+ {
+ cmbBackground.SelectedIndex = -1;
+ }
+ }
+ }
+
+ private void UpdateBorderBrush()
+ {
+ if (selectorBar != null && cmbBorderBrush != null)
+ {
+ SolidColorBrush bb = selectorBar.BorderBrush as SolidColorBrush;
+
+ if (bb == null)
+ {
+ cmbBorderBrush.SelectedIndex = 0;
+ }
+ else if (bb.Color == Colors.Transparent)
+ {
+ cmbBorderBrush.SelectedIndex = 1;
+ }
+ else if (bb.Color == Colors.Blue)
+ {
+ cmbBorderBrush.SelectedIndex = 2;
+ }
+ else if (bb.Color == Colors.Green)
+ {
+ cmbBorderBrush.SelectedIndex = 3;
+ }
+ else
+ {
+ cmbBorderBrush.SelectedIndex = -1;
+ }
+ }
+ }
+
+ private void UpdateBorderThickness()
+ {
+ if (selectorBar != null && txtBorderThickness != null)
+ {
+ txtBorderThickness.Text = selectorBar.BorderThickness.ToString();
+ }
+ }
+
+ private void UpdateCornerRadius()
+ {
+ if (selectorBar != null && txtCornerRadius != null)
+ {
+ txtCornerRadius.Text = selectorBar.CornerRadius.ToString();
+ }
+ }
+
+ private void UpdateTabNavigation()
+ {
+ try
+ {
+ if (selectorBar != null && cmbTabNavigation != null)
+ {
+ cmbTabNavigation.SelectedIndex = (int)selectorBar.TabNavigation;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void UpdateXYFocusKeyboardNavigation()
+ {
+ try
+ {
+ if (selectorBar != null && cmbXYFocusKeyboardNavigation != null)
+ {
+ cmbXYFocusKeyboardNavigation.SelectedIndex = (int)selectorBar.XYFocusKeyboardNavigation;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void UpdateItemsCount()
+ {
+ // TODO
+ }
+
+ private void UpdateIsEnabled()
+ {
+ try
+ {
+ if (selectorBar != null && chkIsEnabled != null)
+ {
+ chkIsEnabled.IsChecked = selectorBar.IsEnabled;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void UpdateIsTabStop()
+ {
+ try
+ {
+ if (selectorBar != null && chkIsTabStop != null)
+ {
+ chkIsTabStop.IsChecked = selectorBar.IsTabStop;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void PopulateCmbSelectorBarSelectedItem()
+ {
+ if (selectorBar != null && cmbSelectorBarSelectedItem != null)
+ {
+ cmbSelectorBarSelectedItem.Items.Clear();
+
+ cmbSelectorBarSelectedItem.Items.Add(new ComboBoxItem()
+ {
+ Content = "null"
+ });
+
+ if (selectorBar.Items != null)
+ {
+ foreach (SelectorBarItem selectorBarItem in selectorBar.Items)
+ {
+ cmbSelectorBarSelectedItem.Items.Add(new ComboBoxItem()
+ {
+ Content = GetStringFromSelectorBarItem(selectorBarItem),
+ Tag = selectorBarItem
+ });
+ }
+ }
+
+ cmbSelectorBarSelectedItem.Items.Add(new ComboBoxItem()
+ {
+ Content = "Other",
+ Tag = _otherSelectorBarItem
+ });
+ }
+ }
+
+ private void UpdateSelectedItem()
+ {
+ if (selectorBar != null && cmbSelectorBarSelectedItem != null)
+ {
+ if (selectorBar.SelectedItem == null)
+ {
+ cmbSelectorBarSelectedItem.SelectedIndex = 0;
+ }
+ else
+ {
+ int selectedIndex = 1;
+
+ if (selectorBar.Items != null)
+ {
+ foreach (SelectorBarItem selectorBarItem in selectorBar.Items)
+ {
+ if (selectorBarItem == selectorBar.SelectedItem)
+ {
+ cmbSelectorBarSelectedItem.SelectedIndex = selectedIndex;
+ break;
+ }
+
+ selectedIndex++;
+ }
+ }
+
+ cmbSelectorBarSelectedItem.SelectedIndex = selectedIndex;
+ }
+ }
+ }
+
+ #endregion
+
+ #region Property Getters
+
+ private void BtnGetBorderThickness_Click(object sender, RoutedEventArgs e)
+ {
+ UpdateBorderThickness();
+ }
+
+ private void BtnGetCornerRadius_Click(object sender, RoutedEventArgs e)
+ {
+ UpdateCornerRadius();
+ }
+
+ private void BtnGetMargin_Click(object sender, RoutedEventArgs e)
+ {
+ UpdateMargin();
+ }
+
+ private void BtnGetMaxHeight_Click(object sender, RoutedEventArgs e)
+ {
+ UpdateMaxHeight();
+ }
+
+ private void BtnGetMaxWidth_Click(object sender, RoutedEventArgs e)
+ {
+ UpdateMaxWidth();
+ }
+
+ private void BtnGetPadding_Click(object sender, RoutedEventArgs e)
+ {
+ UpdatePadding();
+ }
+
+ private void BtnGetSelectorBarSelectedItem_Click(object sender, RoutedEventArgs e)
+ {
+ UpdateSelectedItem();
+ }
+
+ #endregion
+
+ #region Property Setters
+
+ private void ChkIsEnabled_CheckedChanged(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && chkIsEnabled != null)
+ {
+ selectorBar.IsEnabled = (bool)chkIsEnabled.IsChecked;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void ChkIsTabStop_CheckedChanged(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && chkIsTabStop != null)
+ {
+ selectorBar.IsTabStop = (bool)chkIsTabStop.IsChecked;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetCornerRadius_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtCornerRadius != null)
+ {
+ selectorBar.CornerRadius = GetCornerRadiusFromString(txtCornerRadius.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetMargin_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtMargin != null)
+ {
+ selectorBar.Margin = GetThicknessFromString(txtMargin.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetMaxHeight_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtMaxHeight != null)
+ {
+ selectorBar.MaxHeight = Convert.ToDouble(txtMaxHeight.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetMaxWidth_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtMaxWidth != null)
+ {
+ selectorBar.MaxWidth = Convert.ToDouble(txtMaxWidth.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetPadding_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtPadding != null)
+ {
+ selectorBar.Padding = GetThicknessFromString(txtPadding.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarSelectedItem_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && cmbSelectorBarSelectedItem != null)
+ {
+ selectorBar.SelectedItem = (cmbSelectorBarSelectedItem.SelectedItem as ComboBoxItem).Tag as SelectorBarItem;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetBorderThickness_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null)
+ {
+ selectorBar.BorderThickness = GetThicknessFromString(txtBorderThickness.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void CmbBackground_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null)
+ {
+ switch (cmbBackground.SelectedIndex)
+ {
+ case 0:
+ selectorBar.Background = null;
+ break;
+ case 1:
+ selectorBar.Background = new SolidColorBrush(Colors.Transparent);
+ break;
+ case 2:
+ selectorBar.Background = new SolidColorBrush(Colors.AliceBlue);
+ break;
+ case 3:
+ selectorBar.Background = new SolidColorBrush(Colors.Aqua);
+ break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void CmbBorderBrush_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null)
+ {
+ switch (cmbBorderBrush.SelectedIndex)
+ {
+ case 0:
+ selectorBar.BorderBrush = null;
+ break;
+ case 1:
+ selectorBar.BorderBrush = new SolidColorBrush(Colors.Transparent);
+ break;
+ case 2:
+ selectorBar.BorderBrush = new SolidColorBrush(Colors.Blue);
+ break;
+ case 3:
+ selectorBar.BorderBrush = new SolidColorBrush(Colors.Green);
+ break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void CmbTabNavigation_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && cmbTabNavigation != null && selectorBar.TabNavigation != (KeyboardNavigationMode)cmbTabNavigation.SelectedIndex)
+ {
+ selectorBar.TabNavigation = (KeyboardNavigationMode)cmbTabNavigation.SelectedIndex;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void CmbXYFocusKeyboardNavigation_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && cmbXYFocusKeyboardNavigation != null && selectorBar.XYFocusKeyboardNavigation != (XYFocusKeyboardNavigationMode)cmbXYFocusKeyboardNavigation.SelectedIndex)
+ {
+ selectorBar.XYFocusKeyboardNavigation = (XYFocusKeyboardNavigationMode)cmbXYFocusKeyboardNavigation.SelectedIndex;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ #endregion
+
+ #region Items methods
+
+ private void BtnGetSelectorBarItemsCount_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemsCount != null)
+ {
+ if (selectorBar.Items == null)
+ {
+ txtSelectorBarItemsCount.Text = "null";
+ }
+ else
+ {
+ txtSelectorBarItemsCount.Text = selectorBar.Items.Count.ToString();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemIsEnabled_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemIsEnabled != null)
+ {
+ cmbSelectorBarItemIsEnabled.SelectedIndex = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].IsEnabled ? 1 : 0;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemIsEnabled_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemIsEnabled != null)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].IsEnabled = cmbSelectorBarItemIsEnabled.SelectedIndex == 1;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemIsSelected_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemIsSelected != null)
+ {
+ cmbSelectorBarItemIsSelected.SelectedIndex = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].IsSelected ? 1 : 0;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemIsSelected_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemIsSelected != null)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].IsSelected = cmbSelectorBarItemIsSelected.SelectedIndex == 1;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemVisibility_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (cmbSelectorBarItemVisibility != null)
+ {
+ if (selectorBar == null || txtSelectorBarItemIndex == null)
+ {
+ cmbSelectorBarItemVisibility.SelectedIndex = -1;
+ }
+ else
+ {
+ cmbSelectorBarItemVisibility.SelectedIndex = (int)selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Visibility;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemVisibility_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemVisibility != null && cmbSelectorBarItemVisibility.SelectedIndex != -1)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Visibility = (Visibility)cmbSelectorBarItemVisibility.SelectedIndex;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemForeground_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemForeground != null)
+ {
+ SolidColorBrush fg = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Foreground as SolidColorBrush;
+
+ if (fg == null)
+ {
+ cmbSelectorBarItemForeground.SelectedIndex = 0;
+ }
+ else if (fg.Color == Colors.Black)
+ {
+ cmbSelectorBarItemForeground.SelectedIndex = 1;
+ }
+ else if (fg.Color == Colors.Red)
+ {
+ cmbSelectorBarItemForeground.SelectedIndex = 2;
+ }
+ else if (fg.Color == Colors.Green)
+ {
+ cmbSelectorBarItemForeground.SelectedIndex = 3;
+ }
+ else
+ {
+ cmbSelectorBarItemForeground.SelectedIndex = -1;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemForeground_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemForeground != null)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Foreground = GetForeground();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemMargin_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && txtSelectorBarItemMargin != null)
+ {
+ txtSelectorBarItemMargin.Text = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Margin.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemMargin_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && txtSelectorBarItemMargin != null)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Margin = GetThicknessFromString(txtSelectorBarItemMargin.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemPadding_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && txtSelectorBarItemPadding != null)
+ {
+ txtSelectorBarItemPadding.Text = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Padding.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemPadding_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && txtSelectorBarItemPadding != null)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Padding = GetThicknessFromString(txtSelectorBarItemPadding.Text);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemText_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && txtSelectorBarItemText != null)
+ {
+ txtSelectorBarItemText.Text = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Text;
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemText_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && txtSelectorBarItemText != null)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Text = txtSelectorBarItemText.Text;
+ PopulateCmbSelectorBarSelectedItem();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemIcon_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemIcon != null)
+ {
+ cmbSelectorBarItemIcon.SelectedIndex = -1;
+
+ SymbolIcon symbolIcon = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)].Icon as SymbolIcon;
+
+ if (symbolIcon == null)
+ {
+ cmbSelectorBarItemIcon.SelectedIndex = 0;
+ return;
+ }
+
+ cmbSelectorBarItemIcon.SelectedIndex = GetIntFromSymbol(symbolIcon.Symbol);
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemIcon_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemIcon != null)
+ {
+ SelectorBarItem selectorBarItem = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)];
+
+ if (cmbSelectorBarItemIcon.SelectedIndex < 1)
+ {
+ selectorBarItem.Icon = null;
+ return;
+ }
+
+ SymbolIcon symbolIcon = selectorBarItem.Icon as SymbolIcon;
+
+ if (symbolIcon == null)
+ {
+ symbolIcon = new SymbolIcon();
+ }
+
+ symbolIcon.Symbol = GetSymbolFromInt(cmbSelectorBarItemIcon.SelectedIndex);
+ selectorBarItem.Icon = symbolIcon;
+ PopulateCmbSelectorBarSelectedItem();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnGetSelectorBarItemChild_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemChild != null)
+ {
+ cmbSelectorBarItemChild.SelectedIndex = -1;
+
+ SelectorBarItem selectorBarItem = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)];
+
+ if (selectorBarItem.Child == null)
+ {
+ cmbSelectorBarItemChild.SelectedIndex = 0;
+ }
+ else if (selectorBarItem.Child is TextBlock)
+ {
+ cmbSelectorBarItemChild.SelectedIndex = 1;
+ }
+ else if (selectorBarItem.Child is TextBox)
+ {
+ cmbSelectorBarItemChild.SelectedIndex = 2;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnSetSelectorBarItemChild_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null && cmbSelectorBarItemChild != null)
+ {
+ SelectorBarItem selectorBarItem = selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)];
+
+ switch (cmbSelectorBarItemChild.SelectedIndex)
+ {
+ case -1:
+ case 0:
+ selectorBarItem.Child = null;
+ break;
+ case 1:
+ selectorBarItem.Child = GetTextBlockChild();
+ break;
+ case 2:
+ selectorBarItem.Child = GetTextBoxChild();
+ break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnAddSelectorBarItem_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null)
+ {
+ selectorBar.Items.Add(GetSelectorBarItem());
+ PopulateCmbSelectorBarSelectedItem();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnRemoveAllSelectorBarItems_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null)
+ {
+ selectorBar.Items.Clear();
+ PopulateCmbSelectorBarSelectedItem();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnReplaceSelectorBarItem_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null)
+ {
+ selectorBar.Items[int.Parse(txtSelectorBarItemIndex.Text)] = GetSelectorBarItem();
+ PopulateCmbSelectorBarSelectedItem();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnInsertSelectorBarItem_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null)
+ {
+ selectorBar.Items.Insert(int.Parse(txtSelectorBarItemIndex.Text), GetSelectorBarItem());
+ PopulateCmbSelectorBarSelectedItem();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ private void BtnRemoveSelectorBarItem_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (selectorBar != null && txtSelectorBarItemIndex != null)
+ {
+ selectorBar.Items.RemoveAt(int.Parse(txtSelectorBarItemIndex.Text));
+ PopulateCmbSelectorBarSelectedItem();
+ }
+ }
+ catch (Exception ex)
+ {
+ txtExceptionReport.Text = ex.ToString();
+ AppendEventMessage(ex.ToString());
+ }
+ }
+
+ #endregion
+
+ private void ChkSelectorBarProperties_Checked(object sender, RoutedEventArgs e)
+ {
+ if (svSelectorBarProperties != null)
+ svSelectorBarProperties.Visibility = Visibility.Visible;
+ }
+
+ private void ChkSelectorBarProperties_Unchecked(object sender, RoutedEventArgs e)
+ {
+ if (svSelectorBarProperties != null)
+ svSelectorBarProperties.Visibility = Visibility.Collapsed;
+ }
+
+ private void ChkSelectorBarItems_Checked(object sender, RoutedEventArgs e)
+ {
+ if (svSelectorBarItems != null)
+ svSelectorBarItems.Visibility = Visibility.Visible;
+ }
+
+ private void ChkSelectorBarItems_Unchecked(object sender, RoutedEventArgs e)
+ {
+ if (svSelectorBarItems != null)
+ svSelectorBarItems.Visibility = Visibility.Collapsed;
+ }
+
+ private void ChkLogs_Checked(object sender, RoutedEventArgs e)
+ {
+ if (grdLogs != null)
+ grdLogs.Visibility = Visibility.Visible;
+ }
+
+ private void ChkLogs_Unchecked(object sender, RoutedEventArgs e)
+ {
+ if (grdLogs != null)
+ grdLogs.Visibility = Visibility.Collapsed;
+ }
+
+ private void BtnGetFullLog_Click(object sender, RoutedEventArgs e)
+ {
+ GetFullLog();
+ }
+
+ private void BtnClearFullLog_Click(object sender, RoutedEventArgs e)
+ {
+ ClearFullLog();
+ }
+
+ private void BtnClearLogs_Click(object sender, RoutedEventArgs e)
+ {
+ lstLogs.Items.Clear();
+ }
+
+ private void BtnCopyEvents_Click(object sender, RoutedEventArgs e)
+ {
+ string logs = string.Empty;
+
+ foreach (object log in lstLogs.Items)
+ {
+ logs += log.ToString() + "\n";
+ }
+
+ var dataPackage = new Windows.ApplicationModel.DataTransfer.DataPackage();
+ dataPackage.SetText(logs);
+ Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);
+ }
+
+ private void ChkLogItemsRepeaterEvents_Checked(object sender, RoutedEventArgs e)
+ {
+ if (selectorBar != null)
+ {
+ ItemsView itemsView = SelectorBarTestHooks.GetItemsViewPart(selectorBar);
+
+ if (itemsView != null)
+ {
+ ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
+
+ if (itemsRepeater != null)
+ {
+ HookItemsRepeaterEvents(itemsRepeater);
+ }
+ }
+ }
+ }
+
+ private void ChkLogItemsRepeaterEvents_Unchecked(object sender, RoutedEventArgs e)
+ {
+ if (selectorBar != null)
+ {
+ ItemsView itemsView = SelectorBarTestHooks.GetItemsViewPart(selectorBar);
+
+ if (itemsView != null)
+ {
+ ItemsRepeater itemsRepeater = ItemsViewTestHooks.GetItemsRepeaterPart(itemsView);
+
+ if (itemsRepeater != null)
+ {
+ UnhookItemsRepeaterEvents(itemsRepeater);
+ }
+ }
+ }
+ }
+
+ private void ChkLogItemsViewEvents_Checked(object sender, RoutedEventArgs e)
+ {
+ if (selectorBar != null)
+ {
+ ItemsView itemsView = SelectorBarTestHooks.GetItemsViewPart(selectorBar);
+
+ if (itemsView != null)
+ {
+ HookItemsViewEvents(itemsView);
+ }
+ }
+ }
+
+ private void ChkLogItemsViewEvents_Unchecked(object sender, RoutedEventArgs e)
+ {
+ if (selectorBar != null)
+ {
+ ItemsView itemsView = SelectorBarTestHooks.GetItemsViewPart(selectorBar);
+
+ if (itemsView != null)
+ {
+ UnhookItemsViewEvents(itemsView);
+ }
+ }
+ }
+
+ private void ChkLogSelectorBarEvents_Checked(object sender, RoutedEventArgs e)
+ {
+ HookSelectorBarEvents();
+ }
+
+ private void ChkLogSelectorBarEvents_Unchecked(object sender, RoutedEventArgs e)
+ {
+ UnhookSelectorBarEvents();
+ }
+
+ private void ChkLogItemContainerMessages_Checked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemContainer", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //if (chkLogSelectorBarMessages != null && chkLogSelectorBarMessages.IsChecked == false &&
+ // chkLogItemsViewMessages != null && chkLogItemsViewMessages.IsChecked == false &&
+ // chkLogItemsRepeaterMessages != null && chkLogItemsRepeaterMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void ChkLogItemContainerMessages_Unchecked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemContainer", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+ //if (chkLogSelectorBarMessages.IsChecked == false &&
+ // chkLogItemsViewMessages.IsChecked == false &&
+ // chkLogItemsRepeaterMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void ChkLogItemsRepeaterMessages_Checked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //if (chkLogSelectorBarMessages != null && chkLogSelectorBarMessages.IsChecked == false &&
+ // chkLogItemsViewMessages != null && chkLogItemsViewMessages.IsChecked == false &&
+ // chkLogItemContainerMessages != null && chkLogItemContainerMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void ChkLogItemsRepeaterMessages_Unchecked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemsRepeater", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+ //if (chkLogSelectorBarMessages.IsChecked == false &&
+ // chkLogItemsViewMessages.IsChecked == false &&
+ // chkLogItemContainerMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void ChkLogItemsViewMessages_Checked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //if (chkLogSelectorBarMessages != null && chkLogSelectorBarMessages.IsChecked == false &&
+ // chkLogItemsRepeaterMessages != null && chkLogItemsRepeaterMessages.IsChecked == false &&
+ // chkLogItemContainerMessages != null && chkLogItemContainerMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void ChkLogItemsViewMessages_Unchecked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("ItemsView", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+ //if (chkLogSelectorBarMessages.IsChecked == false &&
+ // chkLogItemsRepeaterMessages.IsChecked == false &&
+ // chkLogItemContainerMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void ChkLogSelectorBarMessages_Checked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("SelectorBar", isLoggingInfoLevel: true, isLoggingVerboseLevel: true);
+ //if (chkLogItemsViewMessages != null && chkLogItemsViewMessages.IsChecked == false &&
+ // chkLogItemsRepeaterMessages != null && chkLogItemsRepeaterMessages.IsChecked == false &&
+ // chkLogItemContainerMessages != null && chkLogItemContainerMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage += MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void ChkLogSelectorBarMessages_Unchecked(object sender, RoutedEventArgs e)
+ {
+ //MUXControlsTestHooks.SetLoggingLevelForType("SelectorBar", isLoggingInfoLevel: false, isLoggingVerboseLevel: false);
+ //if (chkLogItemsViewMessages.IsChecked == false &&
+ // chkLogItemsRepeaterMessages.IsChecked == false &&
+ // chkLogItemContainerMessages.IsChecked == false)
+ // MUXControlsTestHooks.LoggingMessage -= MUXControlsTestHooks_LoggingMessage;
+ }
+
+ private void HookItemsRepeaterEvents(ItemsRepeater itemsRepeater)
+ {
+ if (itemsRepeater != null)
+ {
+ itemsRepeater.Loaded += ItemsRepeater_Loaded;
+ itemsRepeater.ElementPrepared += ItemsRepeater_ElementPrepared;
+ itemsRepeater.ElementClearing += ItemsRepeater_ElementClearing;
+ }
+ }
+
+ private void UnhookItemsRepeaterEvents(ItemsRepeater itemsRepeater)
+ {
+ if (itemsRepeater != null)
+ {
+ itemsRepeater.Loaded -= ItemsRepeater_Loaded;
+ itemsRepeater.ElementPrepared -= ItemsRepeater_ElementPrepared;
+ itemsRepeater.ElementClearing -= ItemsRepeater_ElementClearing;
+ }
+ }
+
+ private void HookItemsViewEvents(ItemsView itemsView)
+ {
+ if (itemsView != null)
+ {
+ itemsView.ItemInvoked += ItemsView_ItemInvoked;
+ itemsView.GettingFocus += ItemsView_GettingFocus;
+ itemsView.GotFocus += ItemsView_GotFocus;
+ itemsView.LosingFocus += ItemsView_LosingFocus;
+ itemsView.LostFocus += ItemsView_LostFocus;
+ itemsView.Loaded += ItemsView_Loaded;
+ itemsView.SelectionChanged += ItemsView_SelectionChanged;
+ }
+ }
+
+ private void UnhookItemsViewEvents(ItemsView itemsView)
+ {
+ if (itemsView != null)
+ {
+ itemsView.ItemInvoked -= ItemsView_ItemInvoked;
+ itemsView.GettingFocus -= ItemsView_GettingFocus;
+ itemsView.GotFocus -= ItemsView_GotFocus;
+ itemsView.LosingFocus -= ItemsView_LosingFocus;
+ itemsView.LostFocus -= ItemsView_LostFocus;
+ itemsView.Loaded -= ItemsView_Loaded;
+ itemsView.SelectionChanged -= ItemsView_SelectionChanged;
+ }
+ }
+
+ private void HookSelectorBarEvents()
+ {
+ if (selectorBar != null)
+ {
+ selectorBar.Loaded += SelectorBar_Loaded;
+ selectorBar.SelectionChanged += SelectorBar_SelectionChanged;
+ }
+ }
+
+ private void UnhookSelectorBarEvents()
+ {
+ if (selectorBar != null)
+ {
+ selectorBar.Loaded -= SelectorBar_Loaded;
+ selectorBar.SelectionChanged -= SelectorBar_SelectionChanged;
+ }
+ }
+
+ //private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestHooksLoggingMessageEventArgs args)
+ //{
+ // // Cut off the terminating new line.
+ // string msg = args.Message.Substring(0, args.Message.Length - 1);
+ // string eventMessage;
+ // string senderName = string.Empty;
+
+ // try
+ // {
+ // FrameworkElement fe = sender as FrameworkElement;
+
+ // if (fe != null)
+ // {
+ // senderName = "s:" + fe.Name + ", ";
+ // }
+ // }
+ // catch
+ // {
+ // }
+
+ // if (args.IsVerboseLevel)
+ // {
+ // eventMessage = "Verbose: " + senderName + "m:" + msg;
+ // }
+ // else
+ // {
+ // eventMessage = "Info: " + senderName + "m:" + msg;
+ // }
+
+ // AppendEventMessage(eventMessage);
+ //}
+
+ private void AppendEventMessage(string eventMessage)
+ {
+ while (eventMessage.Length > 0)
+ {
+ string msgHead = eventMessage;
+
+ if (eventMessage.Length > 110)
+ {
+ int commaIndex = eventMessage.IndexOf(',', 110);
+ if (commaIndex != -1)
+ {
+ msgHead = eventMessage.Substring(0, commaIndex);
+ eventMessage = eventMessage.Substring(commaIndex + 1);
+ }
+ else
+ {
+ eventMessage = string.Empty;
+ }
+ }
+ else
+ {
+ eventMessage = string.Empty;
+ }
+
+ lstLogs.Items.Add(msgHead);
+ _fullLogs.Add(msgHead);
+
+ if ((bool)chkOutputDebugString.IsChecked)
+ {
+ System.Diagnostics.Debug.WriteLine(msgHead);
+ }
+ }
+ }
+
+ private void GetFullLog()
+ {
+ this.txtStatus.Text = "GetFullLog. Populating cmbFullLog...";
+ chkLogCleared.IsChecked = false;
+ foreach (string log in _fullLogs)
+ {
+ this.cmbFullLog.Items.Add(log);
+ }
+ chkLogUpdated.IsChecked = true;
+ this.txtStatus.Text = "GetFullLog. Done.";
+ }
+
+ private void ClearFullLog()
+ {
+ this.txtStatus.Text = "ClearFullLog. Clearing cmbFullLog & fullLogs...";
+ chkLogUpdated.IsChecked = false;
+ _fullLogs.Clear();
+ this.cmbFullLog.Items.Clear();
+ chkLogCleared.IsChecked = true;
+ this.txtStatus.Text = "ClearFullLog. Done.";
+ }
+
+ private void BtnClearExceptionReport_Click(object sender, RoutedEventArgs e)
+ {
+ txtExceptionReport.Text = string.Empty;
+ }
+
+ private Thickness GetThicknessFromString(string thickness)
+ {
+ string[] lengths = thickness.Split(',');
+ if (lengths.Length < 4)
+ return new Thickness(
+ Convert.ToDouble(lengths[0]));
+ else
+ return new Thickness(
+ Convert.ToDouble(lengths[0]), Convert.ToDouble(lengths[1]), Convert.ToDouble(lengths[2]), Convert.ToDouble(lengths[3]));
+ }
+
+ private CornerRadius GetCornerRadiusFromString(string cornerRadius)
+ {
+ string[] lengths = cornerRadius.Split(',');
+ if (lengths.Length < 4)
+ return new CornerRadius(
+ Convert.ToDouble(lengths[0]));
+ else
+ return new CornerRadius(
+ Convert.ToDouble(lengths[0]), Convert.ToDouble(lengths[1]), Convert.ToDouble(lengths[2]), Convert.ToDouble(lengths[3]));
+ }
+
+ private IconElement GetIconElementFromString(string icon)
+ {
+ switch (icon)
+ {
+ case "Cut":
+ return new SymbolIcon(Symbol.Cut);
+ case "Copy":
+ return new SymbolIcon(Symbol.Copy);
+ case "Paste":
+ return new SymbolIcon(Symbol.Paste);
+ case "Bold":
+ return new SymbolIcon(Symbol.Bold);
+ case "Italic":
+ return new SymbolIcon(Symbol.Italic);
+ case "Underline":
+ return new SymbolIcon(Symbol.Underline);
+ }
+
+ return null;
+ }
+
+ private string GetStringFromIconElement(IconElement iconElement)
+ {
+ SymbolIcon symbolIcon = iconElement as SymbolIcon;
+
+ if (symbolIcon == null)
+ {
+ return "null";
+ }
+
+ return symbolIcon.Symbol.ToString();
+ }
+
+ private string GetStringFromChild(SelectorBarItem selectorBarItem)
+ {
+ if (selectorBarItem == null || selectorBarItem.Child == null)
+ {
+ return "null";
+ }
+
+ if (selectorBarItem.Child is TextBlock)
+ {
+ return (selectorBarItem.Child as TextBlock).Text;
+ }
+ else
+ {
+ return (selectorBarItem.Child as TextBox).Text;
+ }
+ }
+
+ private string GetStringFromSelectorBarItem(SelectorBarItem selectorBarItem)
+ {
+ return "Icon:" + GetStringFromIconElement(selectorBarItem.Icon) + ", Text:" + selectorBarItem.Text + ", Child:" + GetStringFromChild(selectorBarItem);
+ }
+
+ private Symbol GetSymbolFromInt(int symbolIndex)
+ {
+ switch (symbolIndex)
+ {
+ case 1:
+ return Symbol.Cut;
+ case 2:
+ return Symbol.Copy;
+ case 3:
+ return Symbol.Paste;
+ case 4:
+ return Symbol.Bold;
+ case 5:
+ return Symbol.Italic;
+ default:
+ return Symbol.Underline;
+ }
+ }
+
+ private int GetIntFromSymbol(Symbol symbol)
+ {
+ switch (symbol)
+ {
+ case Symbol.Cut:
+ return 1;
+ case Symbol.Copy:
+ return 2;
+ case Symbol.Paste:
+ return 3;
+ case Symbol.Bold:
+ return 4;
+ case Symbol.Italic:
+ return 5;
+ case Symbol.Underline:
+ return 6;
+ default:
+ return -1;
+ }
+ }
+
+ private SelectorBarItem GetSelectorBarItem()
+ {
+ SelectorBarItem selectorBarItem = new SelectorBarItem();
+
+ if (txtSelectorBarItemText != null)
+ {
+ selectorBarItem.Text = txtSelectorBarItemText.Text;
+ }
+
+ if (cmbSelectorBarItemIcon != null && cmbSelectorBarItemIcon.SelectedIndex > 0)
+ {
+ selectorBarItem.Icon = new SymbolIcon(GetSymbolFromInt(cmbSelectorBarItemIcon.SelectedIndex));
+ }
+
+ if (cmbSelectorBarItemChild != null && cmbSelectorBarItemChild.SelectedIndex > 0)
+ {
+ selectorBarItem.Child = cmbSelectorBarItemChild.SelectedIndex == 1 ? GetTextBlockChild() : GetTextBoxChild();
+ }
+
+ return selectorBarItem;
+ }
+
+ private TextBlock GetTextBlockChild()
+ {
+ TextBlock textBlock = new TextBlock()
+ {
+ Text = "TextBlock",
+ VerticalAlignment = VerticalAlignment.Center
+ };
+
+ return textBlock;
+ }
+
+ private TextBox GetTextBoxChild()
+ {
+ TextBox textBox = new TextBox()
+ {
+ Text = "TextBox",
+ VerticalAlignment = VerticalAlignment.Center
+ };
+
+ return textBox;
+ }
+
+ private Brush GetForeground()
+ {
+ switch (cmbSelectorBarItemForeground.SelectedIndex)
+ {
+ case -1:
+ case 0:
+ return null;
+ case 1:
+ return new SolidColorBrush(Colors.Black);
+ case 2:
+ return new SolidColorBrush(Colors.Red);
+ default:
+ return new SolidColorBrush(Colors.Green);
+ }
+ }
+ }
+}
diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
index ad23193b81bb..e624a4103ee2 100644
--- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
+++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems
@@ -382,6 +382,18 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -5677,6 +5689,15 @@
SimpleScrollViewSample.xaml
+
+ SelectorBarPage.xaml
+
+
+ SelectorBarSamplePage.xaml
+
+
+ SelectorBarSummaryPage.xaml
+
SplitButtonTestsPage.xaml
diff --git a/src/Uno.UI.RuntimeTests/Directory.Build.targets b/src/Uno.UI.RuntimeTests/Directory.Build.targets
index fb41778dd9f7..6175a38e11c7 100644
--- a/src/Uno.UI.RuntimeTests/Directory.Build.targets
+++ b/src/Uno.UI.RuntimeTests/Directory.Build.targets
@@ -28,6 +28,10 @@
+
+
+
+
diff --git a/src/Uno.UI.RuntimeTests/MUX/Microsoft_UI_Xaml_Controls/SelectorBar/SelectorBarTests.cs b/src/Uno.UI.RuntimeTests/MUX/Microsoft_UI_Xaml_Controls/SelectorBar/SelectorBarTests.cs
new file mode 100644
index 000000000000..8b77c8dde7b2
--- /dev/null
+++ b/src/Uno.UI.RuntimeTests/MUX/Microsoft_UI_Xaml_Controls/SelectorBar/SelectorBarTests.cs
@@ -0,0 +1,270 @@
+#if HAS_UNO_WINUI
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+using Common;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using Microsoft.UI.Private.Controls;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Input;
+using MUXControlsTestApp.Utilities;
+using Private.Infrastructure;
+using System.Threading.Tasks;
+using Uno.UI.RuntimeTests.Helpers;
+
+namespace Microsoft.UI.Xaml.Tests.MUXControls.ApiTests;
+
+[TestClass]
+#if !__SKIA__
+[Ignore("Only works properly on Skia")]
+#endif
+public class SelectorBarTests : MUXApiTestBase
+{
+ private const int c_MaxWaitDuration = 5000;
+
+ private const double c_defaultUISelectorBarParentWidth = 400.0;
+ private const double c_defaultUISelectorBarParentHeight = 200.0;
+
+ [TestMethod]
+ public void VerifyDefaultSelectorBarItemPropertyValues()
+ {
+ RunOnUIThread.Execute(() =>
+ {
+ SelectorBarItem selectorBarItem = new SelectorBarItem();
+ Verify.IsNotNull(selectorBarItem);
+ Verify.AreEqual("", selectorBarItem.Text);
+ Verify.IsNull(selectorBarItem.Icon);
+ Verify.IsNull(selectorBarItem.Child);
+ Verify.IsFalse(selectorBarItem.IsSelected);
+ });
+ }
+
+ [TestMethod]
+ public void VerifyDefaultSelectorBarPropertyValues()
+ {
+ RunOnUIThread.Execute(() =>
+ {
+ SelectorBar selectorBar = new SelectorBar();
+ Verify.IsNotNull(selectorBar);
+ Verify.IsNotNull(selectorBar.Items);
+ Verify.IsNull(selectorBar.SelectedItem);
+ });
+ }
+
+ [TestMethod]
+ public async Task VerifySelectorBarItems()
+ {
+ IDisposable styleDisposable = null;
+ try
+ {
+ await TestServices.RunOnUIThread(() =>
+ {
+ styleDisposable = StyleHelper.UseFluentStyles();
+ });
+ //using (PrivateLoggingHelper privateIVLoggingHelper = new PrivateLoggingHelper("ItemsView", "ScrollView"))
+ {
+ SelectorBar selectorBar = null;
+ AutoResetEvent selectorBarLoadedEvent = new AutoResetEvent(false);
+ AutoResetEvent selectorBarUnloadedEvent = new AutoResetEvent(false);
+
+ RunOnUIThread.Execute(() =>
+ {
+ selectorBar = new SelectorBar();
+ Verify.IsNotNull(selectorBar);
+ Verify.IsNotNull(selectorBar.Items);
+
+ SelectorBarItem selectorBarItemDeleted = new SelectorBarItem()
+ {
+ Text = "Deleted",
+ Icon = new SymbolIcon(Symbol.Delete),
+ IsEnabled = false
+ };
+
+ selectorBar.Items.Add(selectorBarItemDeleted);
+
+ SelectorBarItem selectorBarItemRemote = new SelectorBarItem()
+ {
+ Text = "Remote",
+ Icon = new SymbolIcon(Symbol.Remote),
+ IsSelected = true
+ };
+
+ selectorBar.Items.Add(selectorBarItemRemote);
+
+ SelectorBarItem selectorBarItemShared = new SelectorBarItem()
+ {
+ Text = "Shared",
+ Icon = new SymbolIcon(Symbol.Share)
+ };
+
+ selectorBar.Items.Add(selectorBarItemShared);
+
+ SelectorBarItem selectorBarItemFavorites = new SelectorBarItem()
+ {
+ Text = "Favorites",
+ Icon = new SymbolIcon(Symbol.Favorite)
+ };
+
+ selectorBar.Items.Add(selectorBarItemFavorites);
+
+ Verify.AreEqual(4, selectorBar.Items.Count);
+
+ SetupDefaultUI(selectorBar, selectorBarLoadedEvent, selectorBarUnloadedEvent);
+ });
+
+ WaitForEvent("Waiting for Loaded event", selectorBarLoadedEvent);
+
+ RunOnUIThread.Execute(() =>
+ {
+ Log.Comment("Logging SelectorBar property values after Loaded event");
+ LogSelectorBarProperties(selectorBar);
+
+ Log.Comment("Verifying SelectorBar property values after Loaded event");
+ Verify.AreEqual(selectorBar.Items[1], selectorBar.SelectedItem);
+ Verify.IsTrue(selectorBar.IsEnabled);
+ Verify.IsFalse(selectorBar.IsTabStop);
+ Verify.AreEqual(XYFocusKeyboardNavigationMode.Auto, selectorBar.XYFocusKeyboardNavigation);
+ Verify.AreEqual(KeyboardNavigationMode.Once, selectorBar.TabNavigation);
+
+ ItemsView itemsView = SelectorBarTestHooks.GetItemsViewPart(selectorBar);
+
+ Log.Comment("Logging ItemsView property values after Loaded event");
+ LogItemsViewProperties(itemsView);
+
+ Log.Comment("Verifying ItemsView property values after Loaded event");
+ Verify.IsNotNull(itemsView);
+ Verify.AreEqual(XYFocusKeyboardNavigationMode.Disabled, itemsView.XYFocusKeyboardNavigation);
+ Verify.AreEqual(KeyboardNavigationMode.Once, itemsView.TabNavigation);
+ Verify.AreEqual(ItemsViewSelectionMode.Single, itemsView.SelectionMode);
+ Verify.AreEqual(1, itemsView.SelectedItems.Count);
+ Verify.AreEqual(-1, itemsView.CurrentItemIndex);
+ Verify.AreEqual(selectorBar.Items[1], itemsView.SelectedItem);
+
+ Log.Comment("Removing 2nd SelectorBarItem.");
+ selectorBar.Items.RemoveAt(1);
+ Verify.AreEqual(3, selectorBar.Items.Count);
+ Verify.IsNull(selectorBar.SelectedItem);
+
+ Log.Comment("Clearing all SelectorBarItems.");
+ selectorBar.Items.Clear();
+ Verify.AreEqual(0, selectorBar.Items.Count);
+
+ Log.Comment("Resetting window content and SelectorBar");
+ Content = null;
+ selectorBar = null;
+ });
+
+ WaitForEvent("Waiting for Unloaded event", selectorBarUnloadedEvent);
+ await TestServices.WindowHelper.WaitForIdle();
+ Log.Comment("Done");
+ }
+ }
+ finally
+ {
+ await TestServices.RunOnUIThread(() => styleDisposable?.Dispose());
+ }
+ }
+
+ private void SetupDefaultUI(
+ SelectorBar selectorBar,
+ AutoResetEvent selectorBarLoadedEvent = null,
+ AutoResetEvent selectorBarUnloadedEvent = null,
+ bool setAsContentRoot = true,
+ bool useParentGrid = false)
+ {
+ Log.Comment("Setting up default UI with SelectorBar");
+
+ Verify.IsNotNull(selectorBar);
+ selectorBar.Name = "selectorBar";
+
+ if (selectorBarLoadedEvent != null)
+ {
+ selectorBar.Loaded += (object sender, RoutedEventArgs e) =>
+ {
+ Log.Comment("SelectorBar.Loaded event handler");
+ selectorBarLoadedEvent.Set();
+ };
+ }
+
+ if (selectorBarUnloadedEvent != null)
+ {
+ selectorBar.Unloaded += (object sender, RoutedEventArgs e) =>
+ {
+ Log.Comment("SelectorBar.Unloaded event handler");
+ selectorBarUnloadedEvent.Set();
+ };
+ }
+
+ Grid parentGrid = null;
+
+ if (useParentGrid)
+ {
+ parentGrid = new Grid();
+ parentGrid.Width = c_defaultUISelectorBarParentWidth;
+ parentGrid.Height = c_defaultUISelectorBarParentHeight;
+
+ selectorBar.HorizontalAlignment = HorizontalAlignment.Left;
+ selectorBar.VerticalAlignment = VerticalAlignment.Top;
+
+ parentGrid.Children.Add(selectorBar);
+ }
+
+ if (setAsContentRoot)
+ {
+ Log.Comment("Setting window content");
+ if (useParentGrid)
+ {
+ Content = parentGrid;
+ }
+ else
+ {
+ Content = selectorBar;
+ }
+ }
+ }
+
+ private string GetStringFromSelectorBarItem(SelectorBarItem selectorBarItem)
+ {
+ return "Icon:" + (selectorBarItem.Icon == null ? "null" : selectorBarItem.Icon.ToString()) + ", Text:" + selectorBarItem.Text + ", Child:" + (selectorBarItem.Child == null ? "null" : selectorBarItem.Child.ToString());
+ }
+
+ private void LogSelectorBarProperties(SelectorBar selectorBar)
+ {
+ Log.Comment(" - selectorBar.SelectedItem: " + (selectorBar.SelectedItem == null ? "null" : GetStringFromSelectorBarItem(selectorBar.SelectedItem)));
+ foreach (var selectorBarItem in selectorBar.Items)
+ {
+ Log.Comment(" - selectorBar.Item: " + GetStringFromSelectorBarItem(selectorBarItem));
+ }
+ Log.Comment(" - selectorBar.IsEnabled: " + selectorBar.IsEnabled);
+ Log.Comment(" - selectorBar.IsTabStop: " + selectorBar.IsTabStop);
+ Log.Comment(" - selectorBar.XYFocusKeyboardNavigation: " + selectorBar.XYFocusKeyboardNavigation);
+ Log.Comment(" - selectorBar.TabNavigation: " + selectorBar.TabNavigation);
+ }
+
+ private void LogItemsViewProperties(ItemsView itemsView)
+ {
+ Log.Comment(" - itemsView.ItemTemplate: " + (itemsView.ItemTemplate == null ? "null" : "non-null"));
+ Log.Comment(" - itemsView.ItemsSource: " + (itemsView.ItemsSource == null ? "null" : "non-null"));
+ Log.Comment(" - itemsView.SelectedItem: " + (itemsView.SelectedItem == null ? "null" : "non-null"));
+ Log.Comment(" - itemsView.CurrentItemIndex: " + itemsView.CurrentItemIndex);
+ Log.Comment(" - itemsView.Layout: " + (itemsView.Layout == null ? "null" : "non-null"));
+ Log.Comment(" - itemsView.Layout as StackLayout: " + ((itemsView.Layout as StackLayout) == null ? "null" : "non-null"));
+ Log.Comment(" - itemsView.IsEnabled: " + itemsView.IsEnabled);
+ Log.Comment(" - itemsView.IsTabStop: " + itemsView.IsTabStop);
+ Log.Comment(" - itemsView.XYFocusKeyboardNavigation: " + itemsView.XYFocusKeyboardNavigation);
+ Log.Comment(" - itemsView.TabNavigation: " + itemsView.TabNavigation);
+ Log.Comment(" - itemsView.SelectionMode: " + itemsView.SelectionMode);
+ }
+
+ private void WaitForEvent(string logComment, EventWaitHandle eventWaitHandle)
+ {
+ Log.Comment(logComment);
+ if (!eventWaitHandle.WaitOne(TimeSpan.FromMilliseconds(c_MaxWaitDuration)))
+ {
+ throw new Exception("Timeout expiration in WaitForEvent.");
+ }
+ }
+}
+#endif
diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_FrameworkElement_And_Leak.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_FrameworkElement_And_Leak.cs
index ad9e82f3db0b..d88ec9c945d6 100644
--- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_FrameworkElement_And_Leak.cs
+++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_FrameworkElement_And_Leak.cs
@@ -53,6 +53,7 @@ public class Given_FrameworkElement_And_Leak
[DataRow(typeof(ToggleButton), 15)]
[DataRow(typeof(RepeatButton), 15)]
[DataRow(typeof(TextBlock), 15)]
+ [DataRow(typeof(ScrollViewer), 15)]
[DataRow(typeof(CheckBox), 15)]
[DataRow(typeof(ListView), 15)]
[DataRow(typeof(Microsoft.UI.Xaml.Controls.ProgressBar), 15)]
@@ -90,6 +91,12 @@ public class Given_FrameworkElement_And_Leak
[DataRow(typeof(Image), 15)]
#if !__IOS__ // Disabled https://github.com/unoplatform/uno/pull/15540
[DataRow(typeof(ToggleSwitch), 15)]
+#endif
+#if __SKIA__ && HAS_UNO_WINUI // Control is currently supported on Skia targets only.
+ [DataRow(typeof(SelectorBar), 15)]
+ [DataRow(typeof(SelectorBarItem), 15)]
+ [DataRow(typeof(ItemsView), 15)]
+ [DataRow(typeof(ScrollView), 15)]
#endif
[DataRow(typeof(Microsoft/* UWP don't rename */.UI.Xaml.Controls.SwipeControl), 15)]
[DataRow(typeof(SplitView), 15)]
diff --git a/src/Uno.UI/Directory.Build.targets b/src/Uno.UI/Directory.Build.targets
index 5026f9a7f6fd..2b7440659629 100644
--- a/src/Uno.UI/Directory.Build.targets
+++ b/src/Uno.UI/Directory.Build.targets
@@ -40,6 +40,12 @@
+
+
+
+
+
+
diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/SelectorBarItemAutomationPeer.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/SelectorBarItemAutomationPeer.cs
index e37ad9260d40..747e05d06426 100644
--- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/SelectorBarItemAutomationPeer.cs
+++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/SelectorBarItemAutomationPeer.cs
@@ -3,12 +3,12 @@
#pragma warning disable 114 // new keyword hiding
namespace Microsoft.UI.Xaml.Automation.Peers
{
-#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
+#if false
[global::Uno.NotImplemented]
#endif
public partial class SelectorBarItemAutomationPeer : global::Microsoft.UI.Xaml.Automation.Peers.ItemContainerAutomationPeer
{
-#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 SelectorBarItemAutomationPeer(global::Microsoft.UI.Xaml.Controls.SelectorBarItem owner) : base(owner)
{
diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBar.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBar.cs
index b0139db0095b..a86fd5ee6207 100644
--- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBar.cs
+++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBar.cs
@@ -3,13 +3,12 @@
#pragma warning disable 114 // new keyword hiding
namespace Microsoft.UI.Xaml.Controls
{
- [global::Microsoft.UI.Xaml.Markup.ContentPropertyAttribute(Name = "Items")]
-#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
+#if false
[global::Uno.NotImplemented]
#endif
public partial class SelectorBar : global::Microsoft.UI.Xaml.Controls.Control
{
-#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.SelectorBarItem SelectedItem
{
@@ -23,7 +22,7 @@ public partial class SelectorBar : global::Microsoft.UI.Xaml.Controls.Control
}
}
#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::System.Collections.Generic.IList Items
{
@@ -33,7 +32,7 @@ public partial class SelectorBar : global::Microsoft.UI.Xaml.Controls.Control
}
}
#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 static global::Microsoft.UI.Xaml.DependencyProperty ItemsProperty { get; } =
Microsoft.UI.Xaml.DependencyProperty.Register(
@@ -41,7 +40,7 @@ public partial class SelectorBar : global::Microsoft.UI.Xaml.Controls.Control
typeof(global::Microsoft.UI.Xaml.Controls.SelectorBar),
new Microsoft.UI.Xaml.FrameworkPropertyMetadata(default(global::System.Collections.Generic.IList)));
#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 static global::Microsoft.UI.Xaml.DependencyProperty SelectedItemProperty { get; } =
Microsoft.UI.Xaml.DependencyProperty.Register(
@@ -49,7 +48,7 @@ public partial class SelectorBar : global::Microsoft.UI.Xaml.Controls.Control
typeof(global::Microsoft.UI.Xaml.Controls.SelectorBar),
new Microsoft.UI.Xaml.FrameworkPropertyMetadata(default(global::Microsoft.UI.Xaml.Controls.SelectorBarItem)));
#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 SelectorBar() : base()
{
@@ -64,7 +63,7 @@ public SelectorBar() : base()
// Forced skipping of method Microsoft.UI.Xaml.Controls.SelectorBar.SelectionChanged.remove
// Forced skipping of method Microsoft.UI.Xaml.Controls.SelectorBar.ItemsProperty.get
// Forced skipping of method Microsoft.UI.Xaml.Controls.SelectorBar.SelectedItemProperty.get
-#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 event global::Windows.Foundation.TypedEventHandler SelectionChanged
{
diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarItem.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarItem.cs
index 9fa548fd2249..31b0c48eb4cb 100644
--- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarItem.cs
+++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarItem.cs
@@ -3,12 +3,12 @@
#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
[global::Uno.NotImplemented]
#endif
public partial class SelectorBarItem : global::Microsoft.UI.Xaml.Controls.ItemContainer
{
-#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 string Text
{
@@ -22,7 +22,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.IconElement Icon
{
@@ -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 static global::Microsoft.UI.Xaml.DependencyProperty IconProperty { get; } =
Microsoft.UI.Xaml.DependencyProperty.Register(
@@ -44,7 +44,7 @@ public string Text
typeof(global::Microsoft.UI.Xaml.Controls.SelectorBarItem),
new Microsoft.UI.Xaml.FrameworkPropertyMetadata(default(global::Microsoft.UI.Xaml.Controls.IconElement)));
#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 static global::Microsoft.UI.Xaml.DependencyProperty TextProperty { get; } =
Microsoft.UI.Xaml.DependencyProperty.Register(
@@ -52,7 +52,7 @@ public string Text
typeof(global::Microsoft.UI.Xaml.Controls.SelectorBarItem),
new Microsoft.UI.Xaml.FrameworkPropertyMetadata(default(string)));
#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 SelectorBarItem() : base()
{
diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarSelectionChangedEventArgs.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarSelectionChangedEventArgs.cs
index 548883171586..ea40f92fe558 100644
--- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarSelectionChangedEventArgs.cs
+++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/SelectorBarSelectionChangedEventArgs.cs
@@ -3,12 +3,12 @@
#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
[global::Uno.NotImplemented]
#endif
public partial class SelectorBarSelectionChangedEventArgs
{
-#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
+#if false
internal SelectorBarSelectionChangedEventArgs()
{
}
diff --git a/src/Uno.UI/Helpers/WinUI/CppWinRTHelpers.cs b/src/Uno.UI/Helpers/WinUI/CppWinRTHelpers.cs
index 49e07a759b99..b67420ce1ce2 100644
--- a/src/Uno.UI/Helpers/WinUI/CppWinRTHelpers.cs
+++ b/src/Uno.UI/Helpers/WinUI/CppWinRTHelpers.cs
@@ -18,6 +18,12 @@ public static IDisposable RegisterXamlRootChanged(XamlRoot xamlRoot, TypedEventH
return Disposable.Create(() => xamlRoot.Changed -= handler);
}
+ public static IDisposable RegisterPropertyChanged(DependencyObject dependencyObject, DependencyProperty dependencyProperty, DependencyPropertyChangedCallback callback)
+ {
+ var token = dependencyObject.RegisterPropertyChangedCallback(dependencyProperty, callback);
+ return Disposable.Create(() => dependencyObject.UnregisterPropertyChangedCallback(dependencyProperty, token));
+ }
+
public static bool SetFocus(DependencyObject obj, FocusState focusState)
{
if (obj != null)
diff --git a/src/Uno.UI/Helpers/WinUI/ResourceAccessor.ResourceKeys.cs b/src/Uno.UI/Helpers/WinUI/ResourceAccessor.ResourceKeys.cs
index 39fa15d84121..f7f3ee6f7661 100644
--- a/src/Uno.UI/Helpers/WinUI/ResourceAccessor.ResourceKeys.cs
+++ b/src/Uno.UI/Helpers/WinUI/ResourceAccessor.ResourceKeys.cs
@@ -148,6 +148,8 @@ internal partial class ResourceAccessor
public const string SR_NumberBoxMinimumValueStatus = "NumberBoxMinimumValueStatus";
public const string SR_ItemContainerDefaultControlName = "ItemContainerDefaultControlName";
+ public const string SR_SelectorBarItemDefaultControlName = "SelectorBarItemDefaultControlName";
+
public const string SR_InfoBarCloseButtonName = "InfoBarCloseButtonName";
public const string SR_InfoBarOpenedNotification = "InfoBarOpenedNotification";
public const string SR_InfoBarClosedNotification = "InfoBarClosedNotification";
diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.Impl.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.Impl.cs
index f2a7587da353..76653b271316 100644
--- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.Impl.cs
+++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/ItemsSourceView.Impl.cs
@@ -176,6 +176,11 @@ void ListenToCollectionChanges(object vector)
_collectionChangedListener = Disposable.Create(() => observableVector.VectorChanged -= OnVectorChanged);
observableVector.VectorChanged += OnVectorChanged;
break;
+
+ case IObservableVector observableVectorUntyped:
+ _collectionChangedListener = Disposable.Create(() => observableVectorUntyped.UntypedVectorChanged -= OnUntypedVectorChanged);
+ observableVectorUntyped.UntypedVectorChanged += OnUntypedVectorChanged;
+ break;
}
}
@@ -189,6 +194,11 @@ void OnBindableVectorChanged(IBindableObservableVector sender, object e)
OnVectorChanged(default, (IVectorChangedEventArgs)e);
}
+ void OnUntypedVectorChanged(object sender, IVectorChangedEventArgs args)
+ {
+ OnVectorChanged(default, args);
+ }
+
void OnVectorChanged(IObservableVector