1
을 위해 :ItemContainerStyle 나는 RibbonGroup 다음과 같은 XAML 내 뷰 모델에 RibbonButtons 몇 결합하기 위해 노력하고있어 RibbonGroup
<Style TargetType="{x:Type ribbon:RibbonGroup}" x:Key="RibbonGroupStyle">
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="ItemContainerStyle" Value="{DynamicResource RibbonButtonStyle}" />
<Setter Property="ItemsSource" Value="{Binding Buttons}" />
</Style>
<Style TargetType="{x:Type ribbon:RibbonButton}" x:Key="RibbonButtonStyle">
<Setter Property="Label" Value="{Binding Header}" />
</Style>
이 나에게 내가 이해할 수있는 다음과 같은 오류를 제공합니다,하지만 어떻게 내가 할 RibbonButton의 Label을 내 viewmodel에 제대로 바인딩 하시겠습니까?
A style intended for type 'RibbonButton' cannot be applied to type 'RibbonControl'.
이 좋아,하지만 가장 좋은 방법은 모든 버튼에 적용하는 것? – Chrille
스타일 키를 지정하지 않으면이 유형의 모든 컨트롤에 적용해야합니다. – icebat
그래서 문제는 리본 버튼 뷰 모델 객체 목록을 내 RibbonGroup의 ItemsSource에 바인딩 할 때 RibbonControl이 아닌 RibbonButtons로 생성된다는 것입니다. 어떻게 제어합니까? 제 바인딩에있어 근본적인 것이 빠져 있다고 생각합니다. – Chrille