【发布时间】:2013-08-02 10:56:46
【问题描述】:
我目前正在开发 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
最好的问候 帕特里克
【问题讨论】:
标签: silverlight xaml telerik