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 8392831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:37:23+00:00 2026-06-09T19:37:23+00:00

I don’t need focus navigation between cells. I tried to set Focusable=False in cell

  • 0

I don’t need focus navigation between cells.
I tried to set Focusable=”False” in cell style and adjust focusvisualstyle for the row, but selection fails in that case.

  • 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-06-09T19:37:25+00:00Added an answer on June 9, 2026 at 7:37 pm

    Yeah you need to set the Selection Unit for DataGrid to FullRow and set borderThickness to 0 with FocusVisualStyle to null.

    <DataGrid SelectionUnit="FullRow">
      <DataGrid.CellStyle>
          <Style TargetType="DataGridCell">
              <Setter Property="BorderThickness" Value="0"/>
              <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
           </Style>
      </DataGrid.CellStyle>
      <!-- ... -->
    </DataGrid>
    

    UPDATE

    Above stated xaml is best you can do with xaml only approach but in case you want to handle the tabulation too, then you have to go to code behind. This is how i achieved it –

    <DataGrid x:Name="dg" ItemsSource="{Binding Objects}" SelectionUnit="FullRow">
      <DataGrid.CellStyle>
         <Style TargetType="DataGridCell">
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <EventSetter Event="PreviewKeyDown" Handler="dg_PreviewKeyDown"/>
          </Style>
      </DataGrid.CellStyle>
    </DataGrid>
    

    Code behind (What i am doing here is if user pressed key right or left simply handle them
    so as to stop the navigation from one cell to other and in case user press Tab key, focus
    should go to the next row if available instead of moving to next cell) –

    private void dg_PreviewKeyDown(object sender, KeyEventArgs e)
    {
      if (e.Key == Key.Left || e.Key == Key.Right)
         e.Handled = true;
      else if (e.Key == Key.Tab)
      {
         DataGridRow a = UtilityFunctions.FindParent<DataGridRow>(sender as DependencyObject);
         DataGridRow nextDataGridRow =(DataGridRow)dg.ItemContainerGenerator
                                         .ContainerFromIndex(a.GetIndex() + 1);
         if (nextDataGridRow != null)
         {
            dg.SelectedIndex = a.GetIndex() + 1;
            DataGridCell cell = UtilityFunctions.FindChild<DataGridCell>
                                  (nextDataGridRow as DependencyObject, "");
            cell.Focus();
         }
         e.Handled = true;
       }
    }
    

    In the above code i have used some utility functions required to travel the Visual tree to find necessary parent or child in the Visual tree. For your reference the code for it as follows –

    public class UtilityFunctions
    {
       public static Parent FindParent<Parent>(DependencyObject child)
                where Parent : DependencyObject
            {
                DependencyObject parentObject = child;
    
                //We are not dealing with Visual, so either we need to fnd parent or
                //get Visual to get parent from Parent Heirarchy.
                while (!((parentObject is System.Windows.Media.Visual) || (parentObject is System.Windows.Media.Media3D.Visual3D)))
                {
                    if (parentObject is Parent || parentObject == null)
                    {
                        return parentObject as Parent;
                    }
                    else
                    {
                        parentObject = (parentObject as FrameworkContentElement).Parent;
                    }
                }
    
                //We have not found parent yet , and we have now visual to work with.
                parentObject = VisualTreeHelper.GetParent(parentObject);
    
                //check if the parent matches the type we're looking for
                if (parentObject is Parent || parentObject == null)
                {
                    return parentObject as Parent;
                }
                else
                {
                    //use recursion to proceed with next level
                    return FindParent<Parent>(parentObject);
                }
            }
    
       public static T FindChild<T>(DependencyObject parent, string childName)
               where T : DependencyObject
            {
                // Confirm parent is valid.  
                if (parent == null) return null;
    
                T foundChild = null;
    
                int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
                for (int i = 0; i < childrenCount; i++)
                {
                    var child = VisualTreeHelper.GetChild(parent, i);
                    // If the child is not of the request child type child 
                    T childType = child as T;
                    if (childType == null)
                    {
                        // recursively drill down the tree 
                        foundChild = FindChild<T>(child, childName);
    
                        // If the child is found, break so we do not overwrite the found child.  
                        if (foundChild != null) break;
                    }
                    else if (!string.IsNullOrEmpty(childName))
                    {
                        var frameworkElement = child as FrameworkElement;
                        // If the child's name is set for search 
                        if (frameworkElement != null && frameworkElement.Name == childName)
                        {
                            // if the child's name is of the request name 
                            foundChild = (T)child;
                            break;
                        }
                    }
                    else
                    {
                        // child element found. 
                        foundChild = (T)child;
                        break;
                    }
                }
    
                return foundChild;
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't dismiss this as a newbie question! It's not, I'm not, I've tried everything,
Don't know why but font is not displaying.Please help. CSS(in css folder): style.css: @font-face
Don't ask me why but I need to do the following: string ClassName =
Don't ask me why but i can't use this method because I need to
Don't need to do this right now but thinking about the future... What would
Don't think this is a repost, difficult to search for the word between because
Don't need to go so far, just install Devexpress 11.2.5 and run the GridDemo(
don't know if the title describes anything about what I'm trying to say but
Don't ask me how but I'm in a situation where I have DCPs published
don't know what happened in my jcrop selection. I think I pressed some keys

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.