Save command binded to multiple providers

Save command binded to multiple providers

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


snaky posted on Thursday, February 28, 2008

Is it possible in WPF to bind a button with Save command to multiple CslaDataProviders ?

RockfordLhotka replied on Thursday, February 28, 2008

I don't know of a way to do that through XAML. Perhaps you could write a control that accepted the command and then routed it to other controls on the form?

Then have the button send the command to this "router" control, which would route the command to all your data provider controls.

You'd have to figure out how to associate the data provider controls with this router - which is certainly possible, though I don't know the solution off the top of my head.

A simpler solution is to not use commanding, but rather to use a click event handler in code-behind and just call Save() on all your data provider controls. Easy to do, but not as elegant Smile [:)]

Copyright (c) Marimer LLC