Thank you for your update.
We have
analyzed your query and we have achieve your requirement by using the following
code snippet.
Code
Snippet[Xaml]:
<syncfusion:GridDataControl x:Name="DataGrid" ItemsSource="{Binding GDCSource}" ShowAddNewRow="False" AutoPopulateColumns="False" local:GDCAttachedProperty.DynamicColumns="{Binding VisibleColumns}"> </syncfusion:GridDataControl> |
We have
prepared a sample based on this and it can be download from the following
location.
Sample
Location: GridDataControl_VisibleColumnsBinding.zip
Please let
us know if you have any questions.
Regards,
Raja sekar.G
Hi Darren,
We apologies for the delay caused.
The provided sample was unable to download at you end might be because of our server issue. We have reloaded the sample again and could you please check now.
Sample: GridDataControl_VisibleColumnsBinding.zip
Please let us know if you have any queries.
Gobinath A
private List<GridDataVisibleColumn> Getvisiblecolumn() { List<GridDataVisibleColumn> list = new List<GridDataVisibleColumn>(); for (int i = 0; i < 6; i++) { var bind = new System.Windows.Data.Binding() { Path =new System.Windows.PropertyPath($"ColumnArray[{i}].Text") }; list.Add(new GridDataVisibleColumn() // DynamicColumns { MappingName = $"ColumnArray[{i}].Text", Binding = bind, //Must set this property to let the GridDataControl know the type of property, you are binding when using arrarys VisibleColumnType = typeof(string) }); } return list; } private ObservableCollection<Data> Getsource() { ObservableCollection<Data> items = new ObservableCollection<Data>(); if (items != null) { for (int i = 0; i < 6; i++) { Data data = new Data(); for (int j = 0; j < 6; j++) { data.ColumnArray[j] = new Model(); data.ColumnArray[j].Text = "customer" + i; } items.Add(data); } } return items; } |