- Home
- Forum
- Xamarin.Forms
- sfDataGrid header and footer
sfDataGrid header and footer
|
<sfGrid:SfDataGrid x:Name="dataGrid"
AutoGenerateColumns="False"
ColumnSizer="Star"
HeaderRowHeight="0"> |
Thread ID: | Created: | Updated: | Platform: | Replies: |
| 128939 | Feb 16,2017 08:12 PM | Feb 19,2017 11:32 PM | Xamarin.Forms | 4 |
| Tags: SfDataGrid |


Thanks for contacting Syncfusion support.
Your requirement to remove column and row lines can be done by writing a custom GridStyle to the SfDataGrid where you can return the GridLinesVisibility as GridLinesVisibility.None. Please refer the following UG link for more information.
UG Link : https://help.syncfusion.com/xamarin/sfdatagrid/styles#border-customization
In case you want a border around the grid, place the grid inside a Frame.
Your requirement of loading multiple labels for Header can be achieved by writing a HeaderTemplate. Please refer the following UG link for more information.
UG Link : https://help.syncfusion.com/xamarin/sfdatagrid/column-types#headertemplate
We have provided a sample based on your requirements where we have loaded a grid without borders and loaded header template.
Sample Link : http://www.syncfusion.com/downloads/support/forum/128653/ze/Sample1792546815
Regards,
Vimal Prabhu
Thanks for the update. We have analyzed your query. You have almost done everything right, but have missed out on setting the GridTemplateColumn.MappingName property to an underlying property of the collection which is set as ItemsSource. MappingName property cannot be null for a column, since columns are created only if proper MappingName exists. Please refer the below UG link for more information.
UG Link : https://help.syncfusion.com/xamarin/sfdatagrid/column-types#mappingname
|
<syncfusion:GridTemplateColumn MappingName="CustomerID">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<Label Text="{Binding CustomerID}" TextColor="Black" XAlign="Center" YAlign="Center" />
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
</syncfusion:GridTemplateColumn> |
Regards,
Vimal Prabhu
I am coming back to my original question. I cannot figure out how to implement something like that below on sfdatagrid
in sflistview there is HeaderTemplate but i cant find similar, i tried RowHeaderTemplate as shown below but it didnt display at all.
<sfListView:SfListView.HeaderTemplate>
<DataTemplate>
<Grid ColumnSpacing="5" RowSpacing="5" HorizontalOptions="FillAndExpand" BackgroundColor="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="150"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
</DataTemplate>
</sfListView:SfListView.HeaderTemplate>
is this not supposed to be like below
<sfgrid:SfDataGrid.RowHeaderTemplate>
<DataTemplate>
<Label Text="test" />
</DataTemplate>
</sfgrid:SfDataGrid.RowHeaderTemplate>
above works using ShowRowHeader="True" but this is not what i expected or asked.
Basically I am looking for header for sfDataGrid like sfListView header. Not for rows or columns.
- 14 Replies
- 6 Participants
-
EM Emil
- Feb 3, 2017 12:15 AM UTC
- Jul 12, 2017 07:10 AM UTC