Hi
Shwe,
Thank
you for Contacting Syncfusion support,
We
have analyzed your query. You can bind the GridDataVisiblecolumn in code behind
instead of binding in XAML from ObservableCollection. Please refer the below
code snippet.
Code Snippet[C#]:
ObservableCollection<GridDataVisibleColumn> _Columns;
ObservableCollection<GridDataVisibleColumn> Columns
{
get { return _Columns; }
set {
_Columns = value; }
}
public ObservableCollection<GridDataVisibleColumn> GetColumns()
{
var columns = new ObservableCollection<GridDataVisibleColumn>();
columns.Add(new GridDataVisibleColumn() {MappingName="CustomerID" });
return columns;
}
public MainWindow()
{
InitializeComponent();
Columns = GetColumns();
syncgrid.VisibleColumns.Add(Columns[0]); syncgrid.VisibleColumns.Add(Columns[1])
}
|
We
have prepared a sample based on this and you can download it form below
location,
Sample
Location:
GridDataControl_Sample.zip
We
have a SfDataGrid control like GridDataControl. But compare to GridDataControl,
SfDataGrid having a better performance and flexibility. SfDataGrid assists you
to create entirely customizable and highly interactive features used to display
and manipulate the huge amount of data. So, we suggest you to use SfDataGrid
instead of GridDataControl.
We
have prepared a sample based on the same scenario in SfDataGrid and you can
download it from below location.
Sample
Location:
SampleApplication.zip
Please
let us know if you have any queries,
Regards,
Saravanan.M