I have a configurable set of columns for my datagrid, each row has an underlying object with a collection of "Property" objects each containing Name and DisplayValue for simplicity. The configuration deems which columns should be displayed and
therefore which "Property" objects need to be retrieved from the collection. A property has a DisplayValue property used to get and set. I'm building a datatable based on the configuration, the first thing I do is create a datacolumn
for each column in the configuration:-
New DataColumn(lobjColItem.Value.InternalName, Type.GetType("System.Object"))
Then I enumerate the data collection creating a new DataRow for each object and then adding the column data based on the column configuration:-
As DataRow =
As Client.Schema.Model.Property =
lobjNewRow.Item(lobjColItem.Value.InternalName) = lobjAttribute
I then set the ItemsSource property on my grid which has AutoGenerateColumns=True
Me.FilterDataGrid.ItemsSource = lobjTable.DefaultView
Everything is displaying fine, sorting, grouping and filtering are excellent. What is not working is the property binding, I was hoping that when i edit a cell in the grid it would call the set property on the property.DisplayValue - unfortunately not. The
table row knows the value has changed. I've spent hours reading and trying things but no luck.
Any help most appreciated...
Nov 4, 2008 at 2:37 AM
So editing works but doesn't call DisplayValue or editing doesn't work b/c it's not calling DisplayValue?
Hi, Editing works but doesn't call DisplayValue property to set the value in the object sat behind the datatable. I've moved on since I posted this and although I would still like to understand why, its not holding me up anymore. I'll knock up a sample
which highlights the problem.