I have a DataGrid in which I want the column headers to be customized.
I need to show a Label and optionally a combobox below the Label.
All Column Labels should be aligned Top in the Header of the column and the comboboxes should be aligned at the bottom. I tried to do this with a Grid but the problem is that the Grid doesn't fill up all the available space in the Header. Also tried with a DockPanel but have the same problem, the DockPanel doesn't fill up the available space.
I can't use Styles to accomplish this as it will break the style when applying Themes.
How can I make the TexBlocks to align top and ComboBoxes align at the bottom?
This is my Window xaml
<Window x:Class="DataGridTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:controls="clr-namespace:ActiproSoftware.Windows.Controls.DataGrid;assembly=ActiproSoftware.DataGrid.Contrib.Wpf" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"><Grid><Grid.RowDefinitions><RowDefinition/><RowDefinition Height="30"/></Grid.RowDefinitions><DataGrid x:Name="dataGrid" Grid.Row="0" Margin="0,0,10,0" VerticalAlignment="Top" RenderTransformOrigin="-10.556,-1.744" HorizontalAlignment="Right" Width="507" Height="310"><DataGrid.Columns><DataGridCheckBoxColumn Width="50"><DataGridCheckBoxColumn.Header><Grid VerticalAlignment="Stretch" Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridColumnHeader}}, Path=Height}"><Grid.RowDefinitions><RowDefinition Height="*"/><RowDefinition Height="*"/></Grid.RowDefinitions><TextBlock TextWrapping="Wrap" Width="40" DockPanel.Dock="Top">Value1 Test</TextBlock><ComboBox Grid.Row="1" Visibility="Collapsed"/></Grid></DataGridCheckBoxColumn.Header></DataGridCheckBoxColumn><DataGridCheckBoxColumn><DataGridCheckBoxColumn.Header><Grid VerticalAlignment="Stretch"><Grid.RowDefinitions><RowDefinition Height="*"/><RowDefinition Height="*"/></Grid.RowDefinitions><TextBlock TextWrapping="Wrap" Width="50">Value2 Test With Four Lines</TextBlock><ComboBox Grid.Row="1"/></Grid></DataGridCheckBoxColumn.Header></DataGridCheckBoxColumn><DataGridCheckBoxColumn><DataGridCheckBoxColumn.Header><Grid VerticalAlignment="Stretch"><Grid.RowDefinitions><RowDefinition Height="*"/><RowDefinition Height="*"/></Grid.RowDefinitions><TextBlock Text="Value3" HorizontalAlignment="Center" DockPanel.Dock="Top" Grid.Row="0"/><ComboBox VerticalAlignment="Bottom" Grid.Row="1" Margin="0,1"/></Grid></DataGridCheckBoxColumn.Header></DataGridCheckBoxColumn></DataGrid.Columns></DataGrid></Grid></Window>