Hai Yu,
Thanks for using Syncfusion products and sorry for the delay. It is possible to select a particular cell alone without highlighting other cells of same row, by setting AllowSelection="Cell" and ListBoxSelectionMode="None" in the GridDataControl . In order to make the Background color of selected cell as red, you can create a resource dictionary and refer it in GridDataControl resources.
Please refer the following code example :
Code Snippet[XAML] :
Inside File ‘Resource1.xaml’ : <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"> <syncfusion:GridDataStyleManager x:Key="CustomGridDataStyleManager"> <syncfusion:GridDataStyleManager.RowAppearence> <syncfusion:RowAppearence CurrentCellSelectionBackground="Red" CurrentCellSelectionForeground="Black" /> </syncfusion:GridDataStyleManager.RowAppearence> </syncfusion:GridDataStyleManager> </ResourceDictionary>
Inside MainWindows.xaml :
<syncfusion:LayoutControl.Resources> <ResourceDictionary Source="/BasicSortingDemo;component/Resources/Resource1.xaml" /> </syncfusion:LayoutControl.Resources> <syncfusion:GridDataControl x:Name="dataGrid1" AllowSelection="Cell" AutoPopulateColumns="False" AutoPopulateRelations="False" ColumnSizer="Star" ItemsSource="{Binding ProductInfo}" ListBoxSelectionMode="None" ShowGroupDropArea="False" ShowSortNumber="{Binding Path=IsChecked, ElementName=sortNumber}" StyleManager="{StaticResource CustomGridDataStyleManager}" VisualStyle="Office14Blue" > |
Regards,
Deepak raj Sundar
Hai Yu,
Sorry for the delay caused. We have created a sample in which the data source is a Data Table and cell BackGround color is changed on selection.
Please refer the Sample attached and the following code snippet.
Code Snippet[Xaml]:
Inside the Dictionary1.xaml file :
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"> <syncfusion:GridDataStyleManager x:Key="CustomGridDataStyleManager"> <syncfusion:GridDataStyleManager.RowAppearence> <syncfusion:RowAppearence HighlightSelectionBackground="Red" CurrentCellSelectionForeground="Black" TextBlock.TextAlignment="Justify" /> </syncfusion:GridDataStyleManager.RowAppearence> </syncfusion:GridDataStyleManager > </ResourceDictionary> |
Please Let us know if you have any concern.
Regards,
Deepak raj Sundar.
Hi Yu,
We have modified the sample , without column definitions and we are getting the style settings i.e. the background color of selected cell gets changed to red.
Please have a look to the attached sample and let us know if you have any concern.
Regards,
Deepak raj Sundar.