Thursday, November 5, 2009

Great intro to MEF for Silverlight by Erik Mork

I don't want to forget about this one. I think at some stage I'm going to get asked about this at work. And we may want to use it.

http://development-guides.silverbaylabs.org/Video/Silverlight-MEF#videolocation_8

Tuesday, October 6, 2009

RhinoMocks for Silverlight

Another thing I can't belive I only just found. D'oh!

http://ayende.com/Blog/archive/2009/02/04/rhino-mocks-3.5-ndash-silverlight.aspx

Shawn Wildermuth on Silverlight Validation

Great to see someone talking about VAB with Silverlight, even though it's not supported yet.

http://wildermuth.com/2009/10/05/What_Do_We_Want_in_Silverlight_Validation

Fluent Validation Framework

Can't believe I hadn't heard of this one before. Wish I'd heard about it two weeks ago, may have been in time for me to use at work. Might be too late now.

http://fluentvalidation.codeplex.com/

Sunday, October 4, 2009

RelayCommand in Silverlight

It seems there are memory leak issues using Prism 2's DelegateCommand. I looked in the source for for Prism 3 recently and saw they appeared to be addressing them. One of the guys at work, doing some WPF stuff imported Josh Smith's RelayCommand, not because of memory leak issues though, but becuase he had found that Prism's DelegateCommand didn't behave as expected when the CanExecute property of the Command changed - he was having to do all the checks himself. RelayCommand does this for you.

I looked at using it in Silverlight, but found it was using the .NET 3.5 CommandManager which is not present in Silverlight. I just found this nice post by Laurent Bugnion that discusses this. Seems that's just the way it is in Silverlight. :-(

What's with WPF Data Validation?

Why did I have to spend so long at work last week replicating Silverlight's input validation template behaviour in WPF? Surely I'd have been able to find this work done by someone else? Maybe they're like me and can't really post what they've done for public use.

Don't see how you can write a decent WPF LOB application though without creating some half decent input validation templates.... They must be out there somewhere. Maybe my google skills aren't as good as I thought....

Thoughts on John Papa's DataForm MSDN Article

A nice article on using the DataForm. Documentation is lacking for this control, and most blog posts are out of date, as last minute changes were made before it was released.

Is it good to use the CustomValidator attribute? Stuff I've done recently is not using attributes. It means the validation checks are in the property setters.... Is this good? It keeps things contained, but maybe the validation doesn't really belong there.....

It is using databinding directly to the Employee model. Properties such as Age are integers, so if a character is entered, the model retains the old value and appears internally to be valid, even though the view is now in an invalid state, which is bad. Also, it means the only error message you can give the user is "Input string is not in a valid format". I think it's better to have a ViewModel, bind only to it, and have properties such as Age defined as a string so that any value can be set, and then checked for validity. Means the View and the ViewModel are kept in sync, and you can give the user customised error messages.

I'd hate to see the look on our UCD guys' faces if I had to tell them I couldn't give them a custom error message if an alpha was typed into a numeric field... Probably get more of that "that's crap, it's easy to do in Flex...." ;-)