A coleague of mine asked me a question about opening modal window from RadMenu. Normally you will open some .xaml that is specified in Tag property. But how to execute some code when clicked on item in menu? To not specify a Tag is the obvious and first, what will come to your mind, but it isn’t the right one, unfortunatelly. :) Going down this path, although the code in onclick eventhandler will be executed, you will be rewarded with nice exception : Value cannot be null. Parameter name : uriString.
But don’t fear, there is hope (and solution :)) and it’s not that hard.
- Don’t specify Tag in XAML parkup,
- Write OnClick eventhandler of the RadMenuItem and execute whatever code you need (instantiate modal window for example),
- Set Handled property of EventArgs in OnClick eventhandler to true.
Setting Handled to true means that further processing of event stops. And that’s exactly what we need. :)
Events in Silverlight are interesting and important thing to understand.
You can find more information about them here :