Last active
September 14, 2019 03:48
-
-
Save iamrommel/5942846 to your computer and use it in GitHub Desktop.
Creating a keyboard shortcuts for Lightswitch application
This file contains 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
partial void Tickets_Created() | |
{ | |
this.FindControl("ScreenLayout").ControlAvailable += Tickets_ControlAvailable; | |
} | |
void Tickets_ControlAvailable(object sender, Microsoft.LightSwitch.Presentation.ControlAvailableEventArgs e) | |
{ | |
var screenLayout = e.Control as System.Windows.Controls.Grid; | |
if (screenLayout == null) return; | |
screenLayout.KeyUp += ScreenLayoutKeyUp; | |
} | |
void ScreenLayoutKeyUp(object sender, KeyEventArgs e) | |
{ | |
if (e.Key == Key.A && | |
(Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == | |
(ModifierKeys.Control | ModifierKeys.Shift)) | |
{ | |
this.Details.Dispatcher.BeginInvoke(AddTicket_Execute); | |
} | |
if (e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) | |
{ | |
//This is just a sample | |
MessageBox.Show("CTRL + TAB trapped"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment