Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7074139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:00:54+00:00 2026-05-28T06:00:54+00:00

I am using WPFToolKit DataGrid to display data; In my use case user clicks

  • 0

I am using WPFToolKit DataGrid to display data; In my use case

  1. user clicks on a cell and enters a value (I trap the event and set the focus to the TextBox)
  2. Presses Enter
  3. Value is committed
  4. Focus shifts to Next Cell

Now, user can’t enter any value in the TextBox(in the DataGridCell) unless he clicks on the cell. The TextBox can be a part of various controls(like NumericUpDown, Calendar etc.).

This behavior is similar to Excel but I am not able to shift the focus to the Underlying TextBox as various other wrapper user controls are there in the DataGridCell(something like DataGridCell contains MatrixCellContainer, which contains MatrixCell, which contains UpDown Control)

Any pointer will be really helpful.

Update:

I can achieve what I am looking for by handling DataGridCell_Selected event like this :

private void DataGridCell_Selected(object sender, RoutedEventArgs e)
{
        Microsoft.Windows.Controls.DataGridCell dataGridCell = 
               sender as Microsoft.Windows.Controls.DataGridCell;

    // ToDo: This is a very bad hack; 
    // should be replaced by some proper technique
    if (dataGridCell != null)
    {
        NumericUpDownBase<int>[] IntUpDownControls = 
            dataGridCell.GetChildrenOfType<NumericUpDownBase<int>>();
        if (IntUpDownControls.Count() != 0)
        {
            IntUpDownControls[0].Focus();
            //Keyboard.Focus(IntUpDownControls[0]);
        }
    else
    {
        NumericUpDownBase<double>[] DblUpDownControls = 
                dataGridCell.GetChildrenOfType<NumericUpDownBase<Double>>();
         if (DblUpDownControls.Count() != 0)
         {
                 DblUpDownControls[0].Focus();
                 //Keyboard.Focus(DblUpDownControls[0]);
          }
    }
    }
 }

But I know there will be a better way to achieve this!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:00:55+00:00Added an answer on May 28, 2026 at 6:00 am

    Finally I settled with this –

    private void HandleCellSelected(object sender, RoutedEventArgs e)
    {
        DataGridCell dataGridCell = sender as DataGridCell;
        if (dataGridCell != null)
        {
            TextBox[] textboxcontrols = dataGridCell.GetChildrenOfType<TextBox>();
            if (textboxcontrols.Count() != 0)
            {
                textboxcontrols[0].Focus();
            }
        }
    }
    

    Still looking for a better approach though…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the WPF toolkit datagrid to display some data and want to
I'm using the WPF Toolkit's DataGrid to display a set of search results. As
Is it possible to set DataGridCell's template when using WpfToolkit's DataGrid? Or is it
I'm using the WPF toolkit datagrid. I have it set to SelectionUnit=Cell and SelectionMode=Extended
im using the WPFToolkit's DataGrid and im trying to get an edit button working,
I'm using DataTemplateSelector with the WPFToolkit DataGrid. I want to select the editing template
I am using WPF toolkit provided DataGrid control to display product list along with
Im using WPFToolkit datagrid control and do the binding in such way: <WpfToolkit:DataGrid x:Name=dgGeneral
I'm using a Datagrid from the WPFtoolkit and am running into a problem with
I'm using the WPF toolkit datagrid, and I'd like to set the background color

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.