私は自分のプロジェクト内でこの ObservableCollection-Class を使用しています: Link
I want to Bind a RibbonMenuButton to a ObservableDictionary<string,bool>
:
<r:RibbonMenuButton ItemsSource="{Binding MyDictionary}">
<r:RibbonMenuButton.ItemContainerStyle>
<Style TargetType="{x:Type r:RibbonMenuItem}">
<Setter Property="IsCheckable" Value="true"/>
<Setter Property="Header" Value="{Binding Path=Key}"/>
<Setter Property="IsChecked" Value="{Binding Path=Value}"/>
</style>
</r:RibbonMenuButton.ItemContainerStyle>
</r:RibbonMenuButton>
しかし、内部 IDictionary-KeyValuePairs の Value-Properties が読み取り専用であるため、例外が発生します。これを解決する方法はありますか?
私は次のようなことを考えました:
<Setter Property="IsChecked" Value="{Binding Source=MyDictionary[{Binding Path=Key}]}"/>
しかし、これは {Binding} の {Binding} が原因で機能しません...