5

I've built a wizard of several pages using Xceed WPF Toolkit's Wizard Control, and I need the program to know what page is currently active, in order to be able to determine the necessary steps.

I'm trying to bind CurrentPage to the ViewModel, as follows:

XAML:

<xctk:Wizard CurrentPage="{Binding CurrentStep, Mode=TwoWay}">
    <xctk:WizardPage Name="Import">
       ...
    </xctk:WizardPage>
       ...
</xctk:Wizard>

ViewModel:

public WizardPage CurrentStep { get; set; }

The problem is that CurrentStep always returns Null and the wizard just shows a blank page.

What needs to be done in order to have CurrentPage return the active wizard page using MVVM?

Community
  • 1
  • 1
Sam White
  • 138
  • 3
  • 16

2 Answers2

2

CurrentStep should be a DependencyProperty or ViewModel should implement INotifyPropertyChanged, otherwise binding will not work.

Valerii
  • 2,147
  • 2
  • 13
  • 27
1

xaml:

<xctk:Wizard    x:Name="wizMain"
                Grid.Row="1"
                FinishButtonClosesWindow="True" 
                ItemsSource="{Binding wizardPages}" 
                Background="White"
                ExteriorPanelMinWidth="100"
                HelpButtonVisibility="Hidden"
                CanSelectNextPage="{Binding CanProceed, UpdateSourceTrigger=PropertyChanged}"
                CurrentPage="{Binding Path=CurrentWizardPage, Mode=TwoWay}"
>

from the ViewModel:

public WizardPage CurrentWizardPage { get; set; }

HTH, Ray

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Ray Hastie
  • 77
  • 6