37

Are there any wizard type controls in WPF? I need functionality where I can go forward and back and use tabs to select a particular item which will show the details of the nested items. I can use the TabControl control but the tab items are dynamic so I cannot nest the region inside the tab item.

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
azamsharp
  • 19,710
  • 36
  • 144
  • 222

6 Answers6

36

WPF has a navigation infrastructure built in:

WPF Navigation Overview

Also check out the wizard sample

Pop Catalin
  • 61,751
  • 23
  • 87
  • 115
  • 6
    The .NET samples are no longer shipped as part of the SDK, so you'll need to look for them on the [Code Gallery](http://code.msdn.microsoft.com/). Even then, there doesn't seem to be a direct equivalent for the wizard sample linked above. – Mal Ross Oct 04 '11 at 08:17
  • 4
    [This seems to be](http://code.msdn.microsoft.com/Navigation-over-a-Fixed-89737557) a sample very similar to the wizard one. – anton.burger Mar 02 '12 at 11:30
  • [Github](https://github.com/microsoft/wpf-samples/tree/main/Windows/Wizard) has the wizard sample that @anton.burger mentioned. Otherwise you have to do a search for "Wizard" before finding the sample nowadays. – Brick Jun 21 '23 at 15:28
12

Another simple way I have used for a basic Wizard is to use multiple Grids and change the Visibility properties when the buttons are clicked, using an int to keep track of the 'step number'

    <Grid Name="Page1">
        <TextBlock>Page 1</TextBlock>
    </Grid>

    <Grid Name="Page2" Visibility="Hidden">
        <TextBlock>Page 2</TextBlock>
    </Grid>
MattP
  • 2,798
  • 2
  • 31
  • 42
  • Can you explain the int step number in detail please? – alice7 May 05 '11 at 23:29
  • I just used an int to track the page number, so start at 1, when you click next change it to 2. Then use the int to control whether a button says Next or Finish, or to allow a Back operation or disabled. Fairly crude but if you just need to do something simple and effective it works – MattP May 10 '11 at 16:17
  • I didn't need a full blown solution and thought this approach could be cumbersome, but your example showed how easy it could be. – frostymarvelous Apr 18 '16 at 14:30
9

Check This link. you can create wonderful wizard using extended wpf toolkit.

Wizard

yivi
  • 42,438
  • 18
  • 116
  • 138
Rashad Valliyengal
  • 3,132
  • 1
  • 25
  • 39
  • 2
    "Extended WPF Toolkit™ is provided under the Xceed Software, Inc. Community License." This cannot be used commercially (for free). Just keep this in mind if you are using this solution. – Chris Gonzales Dec 11 '19 at 15:41
8

You may try open source Avalon Wizard.

yivi
  • 42,438
  • 18
  • 116
  • 138
Pavel
  • 910
  • 5
  • 6
3

Found this great example on codeproject that should give you everything that you need:

http://www.codeproject.com/Articles/31837/Creating-an-Internationalized-Wizard-in-WPF

evoneutron
  • 31
  • 1
  • 4
    Would you mind adding a very high level overview of the article? (Maybe just a sentence or two.) I know a lot of people are in the habit of just pasting a link as their answer, but even if you just list some the main classes names involved, that will give the reader something to search for in case this link goes dead some point in the future. – matt forsythe Apr 19 '13 at 16:58
  • 2
    That CodeProject article was deleted on 22 Jan 2021. – Jinlye Mar 31 '21 at 14:00
3

MVVM Wizard - Usage like this (Requires DI container, views are created on first navigation)

<controls:Wizard>
    <controls:WizardStep ViewType="{x:Type test:View1}"  />
    <controls:WizardStep ViewType="{x:Type test:View2}" />
    <controls:WizardStep ViewType="{x:Type test:View3}" />
</controls:Wizard>

or like this (no DI is required, but creates all views straight away)

<controls:Wizard>

    <controls:WizardStep>
        <test:View1 />
    </controls:WizardStep>

    <controls:WizardStep>
        <test:View2 />
    </controls:WizardStep>

    <controls:WizardStep>
        <test:View3 />
    </controls:WizardStep>

</controls:Wizard>
lezhkin11
  • 415
  • 3
  • 6