Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello Everyone

I'm struggling to solve the problem with my nested UserControl.

When I run the application the main window opens, inside the main window is a button, when I click that button it calls up a UserControl (called Applic).

Inside the Applic UserControl is another nested UserControl called PasswordScreen.

Within the PasswordScreen there is a button called Login, when I press this button to call another UserControl (called SwitchboardView) it is not firing nothing (here is the sample code)
C#
private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            Applic ap = new Applic();
            SwitchboardView sbv = new SwitchboardView();
            
            ap.MainGridApplic.Children.Add(sbv);

        }


Could someone please help me solve this problem, I have been struggling for a long time to solve this problem but I just can't get it around.

Thanks in advance...

Kind regards

Roni
Posted
Comments
Sergey Alexandrovich Kryukov 16-Feb-15 17:18pm    
There is not such concept as "call a control"? What do you really want to achieve? What's the problem? A control instance is just a control instance; it does not matter if it is nested or not, but the parent control needs to exposed some of the nested control functionality. Any problems with that? What are you missing?
—SA

1 solution

Hi,

Use the bubbling event.So that the events are handled in the main window.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900