Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <Window x:Class="DefaultBehavior_KeyBinding.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. Title="MainWindow" Height="350" Width="525">
  5. <Window.InputBindings>
  6. <KeyBinding Key="F2" Command="{Binding TestCommand}"/>
  7. </Window.InputBindings>
  8. <Grid>
  9. <Button Content="Add" Width="100" Height="35" Grid.Row="0" Name="EmptyButton" Click="EmptyButton_Click"/>
  10. </Grid>
  11.  
  12. public partial class MainWindow : Window
  13. {
  14. public ICommand TestCommand { get; private set; }
  15. public MainWindow()
  16. {
  17. this.TestCommand = ........some command is attached here...
  18. InitializeComponent();
  19. this.DataContext = this;
  20. }
  21.  
  22. private void EmptyTabButton_Click(object sender, RoutedEventArgs e)
  23. {
  24. Window childwindow = new Window() { Title = "ChildWindow", Width = 200, Height = 300 };
  25. childwindow.Show();
  26. }
  27. }
  28.  
  29. MainWindow mainWindow;
  30. public Window(MainWindow w)
  31. {
  32. mainWindow = w;
  33. }
  34.  
  35. mainWindow.TabPress();
  36.  
  37. Window childwindow = new Window(this) { Title = "ChildWindow", Width = 200, Height = 300 };
  38. childwindow.Show();
  39.  
  40. private void EmptyTabButton_Click(object sender, RoutedEventArgs e)
  41. {
  42. Window childwindow = new Window() { Title = "ChildWindow", Width = 200, Height = 300 };
  43.  
  44. childWindow.InputBindings.AddRange(this.InputBindings);
  45.  
  46. childwindow.Show();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement