Main Ribbon Control Communication

Sep 11, 2008 at 5:37 PM
hi.

We have a main ribbon control that is injected into a region in the main shell.  One of the buttons is create.  Whether the create button is enabled or disabled depends on the active view.  The views are in separate modules that are injected into another region of the shell.  What is the best way to communicate up and down the tree?  I was planning on using an event aggregator to indicate the create button was pressed and having the view subscribe, but that still leaves whether the button is enabled based on the active view.  Any suggestions?

Thanks
Sep 12, 2008 at 9:32 PM
Hi John,

In your case I would use commands. Just attach a command to each of your buttons, and provide each presenter with the logic to enable/disable the command.

Another solution, manage a state of the active views in your common/infrastructure project, and create a binding between the Button.IsEnabled property and the views state. You can also use a Value Converter to decide what value to return.

Best Regards,

Tomer Shamam

Sep 17, 2008 at 8:25 PM
As Deepforest mentioned, it would be alot easier to use commands, even more so with DelegateCommands, as defined by the CAL.  In my case, I created a command service that exposes numerous methods for creation of regular and delegate commands. all deriving from the ICommand interface.  I then register my command service with UnityContainer


Sep 18, 2008 at 5:46 PM

That's a nice idea. Do you have any code you might be willing to share?

From: notifications@codeplex.com
To: wbagel6264@msn.com
Date: Wed, 17 Sep 2008 12:25:36 -0700
Subject: Re: Main Ribbon Control Communication [CompositeWPF:35469]

.ExternalClass {font-family:Verdana;font-size:0.75em;} .ExternalClass #EC_ThreadNotificationFooter {border-top:1px solid #ccc;color:gray;} .ExternalClass #EC_ThreadNotificationPostBody {margin-bottom:2em;} .ExternalClass {font-family:Verdana;font-size:0.75em;} .ExternalClass #EC_ThreadNotificationFooter {color:gray;border-top:1px solid #ccc;} .ExternalClass #EC_ThreadNotificationPostBody {margin-bottom:2em;} From: makaveli_0000
As Deepforest mentioned, it would be alot easier to use commands, even more so with DelegateCommands, as defined by the CAL. In my case, I created a command service that exposes numerous methods for creation of regular and delegate commands. all deriving from the ICommand interface. I then register my command service with UnityContainer


Read the full discussion online.
To add a post to this discussion, reply to this email (CompositeWPF@discussions.codeplex.com)
To start a new discussion for this project, email CompositeWPF@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com