diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml index 23d871efcb..6c21cd1d84 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml @@ -29,6 +29,13 @@ + + + + + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml.cs index feabafc6d1..8deb4366ff 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/RoutedEvents/RoutedEventsPage.xaml.cs @@ -1,5 +1,6 @@ using System; using Uno.UI.Samples.Controls; +using Windows.UI; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; @@ -21,6 +22,11 @@ namespace SamplesApp.Samples.RoutedEvents btn.Click += (s, e) => btn.Content = $"{btn.Content}.Clk"; btn.Tapped += (s, e) => btn.Content = $"{btn.Content}+T"; + + list.Items.Add("A"); + list.Items.Add("B"); + list.Items.Add("C"); + list.Items.Add("D"); } private void HookEvents(Grid grid, TextBlock textBlock) @@ -69,18 +75,21 @@ namespace SamplesApp.Samples.RoutedEvents grid.PointerExited += (s, e) => textBlock.Text += ">>"; + var blue = new SolidColorBrush(Colors.Blue); + var white = new SolidColorBrush(Colors.WhiteSmoke); + grid.PointerPressed += (s, e) => { textBlock.Text += "_"; - grid.BorderBrush = SolidColorBrushHelper.Blue; + grid.BorderBrush = blue; }; grid.PointerReleased += (s, e) => { textBlock.Text += "-"; - grid.BorderBrush = SolidColorBrushHelper.WhiteSmoke; + grid.BorderBrush = white; }; - grid.BorderBrush = SolidColorBrushHelper.WhiteSmoke; + grid.BorderBrush = white; grid.BorderThickness = new Thickness(3.5); grid.GotFocus += (s, e) => textBlock.Text += ".F"; diff --git a/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.wasm.cs b/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.wasm.cs index ea253c2098..fef6fd2f74 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.wasm.cs @@ -14,6 +14,11 @@ namespace Windows.UI.Xaml.Controls.Primitives private void UpdateItemSelectedState(object item, bool updateTo) { + if (item == null) + { + return; + } + var container = ContainerFromItem(item); if (container is SelectorItem selectorItem) {