[英]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.我已经使用Xceed WPF Toolkit 的 Wizard Control构建了一个包含多个页面的向导,我需要该程序知道当前处于活动状态的页面,以便能够确定必要的步骤。
I'm trying to bind CurrentPage
to the ViewModel, as follows:我正在尝试将
CurrentPage
绑定到 ViewModel,如下所示:
XAML: 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.问题是
CurrentStep
总是返回Null
并且向导只显示一个空白页面。
What needs to be done in order to have CurrentPage
return the active wizard page using MVVM?需要做什么才能让
CurrentPage
使用 MVVM 返回活动向导页面?
CurrentStep 应该是一个 DependencyProperty 或者 ViewModel 应该实现 INotifyPropertyChanged,否则绑定将不起作用。
xaml: 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}"
>
from the ViewModel:从视图模型:
public WizardPage CurrentWizardPage { get; set; }
HTH, Ray HTH,雷
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.