繁体   English   中英

如何在 MVVM 中绑定 Xtended WPF Toolkit 向导的 CurrentPage?

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

我已经使用Xceed WPF Toolkit 的 Wizard Control构建了一个包含多个页面的向导,我需要该程序知道当前处于活动状态的页面,以便能够确定必要的步骤。

我正在尝试将CurrentPage绑定到 ViewModel,如下所示:

XAML:

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

视图模型:

public WizardPage CurrentStep { get; set; }

问题是CurrentStep总是返回Null并且向导只显示一个空白页面。

需要做什么才能让CurrentPage使用 MVVM 返回活动向导页面?

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

xml:

<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}"
>

从视图模型:

public WizardPage CurrentWizardPage { get; set; }

HTH,雷

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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