Wpf Caliburn无法很好地使用DevExpress导航控件
有没有人有过Caliburn和DevXpress NavBarControl的经验。我正在尝试将NavBarItems列表绑定到我的视图模型。这不起作用,我相信这是因为Caliburn的绑定 e、 gWpf Caliburn无法很好地使用DevExpress导航控件,wpf,devexpress,caliburn,Wpf,Devexpress,Caliburn,有没有人有过Caliburn和DevXpress NavBarControl的经验。我正在尝试将NavBarItems列表绑定到我的视图模型。这不起作用,我相信这是因为Caliburn的绑定 e、 g 公共类ShellViewModel:PropertyChangeBase { 公共NavBarItemCollection插件{get;set;} 公共NavBarGroup导航BarGroup{get;set;} } 我刚开始看Caliburn Micro。然而,我做了一些关于使用DevExp
公共类ShellViewModel:PropertyChangeBase
{
公共NavBarItemCollection插件{get;set;}
公共NavBarGroup导航BarGroup{get;set;}
}
我刚开始看Caliburn Micro。然而,我做了一些关于使用DevExpress导航栏和MVVM模式的研究。我请开发团队举个例子。他们说在他们的控制中有一个bug阻止它工作。他们确实给出了一个变通的例子。链接如下:
我看了看他们的解决方案,它太复杂了,我无法使用。希望这个补丁很快就可以使用
基思
更新
我没有意识到链接不起作用。以下是解决方案的更详细说明:
<UserControl x:Class="NavBarMVVM.View.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar"
xmlns:ext="clr-namespace:NavBarExtensions;assembly=NavBarExtensions"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity">
<Grid>
<dxn:NavBarControl x:Name="navBar">
<dxn:NavBarControl.View>
<dxn:NavigationPaneView/>
</dxn:NavBarControl.View>
<i:Interaction.Behaviors>
<ext:NavBarMVVMAttachedBehavior ItemsSource="{Binding}">
<ext:NavBarMVVMAttachedBehavior.GroupStyle>
<Style TargetType="ext:NavBarGroupWrapper">
<Setter Property="Header" Value="{Binding Caption}"/>
<Setter Property="ItemsSource" Value="{Binding ItemsViewModel}"/>
</Style>
</ext:NavBarMVVMAttachedBehavior.GroupStyle>
<ext:NavBarMVVMAttachedBehavior.ItemStyle>
<Style TargetType="ext:NavBarItemWrapper">
<Setter Property="Content" Value="{Binding Name}"/>
<Setter Property="ImageSource" Value="{Binding PhotoImageSource}"/>
<Setter Property="Command" Value="{Binding ClickItemCommand}"/>
</Style>
</ext:NavBarMVVMAttachedBehavior.ItemStyle>
</ext:NavBarMVVMAttachedBehavior>
</i:Interaction.Behaviors>
</dxn:NavBarControl>
</Grid>
Keith我不确定我是否看到了虚拟机和视图之间的关系。虚拟机上的属性应该是“PluginPresenter”而不是“Plugins”吗?此外,我们通常认为在VM中拥有控制特定代码是一种坏模式。我不太熟悉NavBarControl,你想要达到的最终结果是什么?我想要一个基于插件的系统(目录中的DLL)。DLL的名称将显示在一个列表中,供用户选择,该名称将用于加载DLL(插件)以及在视图上显示给用户的表单。您链接到的问题的解决方案无法公开查看。您能在此引用内容吗?MVVM导航栏的修复程序现在可从devexpress.com下载。版本11.9
<UserControl x:Class="NavBarMVVM.View.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar"
xmlns:ext="clr-namespace:NavBarExtensions;assembly=NavBarExtensions"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity">
<Grid>
<dxn:NavBarControl x:Name="navBar">
<dxn:NavBarControl.View>
<dxn:NavigationPaneView/>
</dxn:NavBarControl.View>
<i:Interaction.Behaviors>
<ext:NavBarMVVMAttachedBehavior ItemsSource="{Binding}">
<ext:NavBarMVVMAttachedBehavior.GroupStyle>
<Style TargetType="ext:NavBarGroupWrapper">
<Setter Property="Header" Value="{Binding Caption}"/>
<Setter Property="ItemsSource" Value="{Binding ItemsViewModel}"/>
</Style>
</ext:NavBarMVVMAttachedBehavior.GroupStyle>
<ext:NavBarMVVMAttachedBehavior.ItemStyle>
<Style TargetType="ext:NavBarItemWrapper">
<Setter Property="Content" Value="{Binding Name}"/>
<Setter Property="ImageSource" Value="{Binding PhotoImageSource}"/>
<Setter Property="Command" Value="{Binding ClickItemCommand}"/>
</Style>
</ext:NavBarMVVMAttachedBehavior.ItemStyle>
</ext:NavBarMVVMAttachedBehavior>
</i:Interaction.Behaviors>
</dxn:NavBarControl>
</Grid>