Articles in this section
Category / Section

How to set the AlternatingRowStyle to TextBox which is directly loaded into GridTemplateColumn in UWP DataGrid?

3 mins read

SfDataGrid.AlternatingRowStyle property helps you to apply styles for the alternate rows in SfDataGrid. When you set the SfDataGrid.AlternatingRowStyle, the style is not applied to TextBox that is directly loaded into GridTemplateColumn as displayed in the following screenshot.


You can overcome this by setting the TextBox Background as Transparent that is loaded in GridTemplateColumn.

The following code example explains the SfDataGrid is defined with AlternatingRowStyle and GridTemplateColumn is defined with TextBox.


<!--Need to add this code snippet in Resources Define the style with Key-->
<Style x:Key="AlternateRowStyle" TargetType="syncfusion:VirtualizingCellsControl">
      <Setter Property="Background" Value = "LightGray " />
<syncfusion:SfDataGrid Name="SfdataGrid" 
                    AlternatingRowStyle="{StaticResource AlternateRowStyle}"
                    ItemsSource="{Binding Employee}"
        <syncfusion:GridTemplateColumn HeaderText="Employee Name" MappingName="Name" >
                    <TextBox Background="Transparent" Text="{Binding Name}" />


The following screenshot displays the output of SfDataGrid with AlternatingRowStyle. Here, the TextBox is loaded to the Employee name column.


Sample Links,






I hope you enjoyed learning about how to set the AlternatingRowStyle to TextBox which is directly loaded into GridTemplateColumn.

You can refer to our  UWP DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our UWP DataGrid example
to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment