For the last few weeks i have been struggling with the DataForm control from the Silverlight toolkit. The control itself has some nice features, but it shows some strange quirks from time to time. It’s pretty bossy, in a way that it likes to control the collectionview it’s binded to and also does some strange stuff to the collection. One of the biggest issues i had with it was the following:
– If I would add a new item to the collection from code, the dataform would try to commit it immediately. Which basically means that the “Cancel” button wouldn’t do anything, and it should cancel addition of a new object to the collection. This is just one of the problems, but it’s the stuff you don’t really want around, and that can get really annoying and also lead to some nasty bugs.
I also didn’t care much for navigation and CRUD buttons: if i want those i’ll do it on the side somewhere. Yet they felt like they introduced unnecessary complexity. So the solution i ended up with is downloading the Silverlight toolkit source and doing some tweaks and modifications. I also renamed it to SlimForm, as well as everything around it (DataField became SlimField and such) just to keep things divided and clean. I did some tweaks from the get go, the solution is (for now) cooperating much better with my custom CollectionViews (which i’ll also get online soon i hope), i got rid of the navigation and CRUD stuff, some Resharper refactoring and that’s basically it! My aim is to make it as passive and responsive as possible, without sacrificing the validation and editing functions, which i only care about. This is a first take on the whole thing, but it’s so refreshing to have control over those tricky behaviours, instead of jumping through hoops and doing some weird workarounds. Not much work went into it, but it’s gonna save you an hour or 3:) HTH! Download link: SlimForm