gpt4 book ai didi

c# - 如何在 MVVM 中绑定(bind) Xtended WPF 工具包向导的 CurrentPage?

转载 作者:行者123 更新时间:2023-11-30 17:32:48 30 4
gpt4 key购买 nike

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

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

XAML:

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

View 模型:

public WizardPage CurrentStep { get; set; }

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

为了让 CurrentPage 使用 MVVM 返回事件的向导页面,需要做什么?

最佳答案

CurrentStep 应该是 DependencyProperty 或 ViewModel 应该实现 INotifyPropertyChanged,否则绑定(bind)将不起作用。

关于c# - 如何在 MVVM 中绑定(bind) Xtended WPF 工具包向导的 CurrentPage?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45868379/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com