Visual Studio not recognizing the "Background" property on VirtualizingCellsControl

This is probably something stupid.  I'm just trying to set an alternating row color for my sfdatagrid, following examples.  Using v31.2.12.

        <Style x:Key="alternatingRowStyle" TargetType="sf:VirtualizingCellsControl">
            <Setter Property="Background" Value="Blue"/>
        </Style>

Errors:

  • Error XLS0431 Invalid value for property 'Property': 'Background' MyProjectName C:\Users\Me\source\repos\MyProject\MyProject\UserControls\MyUserControl.xaml 26
  • Error (active) MC4005 Cannot find the Style Property 'Background' on the type 'Syncfusion.Windows.Controls.Cells.VirtualizingCellsControl'. Line 26 Position 21. MyProjectName C:\Users\Me\source\repos\MyProject\MyProject\UserControls\MyUserControl.xaml 26

Even stranger is both intellisense and 'go to definition' finds the property just fine.  Only the compiler fails.


3 Replies 1 reply marked as answer

SB Sweatha Bharathi Syncfusion Team November 21, 2025 07:54 AM UTC

Hi john,

We have reviewed your provided information and suspect that you have used both Syncfusion.SfGrid.WPF and Syncfusion.GridCommon.WPF DLLs. These DLLs share a common namespace http://schemas.syncfusion.com/wpf. Additionally, the VirtualizingCellsControl exists in both DLLs with the same name, which can lead to an ambiguous type reference exception if you reference http://schemas.syncfusion.com/wpf in your project.
To resolve this, you can explicitly declare the namespace for VirtualizingCellsControl by specifying the assembly, as shown below:
Code snippet to resolve ambiguous error:
<Window x:Class="SfDataGrid_Demo4_8.MainWindow"
                     xmlns:syncfusion="clr-namespace:Synfusion.UI.Xaml.Grid;assembly=Syncfusion.SfGrid.WPF">
 
 <Style TargetType="syncfusion:VirtualizingCellsControl">
               <Setter Property="Background" Value="Blue"/>
 </Style>


Find the sample demo in the attachment and let us know if you have any concerns on this.

Regards,
Sweatha B

Attachment: sample_4c5ea9d7.zip

Marked as answer

JO john replied to Sweatha Bharathi November 21, 2025 05:10 PM UTC

Worked like a charm.  Thanks!



SB Sweatha Bharathi Syncfusion Team November 24, 2025 04:10 AM UTC

 john,

Glad that your issue is resolved! Please get back to us if you need any further assistance, we will be happy to help you.


Loader.
Up arrow icon