Advertisement
Noseratio

18417648

Aug 26th, 2013
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.01 KB | None | 0 0
  1. http://stackoverflow.com/questions/18417648/inconsistency-in-wpf-command-routing-behavior-depending-on-the-ui-focus-state
  2.  
  3. C#:
  4.     public static readonly RoutedUICommand MyCommand = ApplicationCommands.Paste;
  5.  
  6.  
  7. XAML:
  8.  
  9.  
  10.     <StackPanel Margin="20,20,20,20">
  11.         <TextBox Name="textBoxOutput" Focusable="True" IsTabStop="True" Height="300"/>
  12.  
  13.         <Button FocusManager.IsFocusScope="True" Name="btnTest" Focusable="False" IsTabStop="False" Content="Test (ICommand.Execute)" Click="btnTest_Click" Width="200"/>
  14.         <Button FocusManager.IsFocusScope="True" Focusable="False" IsTabStop="False" Content="Test (Command property)" Command="local:MainWindow.MyCommand" Width="200"/>
  15.         <Menu Width="200" Focusable="False" >
  16.             <MenuItem Focusable="False" Header="Test (Command property)" Command="local:MainWindow.MyCommand" />
  17.         </Menu>
  18.         <Button FocusManager.IsFocusScope="True" Name="btnClearFocus" Focusable="False" IsTabStop="False" Content="Clear Focus" Click="btnClearFocus_Click" Width="200" Margin="138,0,139,0"/>
  19.  
  20.     </StackPanel>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement