Programming help: Is this the correct way?

Topics related to the Krypton Navigator.

Moderators: Phil Wright, Chris Porter

Programming help: Is this the correct way?

Postby limsy » Tue Mar 03, 2009 8:50 pm

Hi all,

I want to implement a context sensitive contextmenu but am worried I'm doing it all the wrong way.
I'm using Ribbon + Navigator for my project. I have a dropdown button which links to a kryptoncontextmenu which contains quite a few items.
Depending on the current state of my application, I might not want to make all the items in the contextmenu available. What is the best way to go about this?

Currently, my plan is to get the contextmenu done entirely in design time (Ahh... how low I have sunk...) and having all of the items disabled. Depending on my application state, I will programatically enable or disable the menu items. Is this correct? I was hoping there's some way for the contextmenu to watch certain events/properties automatically instead of having me littering enable/disable all over the place. *blush*

Thank you for your time. Any help/info is greatly appreciated.
limsy
 
Posts: 11
Joined: Tue Feb 27, 2007 3:21 pm

Re: Programming help: Is this the correct way?

Postby Chris Porter » Wed Mar 04, 2009 1:34 pm

You might have some luck using the KryptonCommand object to tie certain items together and enable/disable them in a simpler fashion but it probably won't take you all the way.
Chris Porter
 
Posts: 714
Joined: Fri Oct 12, 2007 5:39 am
Location: Oklahoma City, OK, US

Re: Programming help: Is this the correct way?

Postby Phil Wright » Wed Mar 04, 2009 4:36 pm

You should hook into the DropDown event of the ribbon button. It is fired just before the context menu is shown and it allows you to examine and modify the contents of the context menu. So inside the event you would change the enabled state of each menu item to match the correct state you want to show. Then you do not need to keep updating the menu for each state change when the menu is not going to be displayed.
Phil Wright
Site Admin
 
Posts: 2720
Joined: Thu Apr 13, 2006 2:55 pm
Location: Melbourne, Australia

Re: Programming help: Is this the correct way?

Postby limsy » Thu Apr 23, 2009 12:40 pm

Awesome! Thanks Phil! :)
limsy
 
Posts: 11
Joined: Tue Feb 27, 2007 3:21 pm


Return to Krypton Navigator

Who is online

Users browsing this forum: No registered users and 2 guests