We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Row styling in dot net Core

I've used your example code from https://help.syncfusion.com/wpf/datagrid/conditional-styling#conditional-styling-of-rows-using-style-selector to dynamically change the row colour in my data grid, and it worked fine in my WPF dot Net Framework app. I'm now upgrading the app to dot Net Core, and the compiler is complaining that it:

MC4005: Cannot find the Style Property "Background" on the type 'Syncfusion.Windows.Controls.Cells.VirtualizingCellsControl'

<local:RowStyleConverter x:Key="rowstyleconverter"/>

<Style x:Key="stylecolor" TargetType="Syncfusion:VirtualizingCellsControl">
<Setter Property="Background" Value="{Binding Converter={StaticResource rowstyleconverter}}"/>

I had a look at the documentation for the VirtualizingCellsControl, and it didn't mention Background but did have RowSelectionBrush - however this still gave me the same error.

Why does your example not work with dotNet Core? How can I change the row colour in a dotNet Core WPF application?

2 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team February 1, 2023 02:05 PM UTC

Hi Russell,

Find the response to the queries,



Why does your example not work with dotNet Core?

The reported problem does not depend on .NET Core. You are declaring a control or class in XAML with the same name present in two different DLLs, and both DLLs are referenced to your project and declared using a common namespace in XAML. In this case, the reported problem occurs.

How can I change the row colour in a dotNet Core WPF application?

Your reported issue occurs because both Syncfusion.SfGrid.WPF and Syncfusion.Grid.WPF or Syncfusion.GridCommon.WPF dlls are present in a common namespace 
http://schemas.Syncfusion.com/wpf. Also, the VirtualizingCellsControl control is present in both the dlls with the same name, which leads to Cannot find the Style Property 'Background' on the type reference exception if you reference http://schemas.Syncfusion.com/wpf to your project.

You can resolve the reported problem by
 declaring the namespace for VirtualizingCellsControl explicitly by specifying the assembly as below,


Please refer to the below code snippet,

<Window x:Class="SfDataGridDemo.MainWindow"










        Title="MainWindow" Height="620" Width="800">






        <local:RowStyleSelector x:Key="rowStyleSelector" />


        <Style x:Key="stylecolor" TargetType="syncfusionSfDataGrid:VirtualizingCellsControl">

            <Setter Property="Background" Value="Bisque" />


        <Style x:Key="anotherstylecolor" TargetType="syncfusionSfDataGrid:VirtualizingCellsControl">

            <Setter Property="Background" Value="Aqua" />




For more information related to ambiguous type reference exceptions, please refer to the below knowledge base documentation link,

KB Link:  https://www.syncfusion.com/kb/5712/how-to-resolve-ambiguous-type-reference-exception

Please find the sample in the attachment.

Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Attachment: SfDataGridDemo_7145f8d8.zip

Marked as answer

RU Russell February 1, 2023 11:30 PM UTC

Thanks, that worked perfectly

Live Chat Icon For mobile
Up arrow icon