Search code examples
c#uwpscrollviewer

ScrollViewer selects NumberBox by click to blank space


I have simple UWP project with ScrollViewer and NumberBox. When user clicks to blank space a ScrollViewer selects first NumberBox in xaml file.

...
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
...

<ScrollViewer>
   <TextBlock Text="Some text" />
   <muxc:NumberBox/>
</ScrollViewer>

enter image description here

But if add some item like Combobox above then ScrollViewer does't select NumberBox

<ScrollViewer>
   <TextBlock Text="Some text" />
   <ComboBox />
   <muxc:NumberBox/>
</ScrollViewer>

enter image description here

If i delete ScrollViewer the NumberBox will not select when user clicks to blunk space.

<TextBlock Text="Some text" />
<muxc:NumberBox/>

enter image description here

How to fix this?


Solution

  • Disable select first item when click to blank space

    <ScrollViewer IsTabStop="True">