We help IT Professionals succeed at work.

Access user control function from master page

Using silverlight 4, but still using a page switcher as the holder for the largest user control.  On the main page is Master.xaml.  Master holds a menu control, the main control which populates the switcher, and a footer user control.

My problem is how do I can't figure out how to use the selected item on the toolbar to call the functions on the current user control in the page switcher.

 

In XAML on the master pager, my page switcher is defined as:
 <Liquid:MainMenu x:Name="mainMenu" ItemSelected="mainMenu_ItemSelected" BorderBrush="{StaticResource boarder_10}" BorderThickness="1" Background="{StaticResource btnTextColor_10}" Canvas.Top="-37">

 <local:PageSwitcher x:Name="PageSW" Height="801" Width="1203" />

Open in new window


 

In the code behind we switch the page using:

 PageSwitcher ps;

ps.Navigate(new ProjectsPage());

 

Open in new window


Now I have the projects page loaded when I attempt Save a project I call:


   
    private void mainMenu_ItemSelected(object sender, Liquid.MenuEventArgs e)
        {
            switch (e.Tag.ToString())
            {
                case "Save":
                    saveRoutine();
                    break;

Open in new window

Now in my Save Routine I want to call the SaveProject function on the ProjectsPage:

        void saveRoutine()
        {
            MessageBox.Show("Save button was pressed!");
            switch (CurrentPage)
            {
                case "Project":
                    
                    break;

Open in new window



 

This is where I'm lost, can't figure how to call into PageSW which is currently a ProjectsPage, but may be one of the other pages.

 

-Lester
Comment
Watch Question