Unable to find anything on the Xamarin Forms UI forum that solves this,
have looked at this - https://www.telerik.com/forums/several-xamarin-datagrid-questions
and this on the UI for Windows forum - https://www.telerik.com/forums/how-to-display-datagrid-column-header-in-2-lines
I've tried using a DataGridTemplateColumn:
<
grid:DataGridTemplateColumn
CanUserEdit
=
"False"
HeaderText
=
"Title"
>
<
grid:DataGridTemplateColumn.HeaderContentTemplate
>
<
DataTemplate
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
Label
Text
=
"Distance"
/>
<
Label
Text
=
"(miles)"
Grid.Row
=
"1"
/>
</
Grid
>
</
DataTemplate
>
</
grid:DataGridTemplateColumn.HeaderContentTemplate
>
<
grid:DataGridTemplateColumn.CellContentTemplate
>
<
DataTemplate
>
<
Grid
>
<
Label
Text
=
"{Binding JourneyDistance}"
/>
</
Grid
>
</
DataTemplate
>
</
grid:DataGridTemplateColumn.CellContentTemplate
>
</
grid:DataGridTemplateColumn
>
Which returns - No property, bindable property, or event found for 'CellContentTemplate', or mismatching type between value
Also tried a DataGridTextColumn.HeaderContentTemplate using both a StackLayout
<
grid:DataGridTextColumn
CanUserEdit
=
"False"
PropertyName
=
"JourneyDistance"
>
<
grid:DataGridTextColumn.HeaderContentTemplate
>
<
DataTemplate
>
<
StackLayout
>
<
Label
Text
=
"Line 1"
/>
<
Label
Text
=
"Line 2"
/>
</
StackLayout
>
</
DataTemplate
>
</
grid:DataGridTextColumn.HeaderContentTemplate
>
</
grid:DataGridTextColumn
>
and a Grid inside the template
<
grid:DataGridTextColumn
CanUserEdit
=
"False"
PropertyName
=
"JourneyDistance"
>
<
grid:DataGridTextColumn.HeaderContentTemplate
>
<
DataTemplate
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
Label
Text
=
"Distance"
/>
<
Label
Text
=
"(miles)"
Grid.Row
=
"1"
/>
</
Grid
>
</
DataTemplate
>
</
grid:DataGridTextColumn.HeaderContentTemplate
>
</
grid:DataGridTextColumn
>
The last snippet runs without error but the header is just empty
Help please.