I am working on this issue for a dumb amount of time. It is time to ask for directions, even though my inner man said, "Don't do this."
I am coding in WPF C # using the MVVM design pattern. We try to strictly adhere to the template and do not put anything in the code if there is no choice, or it is completely unreasonable. Having said that, I work with Telerik RadTreeView. Here is a snippet of it in my XAML:
<telerik:RadTreeView IsExpandOnSingleClickEnabled="True" IsLineEnabled="True" Margin="5" ItemsSource="{Binding ItemsView}" SelectedItem="{Binding SelectedWidget, Mode=TwoWay}" ItemTemplate="{StaticResource NodeTemplate}" />
Currently, the tree is working correctly, so if you select a tree element and click OK on the view, everything will be fine. However, I also need to allow the user to double-click on one of the tree items. This means that I already have a command and a protected method that overrides void OkAction () in my view model with the necessary logic. Telerik provides the ItemDoubleClick property, which should provide the double-click functionality of the tree structure. But I canβt find anything that would allow me to do this in the view model. In other words, how do I bind? We also have a behavior setup in our project for double-clicking, which I was told that I can use, but I have no experience in behavior. I'm still a little wet with WPF.
If this helps, here is the link to the documentation for Telerik: http://www.telerik.com/help/wpf/radtreeview-events-overview.html
I would be grateful for any help or guidance that anyone can provide.
Try this: Stan:
<Grid.Resources> <DataTemplate x:Key="WidgetTemplate"> <StackPanel Orientation="Horizontal"> <Image Source="/Resources/gear1.png" Margin="1" Stretch="None" /> <TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="6,0,0,0" /> </StackPanel> </DataTemplate> <HierarchicalDataTemplate x:Key="NodeTemplate" ItemsSource = "{Binding Children}" ItemTemplate="{StaticResource WidgetTemplate}"> <TextBlock Text="{Binding Name}"/> </HierarchicalDataTemplate> </Grid.Resources>
source share