Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window x:Class="DefaultBehavior_KeyBinding.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">
- <Window.InputBindings>
- <KeyBinding Key="F2" Command="{Binding TestCommand}"/>
- </Window.InputBindings>
- <Grid>
- <Button Content="Add" Width="100" Height="35" Grid.Row="0" Name="EmptyButton" Click="EmptyButton_Click"/>
- </Grid>
- public partial class MainWindow : Window
- {
- public ICommand TestCommand { get; private set; }
- public MainWindow()
- {
- this.TestCommand = ........some command is attached here...
- InitializeComponent();
- this.DataContext = this;
- }
- private void EmptyTabButton_Click(object sender, RoutedEventArgs e)
- {
- Window childwindow = new Window() { Title = "ChildWindow", Width = 200, Height = 300 };
- childwindow.Show();
- }
- }
- MainWindow mainWindow;
- public Window(MainWindow w)
- {
- mainWindow = w;
- }
- mainWindow.TabPress();
- Window childwindow = new Window(this) { Title = "ChildWindow", Width = 200, Height = 300 };
- childwindow.Show();
- private void EmptyTabButton_Click(object sender, RoutedEventArgs e)
- {
- Window childwindow = new Window() { Title = "ChildWindow", Width = 200, Height = 300 };
- childWindow.InputBindings.AddRange(this.InputBindings);
- childwindow.Show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement