private void ControlButtonLoadedCommand_Execute(object obj)
 {
     System.Windows.Controls.Button loadedButton = obj as System.Windows.Controls.Button;
     if (loadedButton.DataContext == Buttons.First())
     {
         loadedButton.Focus();
     }
 }
 private void InsertTextToImage()
 {
     if (ImageTextBox.Visibility != Visibility.Visible)
     {
         ImageTextBox.BorderThickness = new Thickness(1);
         ImageTextBox.Text            = string.Empty;
         var width  = (int)TargetImage.ActualWidth;
         var height = (int)TargetImage.ActualHeight;
         var left   = _drawStartPoint.X;
         var top    = _drawStartPoint.Y;
         if (left + 20 > width)
         {
             left = width - 20;
             ImageTextBox.MaxWidth = 20;
         }
         else
         {
             ImageTextBox.MaxWidth = width - left;
         }
         if (top + ImageTextBox.FontSize > height)
         {
             top = (int)(height - ImageTextBox.FontSize);
             ImageTextBox.MaxHeight = ImageTextBox.FontSize;
         }
         else
         {
             ImageTextBox.MaxHeight = height - top;
         }
         ImageTextBox.Margin     = new Thickness(left, top, ImageTextBox.Margin.Right, ImageTextBox.Margin.Bottom);
         ImageTextBox.Visibility = Visibility.Visible;
         ImageTextBox.Focus();
     }
     else
     {
         _selectedButton.Focus();
     }
 }
Beispiel #3
0
 private void SelectButton(System.Windows.Controls.Button button)
 {
     button.Focus();
 }
Beispiel #4
0
        private void OnWindowLoaded(object sender, RoutedEventArgs e)
        {
            try
            {
                //pack://application:,,,/Tobi.Infrastructure;component/tango-icons/media-playback-pause.xaml
                Uri iconUri = new Uri("pack://application:,,,/Tobi;component/Tobi.ico", UriKind.Absolute);
                //Uri iconUri = new Uri("Tobi.ico", UriKind.RelativeOrAbsolute);
                Icon = BitmapFrame.Create(iconUri);
            }
            finally
            {
                //ignore
            }

            OnPropertyChangedButtonsSet();

            Button buttonToFocus = ButtonOK;

            switch (DefaultDialogButton)
            {
            case DialogButton.Yes:
            {
                buttonToFocus = ButtonYes;
                break;
            }

            case DialogButton.Ok:
            {
                buttonToFocus = ButtonOK;
                break;
            }

            case DialogButton.No:
            {
                buttonToFocus = ButtonNo;
                break;
            }

            case DialogButton.Close:
            {
                buttonToFocus = ButtonClose;
                break;
            }

            case DialogButton.Cancel:
            {
                buttonToFocus = ButtonCancel;
                break;
            }

            case DialogButton.Apply:
            {
                buttonToFocus = ButtonApply;
                break;
            }
            }

            buttonToFocus.Focus();
            FocusManager.SetFocusedElement(this, buttonToFocus);
            Keyboard.Focus(buttonToFocus);
        }