Xamarin.Forms.DataGrid
Xamarin.Forms.DataGrid copied to clipboard
How to create DataGridColumn consisting DataTemplate progamatically?
So I have created a datagrid with each DataGridColumn defined in XAML code. The DataGridColumn Title is also binded to a value in my viewModel.
But apparently the Title's value is not changing because it is not observablecollection type. For it to change, the old column must be cleared and new column with new title need to be create.
According to #143 workarounds, I need to create a new ColumnsCollection and set the column to the new collections. But it only shows how to code DataGridColumn properties (Title, PropertyName)
But I need to code it like in XAML below
<dg:DataGridColumn Title="{Binding dayOfWeek[0]}" PropertyName="day1" Width="1*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<StackLayout>
<Label>
</StackLayout>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
Thank you 😃