Q:

How to add function to CheckBox in a UserControl

I have a usercontrol which is a dropdown displaying checkboxes. There is a checkbox click event that calls the SetText function, which sets the text based on what has been selected (which I want to keep). I would also like to add a  function to the usercontrol maybe thru a command which sets a custom function. For example, when they select a checkbox I can call the function set in the viewmodel, as well as keep the SetText function. 
I tried adding a Command to the checkbox. As well as a dependency property to the usecontrol for the Command. In addition a simple function to use in the viewmodel
-UserControl.xaml
 <ComboBox
    x:Name="CheckableCombo"
    SnapsToDevicePixels="True"
    OverridesDefaultStyle="True"
    ScrollViewer.HorizontalScrollBarVisibility="Auto"
    ScrollViewer.VerticalScrollBarVisibility="Auto"
    ScrollViewer.CanContentScroll="True"
    IsSynchronizedWithCurrentItem="True"
    MinWidth="120"
    MinHeight="20"
    ItemsSource="{Binding ElementName=UserControl, Path=ItemsSource}"
    DataContext="{Binding ElementName=UserControl, Path=DataContext}"
    >
    <ComboBox.ItemTemplate>
        <HierarchicalDataTemplate>
            <CheckBox Content="{Binding Title}"
                      IsChecked="{Binding Path=IsSelected, Mode=TwoWay}"
                      Tag="{RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}"
                      Click="CheckBox_Click"
                      Command="{Binding YourCommand}"

              />
   <i:Interaction.Triggers>
       <i:EventTrigger EventName="SelectionChanged">
         <i:InvokeCommandAction Command="{Binding YourCommand}" />
      </i:EventTrigger>
     </i:Interaction.Triggers>

-UserControl.xaml.cs
    public ICommand YourCommand
    {
        get { return (ICommand)GetValue(YourCommandProperty); }
        set { SetValue(YourCommandProperty, value); }
    }

    // Using a DependencyProperty as the backing store for YourCommand.  This enables animation, styling, binding, etc...
    //public static readonly DependencyProperty YourCommandProperty =
    //    DependencyProperty.Register("YourCommand", typeof(ICommand), typeof(ComboWithCheckboxes), new PropertyMetadata(0));
    public static readonly DependencyProperty YourCommandProperty =
        DependencyProperty.Register("YourCommand", typeof(ICommand), typeof(ComboWithCheckboxes));

    #endregion

    public ComboWithCheckboxes()
    {
        InitializeComponent();
    }

    /// <summary>
    ///Whenever a CheckBox is checked, change the text displayed
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void CheckBox_Click(object sender, RoutedEventArgs e)
    {
        SetText();
    }

    /// <summary>
    ///Set the text property of this control (bound to the ContentPresenter of the ComboBox)
    /// </summary>
    private void SetText()
    {
        this.Text = (this.ItemsSource != null) ?
            this.ItemsSource.ToString() : this.DefaultText;
        // set DefaultText if nothing else selected
        if (string.IsNullOrEmpty(this.Text))
        {
            this.Text = this.DefaultText;
        }
    }

}

-ViewModel.cs
  public ViewModel()
    {
        ViewModelCommand = new DelegateCommand(MethodTest, canExecuteTest);

        itemSource = new ObservableNodeList();
        Node a = new Node("English");
        a.IsSelected = true;
        itemSource.Add(a);

        Node b = new Node("Hebrew");
        b.IsSelected = false;
        itemSource.Add(b);

        Node c = new Node("Swedish");
        c.IsSelected = false;
        itemSource.Add(c);

        Node d = new Node("German");
        d.IsSelected = false;
        itemSource.Add(d);
    }

    private bool canExecuteTest(object obj)
    {
        return true;
    }

    private void MethodTest(object obj)
    {
        System.Windows.MessageBox.Show("Test Method");
    }

My expected result was to be able to hit the command function when either select or deselecteding the checkboxes

A:

I simplify your user control to be more readable and focus only on working external-command. I Modify the Binding of Command. In the list you got local data-context of item, but it is needed to bind command to external-data-context. 
 <ComboBox ItemsSource="{Binding ElementName=UserControl, Path=ItemsSource}">
      <ComboBox.ItemTemplate>
          <HierarchicalDataTemplate>
               <CheckBox Content="{Binding .}"
                   Click="CheckBox_Click"
                   Command="{Binding ElementName=UserControl,Path=YourCommand}"> 
                </CheckBox>
          </HierarchicalDataTemplate>
       </ComboBox.ItemTemplate>
 </ComboBox>

In the UserControl1.cs I got:
public ICommand YourCommand
{
    get { return (ICommand)GetValue(YourCommandProperty); }
    set { SetValue(YourCommandProperty, value); }
}

// Using a DependencyProperty as the backing store for YourCommand.  This enables animation, styling, binding, etc...
public static readonly DependencyProperty YourCommandProperty =
            DependencyProperty.Register("YourCommand", typeof(ICommand), typeof(UserControl1), new PropertyMetadata(null));

I tested and it works for me. 

