0

I have several WPF XCeed DataGrids defined.

Whenever a DataGrid gets focus, the 1st cell of the DataGrid is highlighted. I would like to turn off this behavior as I am handling my own selection for these grids.

Here is the XAML definition of the DataGrid:

<xcdg:DataGridControl 
  x:Name="ReEnrollmentStepsDetailsGrid" 
  VerticalAlignment="Stretch"
  HorizontalAlignment="Stretch"
  AutoCreateColumns="False" 
  SelectionMode="Extended"
  SelectionUnit="Cell"
  AllowDrag="True"
  AllowSearch="True"
  ReadOnly="True"  
  SelectionChanged="SampleGrid_SelectionChanged"
  Style="{StaticResource SampleGridStyle}"
  ItemContainerStyle ="{StaticResource SampleGridRowStyle}"

After reading several posts, I tried adding the following attribute to my XAML definition.

SynchronizeCurrent="False"

That attribute doesn't seem to have any effect. I still get the same results.

How do I disable this (what appears to be) default behavior?

Thanks

JohnB
  • 3,921
  • 8
  • 49
  • 99

1 Answers1

0

You can accomplish this by using adding some code behind for the Loaded event.

GridControl xaml:

<xcdg:DataGridControl 
     ...
     Loaded="DataGridControl_Loaded">

c# code begin:

private void DataGridControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
    if (sender is DataGridControl dg)
    {
        dg.SelectedItem = null;
    }
}