[Fluent] Convert DataGrid ControlTheme dimension setters to DynamicResource#240
Open
dimension-zero wants to merge 1 commit into
Open
[Fluent] Convert DataGrid ControlTheme dimension setters to DynamicResource#240dimension-zero wants to merge 1 commit into
dimension-zero wants to merge 1 commit into
Conversation
Extract hardcoded FontSize, MinHeight, and Padding values from DataGridCell, DataGridColumnHeader, and DataGridRowGroupHeader ControlThemes into named resource keys in Themes/Fluent.xaml. ControlTheme setters apply at priority 11 (StyleTheme) which silently overrides Application.Styles at priority 9; moving to DynamicResource lets theme consumers override these values globally. New keys: DataGridCellFontSize, DataGridCellMinHeight, DataGridColumnHeaderFontSize, DataGridColumnHeaderPadding, DataGridCellPadding. No visual change when not overridden.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DataGridCell,DataGridColumnHeader, andDataGridRowGroupHeaderControlTheme setters contained hardcoded values forFontSize,MinHeight, andPadding. Because ControlTheme applies at priority 11 (StyleTheme) and Application.Styles at priority 9, theme consumers could not override these values.Themes/Fluent.xaml:DataGridCellFontSize(15),DataGridCellMinHeight(32),DataGridColumnHeaderFontSize(12),DataGridColumnHeaderPadding(12,0,0,0),DataGridCellPadding(0).DataGridRowGroupHeaderandDataGridColumnHeadershareDataGridCellMinHeightandDataGridCellFontSizewhere the logical sizes are the same.Root cause
ControlTheme setters applied at priority 11 silently win over user-defined Application.Styles values at priority 9. A consumer writing:
would have had no effect before this change. Converting to
{DynamicResource DataGridCellFontSize}defers the lookup to runtime and lets the resource chain find the consumer-supplied value first.Test plan
dotnet build src/Avalonia.Controls.DataGrid— no XAML parse errors or missing-key warnings<x:Double x:Key="DataGridCellFontSize">11</x:Double>toApplication.Resourcesand confirm all three DataGrid control types change font size globally<x:Double x:Key="DataGridCellMinHeight">48</x:Double>and confirm DataGridCell, DataGridColumnHeader, and DataGridRowGroupHeader all grow to 48 px