title: MVVM binding double click to method using telerik radtreecontrol
body: <p>I've been working on this problem for a stupid amount of time. It is time to ask for directions despite my inner man saying "don't do it."</p>
  
  <p>I am coding in WPF C# using MVVM design pattern. We try to adhere strictly to the pattern and put nothing in the code behind unless there is no option or it is completely unreasonable to do so. Having said that, I am working with a Telerik RadTreeView. Here is a snippet of it in my XAML:</p>
  
  <pre><code>&lt;telerik:RadTreeView IsExpandOnSingleClickEnabled="True" IsLineEnabled="True" Margin="5" 
                                   ItemsSource="{Binding ItemsView}"
                                   SelectedItem="{Binding SelectedWidget, Mode=TwoWay}"
                                   ItemTemplate="{StaticResource NodeTemplate}" /&gt;
  </code></pre>
  
  <p>Currently the tree is working properly so that if you highlight a tree item and click the OK button on the view, all is good. However, I need to also allow the user to double click on one of the tree items. This means I already have a command and method, <em>protected override void OkAction()</em>, in my view model with the needed logic. Telerik supplies a property called <em>ItemDoubleClick</em> that is supposed to supply functionality for the tree item double click. But I can't find anything to allow me to do this in the view model. In other words, how do I do the binding? We also have a behavior setup in our project for double clicking that I was told I could use, but I have no experience with behaviors. I'm still a little wet with WPF.</p>
  
  <p>If it helps, here is a link to the documentation for Telerik: <a href="http://www.telerik.com/help/wpf/radtreeview-events-overview.html" rel="noreferrer">http://www.telerik.com/help/wpf/radtreeview-events-overview.html</a></p>
  
  <p>I would appreciate any help or direction anyone can provide.</p>
  
  <p>Try this out Stan:</p>
  
  <pre><code>&lt;Grid.Resources&gt;
              &lt;DataTemplate x:Key="WidgetTemplate"&gt;
                  &lt;StackPanel Orientation="Horizontal"&gt;
                      &lt;Image Source="/Resources/gear1.png" Margin="1" Stretch="None" /&gt;
                      &lt;TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="6,0,0,0" /&gt;
                  &lt;/StackPanel&gt;
              &lt;/DataTemplate&gt;
  
              &lt;HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource = "{Binding Children}" ItemTemplate="{StaticResource WidgetTemplate}"&gt;
                  &lt;TextBlock Text="{Binding Name}"/&gt;
              &lt;/HierarchicalDataTemplate&gt;
  
          &lt;/Grid.Resources&gt;
  </code></pre>