【发布时间】:2009-11-02 22:06:07
【问题描述】:
我目前有一个带有 Button 和 ContentPresenter 的主视图,它绑定到 ViewModel 的一个属性,该属性是另一个 View(和关联的 ViewModel)。有没有办法从 ContentPresenter 中加载的控件中声明的处理程序路由命令?我这样做的原因是主视图包含工具栏,而内容演示者具有内容。我正在使用 Microsoft MVVM 模板和生成的 DelegateCommand 类。
<Window ...>
<Button x:Name="btnAction" Command="{Binding ActionCommand}" />
<ContentPresenter Content="{Binding CurrentView}" />
</Window>
【问题讨论】:
标签: wpf mvvm routed-commands