Hi,
I'm trying to append a checkbox column to an existing grid/datasource (such that users can multi select via checking/unchecking). However, I'm having some problems.
I've attached a sample project. If you run it, you'll see that the checkbox column has been added correctly. Checking/unchecking different item works too. However, if you click on any one of the label header (sort), all the checkbox selections disappear.
Another problem that I'm facing (on Windows XP) is that if you run the application without resizing the window, scroll all the way down with the mouse wheel, then scroll all the way up again, and (in my case) the scroll bar disappears.
Please help.
Thanks
Other posts that I'm waiting for some sort of reply (let alone help):
http://forums.infragistics.com/forums/t/12826.aspx
http://forums.infragistics.com/forums/t/12152.aspx
Also, this post might help in your situation:
http://blogs.infragistics.com/blogs/joshs/archive/2008/06/16/putting-a-checkbox-in-the-cells-of-an-unboundfield-of-xamdatagrid.aspx
Hi Josh, thanks for the reply!!!
I've fixed my problem... well, I *think*. What I've done was manually added a new column to my DataTable as well as a new field into the Xam grid. This way, I was no longer having problems with my checkbox selections disappearing.
As for changing the record selector column into a column of checkboxes, I never knew that was possible, so thanks! Would come in really handy.
Was wondering if I can do this with custom data types though? Eg, I might have a DataEntry class (assuming that I've no idea what/how many properties are being exposed and how they're implemented. Could be a list of values representing multiple columns, or a dictionary, or normal properties), and I'd like to add a checkbox to it. If I were to encapsulate this into a new class (eg, SelectableDataEntry) with a IsChecked/IsSelected property, I'd be ending up with a nested structure. And that's what's going to be displayed by the Xam grid.
Any thoughts on that?
I'm not clear on what you mean when you say:
jsjslim said:I might have a DataEntry class (assuming that I've no idea what/how many properties are being exposed and how they're implemented. Could be a list of values representing multiple columns, or a dictionary, or normal properties), and I'd like to add a checkbox to it.
The XamDataGrid only binds to properties on objects. A list of values, or a dictionary, is not a suitable data source. It seems your question could be phrased as, "how can I use your ViewModel approach if I am working with dynamically generated data sources?" The answer to that is, of course, it depends. If you are dealing with a data source object that supports having its "schema" generated dynamically, such as a DataTable, then simply append another column to it. If you are working with dynamically generated types, such as those created by Reflection.Emit, then add your IsChecked property to the type as it is being generated. You cannot have a generic ViewModel class that can wrap any object, and then tell the XamDataGrid to display it as one level of data.
You could generate an XML document out of your data, and then bind the XDG to that.
Hi Josh,
Thanks for the reply.
Finally narrowed down my problem to this:
Josh Smith said: If you are dealing with a data source object that supports having its "schema" generated dynamically, such as a DataTable, then simply append another column to it. If you are working with dynamically generated types, such as those created by Reflection.Emit, then add your IsChecked property to the type as it is being generated.
Guess I'm trying to figure out how to dynamically generate a schema that can be used by xdg, A.k.a, something like a DataTable.
The reason I'm avoiding DataTable is because the data that I'm trying to populate is returned in its own type (list of list of column values), and I did not want to have to repopulate a DataTable in order to display it (which is what I'm doing right now). As for swapping the custom type out with a DataTable, well, I'm not in a position to request/perform such a change, unfortunately.
Thanks for trying to help! Would appreciate it if you can recommend some links/classes that I should look at to get this to work.