I want to bind DataTable to XamDataGrid.
my Data Table is
DataTable
dt = new DataTable
();
dt.Columns.Add(
new DataColumn("Column1", typeof(Object
)));
new DataColumn("Column2", typeof(Object
DataRow
dr = dt.NewRow();
dr[
"Column1"] = new TestDTO() { ID = 1, Test123 = "pri"
};
"Column2"] = new TestDTO() {ID = 1,Test123 ="pri"
dt.Rows.Add(dr);
dr1 = dt.NewRow();
dr1[
"Column1"] = new TestDTO() { ID = 2, Test123 = "Ach"
"Column2"] = new TestDTO() {ID=2,Test123 ="Ach"
dt.Rows.Add(dr1);
in my DataGrid have two column 1 is TestDTO and display value is Test123
<
igDP:Field Name="Column1" Label="Column 1" >
<igDP:Field.Settings
>
}">
and second one is
="Visible"
=Column2}"
="Test123" />
="True" />
<!--<Setter Property="DropDownButtonDisplayMode" Value="Always" />-->
="Destination_EnterKeyPress"/>
I want to bind DataTable to Grid.
The column DataType should testDTO and display value is test123
Hello Harsh,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hi Stefan,
Thanks for the sample. It worked. Earlier we were updating datatable from worker thread.
Thank you for your post. I have been looking into it and I created a sample project following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
Actully we able to update cell value but new columns and new rows are not added to view. Actually we are adding rows/columns dynamically. We able to see change in datatable but that change is not reflected on GUI.
Hello Stefan,
In our setup new columns are added to data table after grid initialization. But these new colums are not updated in the view. Do you have any sample example for that. Basically after grid initialization any change in datatable is not getting reflected on view. Please share example. Thanks in advance.