views:

21

answers:

0

Hi All,

I've a ResourceDictionary. In which I've defined all the commands.

<ResourceDictionary x:Class="HTCmds" 
                    x:ClassModifier="public"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:commands="clr-namespace:Commands;assembly=UIInfrastructure"
                    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
                    xmlns:local="clr-namespace:Commands"
                    xmlns:p="clr-namespace:PresentationModels">
            <commands:CommandReference x:Key="CopyCommandReference" Command="{Binding Path=CopyCommand}"/>
    <commands:CommandReference x:Key="ExitCommandReference" Command="{Binding Path=ExitCommand}"/>
</ResourceDictionary>

I've merged this ResourceDictionary in a Windows class.

<ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Commands/HTCmds.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

This window class has DataContext property set to Commands.cs class that contains all the commands and their handlers. Now, How do I bind the commands defined in ResourceDictionary with commands in DataContext of Windows class?

Thanks & Regards, Vishal.