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

Question about StyleSelectors (Background Property not recognized)

I'm trying to set the color of the border of a row in dependency of a value in the MVVM.
I found following documentation on your site: http://help.syncfusion.com/ug/wpf/default.htm#!documents/styleselectors.htm

Now I tried to translate this in a way I want to have:

        <converters:BetMethodConverter x:Key="converterBetMethod" />
        <converters:NonRunnerConverter x:Key="nonRunnerImageConverter"/>       
        <Style x:Key="gridRowBetStyle" TargetType="syncfusion:VirtualizingCellsControl">
                <DataTrigger Binding="{Binding HasBet}" Value="True">
                    <Setter Property="Background" Value="Bisque" />

But the IDE keeps telling me that the Property "Background" is not a element of Syncfusion.Windows.Controls.Cells.VirtualizingCellsControl.

Can you tell me what's wrong?

7 Replies

JG Jai Ganesh S Syncfusion Team February 13, 2015 12:52 PM UTC

Hi SXTrader,


Thank you for using Syncfusion Products.


We have analyzed your query. We have prepared the sample to set the row background based on the MVVM pattern but we are not getting any exception. Could you please check this sample and if you still got the exception, please modify this sample along with the replication procedure? This would be helpful to provide a better solution.


Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/SfGrid_StyleSelector228717480.zip


Please let us know if you have any other queries.


Thank you,

Jai Ganesh S

DF Diego Fernando Urabayen April 27, 2015 12:22 PM UTC

The VirtualizingCellsControll property does not appear in my project. Can you help me?

Attachment: RowStyle.png_305f0721.zip

JG Jai Ganesh S Syncfusion Team April 28, 2015 02:31 PM UTC

Hi SXTrader,

Sorry for the inconvenience caused.

We have checked the reported issue with our sample but we are unable to reproduce the issue and it worksfine in our end. Could you please check the name space and dlls are added properly in your project?We have also attached the sample and video for your reference,

Video Link: http://www.syncfusion.com/downloads/support/directtrac/137224/VirtualizingIssue599575384.zip

Please let us know if you have any other queries.

Thank you,

Jai Ganesh S

SX SXTrader September 2, 2015 07:32 PM UTC

could you please take a look into the attached example. For Some reason I've got this behaviour again.

Attachment: SXTippster_example_background_78df7217.zip

JG Jai Ganesh S Syncfusion Team September 3, 2015 09:08 AM UTC

Hi SXTrader,

Sorry for the inconvenience caused.

We have analyzed your issue and we found that we are having “VirtualizingCellsControl” class in both Syncfusion.UI.Xaml.Grid (present in Syncfusion.SfGrid.Wpf.dll) and Syncfusion.Windows.Controls.Cells (Present in Syncfusion.Grid.Wpf.dll) namespaces. The provided sample refer to both Syncfusion.SfGrid.Wpf.dll and also Syncfusion.Grid.Wpf.dllHence both namespaces are added to the below schema “http://schemas.syncfusion.com/wpf in your application. So this designer shows errors. However you can overcome this problem by creating the separate namespace of SfDataGrid and use that namespace in VirtualizingCellsControl class.


<Style x:Key="gridRowBet" TargetType="sfgrid:VirtualizingCellsControl">


                <DataTrigger Binding="{Binding HasBet}" Value="True">

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




We have also modified your sample based on this and you can download the sample from the below location,

Sample: http://www.syncfusion.com/downloads/support/directtrac/141954/ze/SXTippster_exampl_modifed1044293574

Please let us know if you need further assistance.

Thank you,

Jai Ganesh S

TD Timothy D Jones August 28, 2022 11:18 PM UTC

I am having the same issue. I looked at your example, and in your example, you are using <Window.Resources>. 

However, I am attempting to do this in a UserControl and in UserControl.Resources there is no property for background. 

How would I access a background property for the SfDataGrid in a UserControl?

Alternatively, if I need to access the cell background property with a style inside the SfDataGrid, how would I invoke a converter?

Ultimately, I need to change the background of the row conditionally based on a DateTime conditional statement. 

Attachment: Toolkit.ToDo_315aefcb.zip

VS Vijayarasan Sivanandham Syncfusion Team August 29, 2022 03:48 PM UTC

Hi Timothy D Jones,

Your reported issue occurs due to both Syncfusion.SfGrid.WPF and Syncfusion.Grid.WPF or Syncfusion.GridCommon.WPF dlls are present in the common namespace http://schemas.Syncfusion.com/wpf. Also, VirtualizingCellsControl control is present in both the dlls with the same name, it 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,

<UserControl x:Class="Toolkit.ToDo.Views.ToDoView"









             mc:Ignorable="d" d:Background="White"

             d:Height="680" d:Width="500"




        <local:ColorConverter x:Key="converter"/>

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

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




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 modified sample in the attachment and let us know if you have any concerns in this.


Vijayarasan S

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

Attachment: ModifiedSample_613732df.zip

Live Chat Icon For mobile
Up arrow icon