2011-02-23 2 views
1

Caliburn 및 DevExpress NavBarControl에 대한 경험이있는 사람이 있습니까? NavBarItems 목록을 내 View Model에 바인딩하려고합니다. 이것은 작동하지 않으며 Caliburn의 구속력 때문이라고 확신합니다.Caliburn은 DevExpress NavBarControl과 잘 작동하지 않습니다.

<dxnb:NavBarControl x:Name="NavigationBar"> 
    <dxnb:NavBarControl.Groups> 
     <dxnb:NavBarGroup x:Name="NavigationBarGroup" Content="{Binding PluginPresenter}" ImageSource="/Images/Icons/Group.png"> 
     </dxnb:NavBarGroup> 
    </dxnb:NavBarControl.Groups> 
    <dxnb:NavBarControl.View> 
     <dxnb:NavigationPaneView IsExpandButtonVisible="False"/> 
    </dxnb:NavBarControl.View> 
</dxnb:NavBarControl> 

public class ShellViewModel : PropertyChangeBase 
{ 
    public NavBarItemCollection Plugins { get; set; } 
    public NavBarGroup NavigationBarGroup { get; set; } 
} 
+0

VM과 사용자의 뷰가 어떻게 다른지 잘 모르겠습니다. vm의 속성이 '플러그인'대신 'PluginPresenter'가되어야합니까? 또한 일반적으로 VM에 제어 관련 코드를 포함하는 나쁜 패턴으로 간주합니다. NavBarControl에 익숙하지 않은데, 최종 결과는 무엇입니까? –

+0

플러그인 기반 시스템 (디렉토리의 DLL)이 필요합니다. DLL의 이름은 사용자가 선택할 수있는 목록에 표시되며 이름은 DLL (플러그인)을로드하는 데 사용되며보기에서 사용자에게 표시되는 양식 –

답변

0

방금 ​​Caliburn Micro를 살펴 보았습니다. 그러나 DevExpress Navigation Bar를 MVVM 패턴과 함께 사용하는 방법에 대한 연구를 수행했습니다. 나는 개발 팀에게 예를 물었다. 그들은 통제 할 수없는 버그로 인해 작동하지 못한다고 말했습니다. 그들은 일에 대한 모범을 보였습니다. 링크는 다음 위치에 있습니다. http://www.devexpress.com/Support/Center/p/Q347737.aspx

나는 해결책을 찾았고 사용하기에는 너무 복잡했습니다. 다행히도 패치가 곧 제공 될 것입니다.

키스

내가 링크가 작동하지 않았다 몰랐어요 UPDATE.

  1. 제어 탐색 모음에 대해 생성 된 사용자 : 두 가지 목표 유형이 두 클래스라고

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

* 다음은 솔루션에 대한 자세한 설명은 싸개. 바인딩은 다음과 같습니다. BindingOperations.SetBinding (NavBarGroup, NavBarGroup.ContentProperty, new Binding ("Content") {Source = this});

이 참조는 NavBarGroup이라는 클래스입니다. 네 개의 도우미 그룹이 있습니다. NavBarGroup, NavBarItems, NavBarGroups (NavBarGroup 목록) 및 NavBarItems (NavBarItem LIst) 이러한 클래스는 정적 멤버로 데이터를 보유하는 다른 4 개의 동일한 클래스로 채워집니다. 저를위한 거래 차단기 인 마지막 수업들입니다. 그것은 지나치게 복잡하게 선을 넘는 것처럼 보입니다. 도움이 되길 바랍니다. Keith

+0

링크 된 문제의 해결 방법은 다음과 같습니다. 공개적으로 볼 수는 없습니다. 여기에 내용을 인용 할 수 있습니까? – Alain

+1

MVVM Navigation Bar에 대한 수정은 이제 devexpress.com에서 다운로드 할 수 있습니다. 버전 11.9 – KeithMacCrimmon

관련 문제