This is a migrated thread and some comments may be shown as answers.

Question on using MenuItem.Tag to show ChildWindow

1 Answer 28 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ben Hayat
Top achievements
Rank 2
Ben Hayat asked on 27 Feb 2010, 05:03 AM
Hi;
I have a menu system with MenuItems. Each MenuItem.Tag is assigned a name that is identical to a ChildWindow name.
All the MenuItems point to a single method. What I'm trying to do is when a menuitem is clicked, to get it's tag content which a string holding the name of the childwindow. Now that I have this Name, I don't want to have a series of IF statements to instantiate the ChildWindow based on the tag, but rather use that string as my childwindow.

Note, previously I was using pages and MS Navigation Frame and I used the following technique and worked:

        private void RADMenu_Clicked(object sender, RoutedEventArgs e)
        {
            RadMenuItem MenuItem = sender as RadMenuItem;
            string url = MenuItem.Tag.ToString();
            this.ContentFrame.Navigate(new Uri(url, UriKind.Relative));
        }
So, I want to do the same except instead of using URL, it will be ChildWindow name.
Thanks!



1 Answer, 1 is accepted

Sort by
0
Ben Hayat
Top achievements
Rank 2
answered on 27 Feb 2010, 06:25 AM
Got my answer!
Tags
Menu
Asked by
Ben Hayat
Top achievements
Rank 2
Answers by
Ben Hayat
Top achievements
Rank 2
Share this question
or