Last active
August 29, 2015 14:18
-
-
Save LosManos/189b3adba9401272b088 to your computer and use it in GitHub Desktop.
XAML stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ViewModel VM { get; set; } // View model. | |
public MainWindow() | |
{ | |
VM = new ViewModel(); | |
InitializeComponent(); | |
PreviewKeyDown += HandleEsc; // Esc to close window. | |
} | |
// Esc to close window. | |
private void HandleEsc(object sender, KeyEventArgs e) | |
{ | |
if (e.Key == Key.Escape) | |
{ | |
Close(); | |
} | |
} | |
/* | |
<Window x:Class="WhatIsInTheBarnBooth.MainWindow" | |
x:Name="MyWindow" <- Set for View model. | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="MainWindow" Height="350" Width="525" | |
DataContext="{Binding ElementName=MyWindow, Path=VM}"> <- Set View model. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment