Averything about refactoring the CoolMenu read here in thre-part series by Page Brooks:
- Refactoring the CoolMenu Control – Part 1: Inheriting from ItemsControl
- Refactoring the CoolMenu Control – Part 2: Building the ItemContainerGenerator
- Refactoring the CoolMenu Control – Part 3: CoolMenu Behaviors
In fact it is not so difficult build simple CoolMenu. You have to just define images you want to use for the menu.

Then you can enjoy the result:
That is marvelous, isn't it?
Work with items
So, let go to get a life to our menu. Our issue for this moment is: when somebody click the icon, the name of the item will be shown in upper part of page.
First thing we have to do is change structure of our menu. In case we want to work with the items we have to define CoolMenuItems more complexly.

Then we use event MunuItemClicked to show which item was clicked.

Now we can check out the result:
DataBinding
The last thing I would like to show you is how to use DataBinding for items in menu. First thing we have to do is make a class for items.

Then we have to template out item.

And finally we have to make a list of items and set ItemsSource for our menu.

That is it. Have a fun with Silverlight Contrib CoolMenu.




0 comments:
Post a Comment