Question on using MenuItem.Tag to show ChildWindow

2 posts, 0 answers
  1. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 26 Feb 2010 Link to this post

    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!



  2. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 27 Feb 2010 Link to this post

    Got my answer!
  3. DevCraft banner
Back to Top