Why in the next XAML, by clicking on the disabled button, make ScrollViewer steal focus from the TextBox? It is 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. But is this decision right?
source share