Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://stackoverflow.com/questions/18417648/inconsistency-in-wpf-command-routing-behavior-depending-on-the-ui-focus-state
- C#:
- public static readonly RoutedUICommand MyCommand = ApplicationCommands.Paste;
- XAML:
- <StackPanel Margin="20,20,20,20">
- <TextBox Name="textBoxOutput" Focusable="True" IsTabStop="True" Height="300"/>
- <Button FocusManager.IsFocusScope="True" Name="btnTest" Focusable="False" IsTabStop="False" Content="Test (ICommand.Execute)" Click="btnTest_Click" Width="200"/>
- <Button FocusManager.IsFocusScope="True" Focusable="False" IsTabStop="False" Content="Test (Command property)" Command="local:MainWindow.MyCommand" Width="200"/>
- <Menu Width="200" Focusable="False" >
- <MenuItem Focusable="False" Header="Test (Command property)" Command="local:MainWindow.MyCommand" />
- </Menu>
- <Button FocusManager.IsFocusScope="True" Name="btnClearFocus" Focusable="False" IsTabStop="False" Content="Clear Focus" Click="btnClearFocus_Click" Width="200" Margin="138,0,139,0"/>
- </StackPanel>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement