Пример #1
0
        private static void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.OriginalSource == sender && e.Key == Key.Space)
            {
                // ignore alt + space which invokes the system menu
                if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
                {
                    return;
                }

                VirtualToggleButton.UpdateIsChecked((DependencyObject)sender);
                e.Handled = true;
            }
        }
Пример #2
0
        private static void UpdateIsChecked(DependencyObject d)
        {
            bool?isChecked = VirtualToggleButton.GetIsChecked(d);

            if (isChecked.HasValue == false)
            {
                VirtualToggleButton.SetIsChecked(d, false);
            }
            else if (isChecked == true)
            {
                VirtualToggleButton.SetIsChecked(d, false);
            }
            else if (isChecked == false)
            {
                VirtualToggleButton.SetIsChecked(d, true);
            }
        }
Пример #3
0
 private static void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     e.Handled = true;
     VirtualToggleButton.UpdateIsChecked((DependencyObject)sender);
 }