简体   繁体   中英

How to bind Xtended WPF Toolkit Wizard's CurrentPage in MVVM?

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?

CurrentStep 应该是一个 DependencyProperty 或者 ViewModel 应该实现 INotifyPropertyChanged,否则绑定将不起作用。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM