Why in the next XAML clicking on disabled button cause ScrollViewer to steal focus from TextBox? Is it right? What is the workaround?
<Window
x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
FocusManager.FocusedElement="{Binding ElementName=TextBox}">
<ScrollViewer>
<StackPanel>
<TextBox x:Name="TextBox"/>
<Button IsEnabled="False" Content="Disabled Button"/>
</StackPanel>
</ScrollViewer>
Setting IsFocusable="False" on ScrollViewer helps. But is it right workaround?
Yes you can do IsFocusable="False"
or IsHitTestable="False"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With