This is a migrated thread and some comments may be shown as answers.

Suggestion for header styles

2 Answers 42 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Magnus
Top achievements
Rank 1
Magnus asked on 28 Aug 2017, 06:17 AM

When using HeaderTextWrapping and FilteringMode.FilterRow the headers does not look consistent. The filter-rows should take up the same height on all columns. This looks the same for several styles.

Solution: The GridViewHeaderRowTemplate contains a Grid named PART_OuterGrid, and it's second RowDefinition should have Auto-height.

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin
Telerik team
answered on 30 Aug 2017, 06:58 PM
Hi,

There are two components that could have Auto height for their row definitions - the one in the GridViewHeaderRow and another in the GridViewHeaderCell - which actually holds the filter control. Both of these row definitions are updated in code regardless the setters in the templates. Modifying the templates does not help in that case.

I have logged that as a bug here and you can subscribe to it in our feedback portal here to track its progress. 

Furthermore, I can propose you the following workaround for now to force these setters:
public MainWindow()
{
    InitializeComponent();
    this.grid.Loaded += grid_Loaded;
}
 
void grid_Loaded(object sender, RoutedEventArgs e)
{
    this.grid.ChildrenOfType<Grid>().FirstOrDefault(x => x.Name == "PART_OuterGrid").RowDefinitions[1].Height = GridLength.Auto;
 
    var cells = this.grid.ChildrenOfType<GridViewHeaderCell>();
    foreach (GridViewHeaderCell cell in cells)
    {
        cell.ChildrenOfType<Grid>().FirstOrDefault(x => x.Name == "PART_OuterGrid").RowDefinitions[1].Height = GridLength.Auto;
    }
 
}


Regards,
Martin
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Magnus
Top achievements
Rank 1
answered on 31 Aug 2017, 05:53 AM
Great! Thanks foryour help.
Tags
GridView
Asked by
Magnus
Top achievements
Rank 1
Answers by
Martin
Telerik team
Magnus
Top achievements
Rank 1
Share this question
or