Click here to Skip to main content
15,564,429 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to open new View from the XAML.cs,
I try this code:


But I have Error : <the Show doesn't exist ..

What I have tried:

private void canMain_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
            {
                RoleManagmentview openwindow=new RoleManagmentview ();

                 openwindow.Show();
            }
        }
Posted
Updated 11-Jul-17 7:22am
Comments
Richard Deeming 11-Jul-17 12:06pm    
What's the base class for RoleManagmentview?
ThabetMicrosoft 11-Jul-17 12:08pm    
The base class for RoleManagmentview is an UserControl .
and the RoleManagmentview is Window

Richard Deeming 11-Jul-17 12:11pm    
Sorry, that doesn't make any sense. It can't inherit from both UserControl and Window; they're two completely separate classes.
ThabetMicrosoft 11-Jul-17 12:13pm    
ok I understand ,
I modify the two Views to Window, so what can I do?
Richard Deeming 11-Jul-17 12:15pm    
If the RoleManagmentView class inherits from Window, then it will have a Show method:
Window.​Show Method | Microsoft Docs[^]

1 solution

As discussed in the comments, changing RoleManagmentView from a UserControl to a Window resolved the problem.
 
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