Skip to content

Instantly share code, notes, and snippets.

@iamrommel
Last active September 14, 2019 03:48
Show Gist options
  • Select an option

  • Save iamrommel/5942846 to your computer and use it in GitHub Desktop.

Select an option

Save iamrommel/5942846 to your computer and use it in GitHub Desktop.

Revisions

  1. iamrommel revised this gist Jul 7, 2013. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Keyboard Shortcut
    Original file line number Diff line number Diff line change
    @@ -21,4 +21,11 @@ void ScreenLayoutKeyUp(object sender, KeyEventArgs e)
    {
    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");
    }

    }
  2. iamrommel created this gist Jul 7, 2013.
    24 changes: 24 additions & 0 deletions Keyboard Shortcut
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    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);
    }
    }