We help IT Professionals succeed at work.
Get Started

Access user control function from master page

746 Views
Last Modified: 2013-11-12
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
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE