How to set the RowHeight to a specific row in UWP ?
In UWP DataGrid allows you to set the RowHeight to specific row by using VisualContainer.RowHeights property.
The following code example explains how to set the RowHeight to a specific row.
C#
using Syncfusion.UI.Xaml.Grid.Helpers; this.sfdatagrid.Loaded += sfdatagrid_Loaded; //Event Hooking void sfdatagrid_Loaded(object sender, RoutedEventArgs e) { var VisualContainer = this.sfdatagrid.GetVisualContainer(); //Set RowHeight to 2'nd row VisualContainer.RowHeights[2] = 50; VisualContainer.InvalidateMeasure(); }
You can also use QueryRowHeight event to set the row height for a specific row. Refer to the following code example for the QueryRowHeight event.
C#
this.sfdatagrid.QueryRowHeight += sfdatagrid_QueryRowHeight; //Event Hooking void sfdatagrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) { if (e.RowIndex == 2) //Set RowHeight to 2'nd row. { e.Height = 50; e.Handled = true; } }
Use QueryRowHeight event only when you want to change the height for all rows based on certain conditions.
The following screenshot displays the output for setting RowHeight as 50 to a specific row.
Sample Links
Conclusion
I hope you enjoyed learning about how to set the RowHeight to a specific row in UWP.
You can refer to our UWP DataGrid feature tourpage 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!