In my use of the Silverlight 3 DataGrid I have found several missing "features" that I continue to write code to compensate for. Well I finally took some time and incorporated a few of those missing features into the Silverlight 3 DataGrid codebase.
Use and Enjoy
Source updated 10/19/2009 for bug in IsCellReadOnly
When extending the codebase for the DataGrid my goal was to add my features but otherwise leave the grid untouched. In my testing and in my applications this has proven to be the case - if I havent missed anything. You should very easily be able to remove your
current reference to System.Windows.Controls.Data and reference mine and your application should continue to run as it did before. I do plan to change the namespace if I make any breaking changes. I did change the version number so you can tell what your using.
I would like to contribute straight to the code but who knows how long, if ever, before these features would emerg for the public to use.
- IsRowReadOnly - added to DataGrid and is a bindable property that allows you to set individual rows into a readonly state! It most literally simply prevents the grid from putting a cell in that row into edit mode. So now if you have a property on
your model that indicates that the entity is readonly you can bind it to IsRowReadOnly and it will be evaluated for each row.
- IsCellReadOnly - added to DataGridColumn and will only take a binding expression. This expression is evaluated for each cell in that column. So if you have some property or business model logic that identifies a cell as readonly you can map that
binding to this property and PRESTO, the cell is readonly
- VerticalScrollIncrement - allows you to define a fixed vertical scroll increment. If this is left empty or set to 0 the datagrid will scroll as it always has.
- Vertical MouseWheel Scroll - its a quick and dirty implementation and only works for vertical scrolling but its better then nothing
- EnableOneClickEdit - if set to true then you can put cells into edit mode with one click, not one click to select the row and then one click to edit cell. A positive side effect is that checkbox columns now check and uncheck on click.