views:

8

answers:

0

The pre-release wpf ribbon control uses commands as resources, and the commands aren't dps so you can't bind directly to them. With an attached property and subclass of the RibbonCommand, as described here, I wound up with a pattern similar to this:

// as resources

<ab:CommandReference x:Key="AddCommandRef" Command="{Binding AddCommand}"/>
<rCmd:RibbonCommandEx x:Key="AddCommand" DelegatedCommand="{StaticResource AddCommandRef}" .. 
            />

// sample usage in the ribbon

<r:RibbonButton Command="{StaticResource AddCommand}" />

Some of the commands are re-useable with a different ribbon based presentation, plus the xaml for the ribbon quickly gets pretty bloated. So I'd like to move the resources to a separate ResourceDictionary. To do that tho I would need to pass in some sort of DataContext for them to bind to. Does this maker sense? Can you pass dc into a ResourceDictionary?

Cheers,
Berryl