Open
Description
Describe the bug
If you try to set the DataGrid column header font size it does not work.
- Is this bug a regression in the toolkit? Version 6.1.1
Steps to Reproduce
- Can this be reproduced in the Sample App?
<controls:DataGrid
Grid.Row="1"
x:Name="dataGrid"
Margin="12"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
AlternatingRowBackground="Transparent"
AlternatingRowForeground="Gray"
AreRowDetailsFrozen="False"
AreRowGroupHeadersFrozen="True"
AutoGenerateColumns="False"
CanUserSortColumns="False"
CanUserReorderColumns="True"
CanUserResizeColumns="True"
ColumnHeaderHeight="32"
MaxColumnWidth="400"
FontSize="24"
FrozenColumnCount="0"
GridLinesVisibility="None"
HeadersVisibility="Column"
IsReadOnly="False"
RowDetailsTemplate="{StaticResource RowDetailsTemplate}"
RowDetailsVisibilityMode="Collapsed"
SelectionMode="Extended"
RowGroupHeaderPropertyNameAlternative="Range">
<controls:DataGrid.Columns>
<controls:DataGridTextColumn Header="Rank" Binding="{Binding Rank}" Tag="Rank" />
<controls:DataGridComboBoxColumn Header="Mountain" Binding="{Binding Mountain}" Tag="Mountain" />
<controls:DataGridTextColumn Header="Height (m)" Binding="{Binding Height_m}" Tag="Height_m" />
<controls:DataGridTextColumn Header="Range" Binding="{Binding Range}" Tag="Range" />
<controls:DataGridTextColumn Header="Parent Mountain" Binding="{Binding Parent_mountain}" Tag="Parent_mountain" />
</controls:DataGrid.Columns>
</controls:DataGrid>
Steps to reproduce the behavior:
- Set the FontSize value on a DataGrid to anything other than 12.
- Run the app.
- The DataGrid column header font size will still be 12.
Expected behavior
The font size of the text in the column header should change to match the new value set.
Screenshots
Environment
NuGet Package(s): Microsoft.Toolkit.Uwp.UI.Controls.DataGrid
Package Version(s): 6.1.1
Windows 10 Build Number:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
- Insider Build (build number: )
App min and target version:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
- Insider Build (xxxxx)
Device form factor:
- Desktop
- Xbox
- Surface Hub
- IoT
Visual Studio
- 2017 (version: )
- 2019 (version: 16.8.3)
- 2019 Preview (version: )
Additional context
@michael-hawker confirmed the issue is on line 506 of https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml#L506. The value is hard coded.
Workaround
You'll have to copy the style and override it.
Suggested Fix From Michael Hawker
We should at least name these styles, if not expose this as at least an overridable resource value too.