Search code examples
c#wpfvisual-studio-2010navigationpixelsense

Navigation between WindowSurface


I have created two WindowSurface (WPF), and I want to navigate betwen them.

I've created a simple button with the following code :

SurfaceWindow2 sw2 = new SurfaceWindow2();
sw2.Show();

This on displays the second SurfaceWindows but in a new Window.

What I want to do is : Host for example many SurfaceWindow in a root one, so I can show or hide them easily.

Any help ?


Solution

  • How about just creating a single WindowSurface control and put two overlapping grids on it. Populate the two grids with what you wanted to show on your two separate WindowSurfaces and then only show one of the grids at a time. This should give you the same functionality you're looking for.

    <WindowSurface>
       <Grid> <!--So you can hold 2 grids on the same window-->
          <Grid x:Name="_grid1" Visibility="Visible"> 
              <!-- The stuff you want on window surface 1 here --> 
          </Grid>
          <Grid x:Name="_grid2" Visibility="Hidden"> 
              <!-- The stuff you want on window surface 2 here --> 
          </Grid>
       </Grid>
    </WindowSurface>