WPF Commanding - Doing additional UI Work

WPF Commanding - Doing additional UI Work

Old forum URL: forums.lhotka.net/forums/t/7598.aspx


richardb posted on Thursday, September 10, 2009

Hi,

Doing a WPF UI on top of CSLA 3.8.  Good fun and excellent stuff.

Have a 2 questions that are probably more WPF related but is around the commanding options.

As per the ProjectTracker sample, I have my Save and Cancel buttons hooked directly to my business object.  When I click the Save button the object saves itself.  Great!  But, I want the save button to close the form also.  Ultimately I'm looking for an OK, Apply and Canel series of buttons.

1.  Can I do this through xaml or do I need to discard the commanding and do it all in code-behind?

2. Also, as I modify a field it is only when I tab off the control that the binding fires and the business object updates the buttons.  Is there some trick to firing this as a character is changed, added or removed?

Thanks,
Richard.

RockfordLhotka replied on Thursday, September 10, 2009

You can use commanding, and implement the command handler in code-behind.

Or you can not use commanding, and handle the Click event in code-behind.

Either way, the easy solutions result in code-behind.

If you want to avoid the code-behind, you'll probably want to look at the MVVM pattern.

In CSLA .NET 3.8 I'm working to better support various MVVM approaches - but so far I've been doing all my work in Silverlight, so none of the new features exist for WPF yet.

Fintanv replied on Thursday, September 10, 2009

In answer to 2.

{Binding MyProperty, UpdateSourceTrigger=PropertyChanged}

Copyright (c) Marimer LLC