Reputation: 117
We are using Microsoft ribbon control library for .Net 4.0.
I was trying to bind RibbonGroup.GroupSizeDefinitions to a property of the ViewModel. If we declare the binding in Xaml as follows it is working fine.
<ribbon:RibbonGroup Header="Group1" GroupSizeDefinitions="{Binding GroupDefinitions}" />
However if I set this using a Style this is not working.
<Style TargetType="{x:Type ribbon:RibbonGroup}" BasedOn="{StaticResource {x:Type ribbon:RibbonGroup}}">
<Setter Property="GroupSizeDefinitions" Value="{Binding GroupDefinitions}" />
</Style>
How can I bind this to the View Model ?
Thanks.
Upvotes: 0
Views: 223
Reputation: 117
Finally I was able to make it work.
I added an attached property and binded to the collection in the view model. Then on attached property change call back, a new RibbonGroupSizeDefinitionBaseCollection is created and added items of the collection. Then assigned the new RibbonGroupSizeDefinitionBaseCollection to RibbonGroup.GroupSizeDefinitions property.
Upvotes: 1