SfDataGrid dataGrid = new SfDataGrid();
dataGrid.ItemsSource = historyList;
dataGrid.AutoGenerateColumns = false;
DataTemplate template = new DataTemplate(() =>
{
StackLayout stack = new StackLayout() { Orientation = StackOrientation.Vertical };
Label date = new Label();
date.SetBinding(Label.TextProperty, "DisplayTime");
Label eventAction = new Label();
eventAction.SetBinding(Label.TextProperty, "ActionDescription");
stack.Children.Add(date);
stack.Children.Add(eventAction);
return stack;
});
GridTemplateColumn oCustomColumn = new GridTemplateColumn
{
CellTemplate =template,
MappingName=" ActionDescription ",
HeaderText = "Action",
};
dataGrid.Columns.Add(oCustomColumn);
dataGrid.ColumnSizer = ColumnSizer.LastColumnFill;
Content = dataGrid;
|