Beispiel #1
0
 void AssociatedObject_GotFocus(object sender, System.Windows.RoutedEventArgs e)
 {
     if (AssociatedObject.Tag.IsNotNullOrEmpty())
     {
         StatusMessage.setStatus(AssociatedObject.Tag.ToString());
     }
 }
Beispiel #2
0
 private void textBox_GotFocus(object sender, RoutedEventArgs e)
 {
     if (sender is TextBox)
     {
         TextBox tb = sender as TextBox;
         if (tb.Tag.IsNotNullOrEmpty())
         {
             StatusMessage.setStatus(tb.Tag.ToString());
         }
     }
     else if (sender is PasswordBox)
     {
         PasswordBox pwd = sender as PasswordBox;
         if (pwd.Tag.IsNotNullOrEmpty())
         {
             StatusMessage.setStatus(pwd.Tag.ToString());
         }
     }
     else if (sender is ComboBox)
     {
         ComboBox cb = sender as ComboBox;
         if (cb.Tag.IsNotNullOrEmpty())
         {
             StatusMessage.setStatus(cb.Tag.ToString());
         }
     }
 }
Beispiel #3
0
 protected override void OnGotFocus(RoutedEventArgs e)
 {
     SelectionStart     = 0;
     SelectionLength    = Convert.ToString(Text).Length;
     previouseCellValue = Text;
     if (Tag.IsNotNullOrEmpty())
     {
         StatusMessage.setStatus(Tag.ToString());
     }
     base.OnGotFocus(e);
 }
Beispiel #4
0
        private static void GridColumnFastEdit(DataGridCell cell, RoutedEventArgs e)
        {
            if (cell == null || cell.IsEditing || cell.IsReadOnly)
            {
                return;
            }

            DataGrid dataGrid = FindVisualParent <DataGrid>(cell);

            if (dataGrid == null)
            {
                return;
            }

            dataGrid.UnselectAll();

            if (dataGrid.SelectionUnit != DataGridSelectionUnit.FullRow)
            {
                if (!cell.IsSelected)
                {
                    cell.IsSelected = true;
                }
            }
            else
            {
                DataGridRow row = FindVisualParent <DataGridRow>(cell);
                if (row != null && !row.IsSelected)
                {
                    row.IsSelected = true;
                }
            }

            if (!cell.IsFocused)
            {
                cell.Focus();
            }

            String statusmsg = "";

            if (cell.Content is TextBlock)
            {
                TextBlock tb = cell.Content as TextBlock;
                if (tb != null)
                {
                    statusmsg = tb.Text;
                }
            }
            else if (cell.Content is TextBox)
            {
                TextBox tb = cell.Content as TextBox;
                if (tb != null)
                {
                    statusmsg = tb.Text;
                }
            }
            else if (cell.Content is ComboBox)
            {
                ComboBox cb = cell.Content as ComboBox;
                if (cb != null)
                {
                    statusmsg = cb.Text;
                    //DataGrid dataGrid = FindVisualParent<DataGrid>(cell);
                    cell.Dispatcher.Invoke(
                        DispatcherPriority.Background,
                        new Action(delegate { }));
                    cb.IsDropDownOpen = true;
                }
            }
            if (cell.Content is ContentPresenter)
            {
                TextBlock tb = FindVisualChild <TextBlock>(cell);
                if (tb != null)
                {
                    statusmsg = tb.Text;
                }
            }


            StatusMessage.setStatus(statusmsg);
        }