Windows Vista Forums

Basic design question for designing multi-screen guis

  1. #1 Guest

    Basic design question for designing multi-screen guis

    I'm working on a simple game in WPF. Here is my problem: I want to
    have a login where the user goes through a series of screens to login.
    In Java, I've implemented this kind of thing by defining a panel to
    hold the login screens. Then when the user advances to the next
    screen, the currently displayed panel is removed from the parent panel
    and the new panel is added.

    I'm confused about how to replicate this behavior in WPF while taking
    advantage of XAML. If I were to make my WPF completely code based with
    no xaml, I could use the same technique that I used in Java (each
    screen would be a class that extends a panel such as StackPanel). But
    as far as I can tell, if I make a XAML/Code class in WPF, it has to be
    either a window or a page. I can't make a XAML file with <StackPanel>
    or some other panel as the root element.

    I've read a bit about the Frame element but I'm not sure if this is
    the right approach to take (hosting each login screen inside the frame
    and advancing to the next "page").

    Any ideas? I'm clearly just missing some key idea on how WPF works.
    I've been thinking about this problem and reading documentation for
    countless hours and so any help you could provie would be greatly
    appreciated. Thanks!

      My System SpecsSystem Spec

  2. #2

    Plamen Ratchev Guest

    Re: Basic design question for designing multi-screen guis

    One way to implement what you need would be to use a Frame and then load
    XAML defined pages (just set the source for the Frame to the next page). The
    Frame will be just one of the elements in your window, you can have
    StackPanel and other content there too (and you can use Grid, StackPanel,
    etc. to arrange the Frame position).

    Another way is to use a NavigationWindow for container and add Pages. Then
    you can use the NavigationService to move between page. This can provide you
    a little bit extra power as the NavigationService works similar to your
    browser. It can go back and forward between pages (with GoBack or GoForward,
    or directly Navigate).


    Plamen Ratchev

      My System SpecsSystem Spec

Basic design question for designing multi-screen guis
Similar Threads
Thread Forum design question on version updates .NET General
OO design question .NET General
Question on design involving some Generics .NET General
RTF Question: Is this a bug or by design? Vista General
Schema Design Question WinFS