DataGrid for WPF and Silverlight Overview > DataGrid Features > DataGrid Appearance > Customizing Grid Appearance > Changing the Grid's Font Style |
You may want to update the font style that appears in DataGrid for WPF when the control is run. For example, you may want to change the style of the grid, an element of which is the font style, to match your application's appearance.
At Design Time
To change the font style, complete the following steps:
In XAML
To change the font style, add FontFamily="Times New Roman" FontSize="10" to the <c1:C1DataGrid> tag so that it appears similar to the following:
<c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" FontFamily="Times New Roman" FontSize="10" />
In Code
To remove alternating row colors and set it so all rows appear white, add the following code to your project:
Visual Basic |
Copy Code
|
---|---|
Me.c1datagrid1.FontFamily = New FontFamily("Times New Roman")
Me.c1datagrid1.FontSize = 10
|
C# |
Copy Code
|
---|---|
this.c1datagrid1.FontFamily = new FontFamily("Times New Roman"); this.c1datagrid1.FontSize = 10; |
What You've Accomplished
Run the application and observe that all rows in the grid appear in the Times New Roman font.