我目前正在研究 Telerik Silverlight 控件,即 RadTreeListView。是否可以将 DoubleClick 事件绑定到此控件?请注意,我使用的是 MVVM 模式,并且 RadTreeListView 不等于 RadTreeView 控件。如果有人能和我分享他的经验,那就太好了。
我尝试了很多方法,但没有任何效果..
最后一个例子(看命令):
<telerik:RadTreeListView x:Name="TreeListControl"
AutoGenerateColumns="False"
IsReadOnly="True"
ItemsSource="{Binding TreeViewData, ValidatesOnDataErrors=True}"
IsExpandedBinding="{Binding IsExpanded, Mode=TwoWay}"
CanUserFreezeColumns="False"
RowIndicatorVisibility="Collapsed"
ColumnWidth="*"
CanUserSortColumns="False"
evt:MouseDoubleClick.Command="{Binding DoubleCommand}"
>
助手类:
.... public static class MouseDoubleClick
{
public static DependencyProperty CommandProperty =
DependencyProperty.RegisterAttached("Command",
typeof(ICommand),
typeof(MouseDoubleClick),
new PropertyMetadata(CommandChanged));
public static DependencyProperty CommandParameterProperty =
DependencyProperty.RegisterAttached("CommandParameter",
typeof(object),
typeof(MouseDoubleClick),
new PropertyMetadata(null)); ....
编译器给出错误:
Error 3 The property 'Command' does not exist on the type 'RadTreeListView' in the XML namespace 'clr-namespace:CombinationTreeViewControl'. C:\Users\B95703\Documents\Entwicklung\Silverlight\SilverlightComponents\CombinationTreeViewControl\View\CombinationTreeViewControl.xaml 32 34 CombinationTreeViewControl
最好的问候帕特里克