2011-05-24 63 views
1

我無法在ViewModel中的RadTreeViewItem上觸發單擊事件或鼠標放下事件。我應該使用什麼語法?以下是相關的XAML:RadTreeViewItem,MVVM和Click事件

  <Toolkit:AccordionItem x:Name="Accordion1" Header="{Binding Header, Mode=TwoWay}" Width="200"> 
      <ListBox x:Name="SitesList" Width="195" BorderThickness="0" ItemsSource="{Binding Games, Mode=OneWay}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}"> 

       <ListBox.ItemTemplate> 
        <DataTemplate> 
         <telerik:RadTreeView IsDragDropEnabled="True" IsSingleExpandPath="True" 
              telerikDragDrop:RadDragAndDropManager.AllowDrag="True" PreviewDragEnded="RadTreeView_PreviewDragEnded" 
              IsDragTooltipEnabled="False"> 
          <telerik:RadTreeViewItem Header="{Binding siteName, Mode=TwoWay}" Tag="{Binding siteKey, Mode=TwoWay}"> 
           <i:Interaction.Triggers> 
            <i:EventTrigger EventName="Click"> 
             <cmd:EventToCommand Command="{Binding RadTreeItemClickCommand, Mode=TwoWay}" MustToggleIsEnabledValue="True"/> 
            </i:EventTrigger> 
           </i:Interaction.Triggers> 
          </telerik:RadTreeViewItem> 
         </telerik:RadTreeView> 
        </DataTemplate> 

       </ListBox.ItemTemplate> 

      </ListBox> 
     </Toolkit:AccordionItem> 

回答

-1

不要打擾事件發出命令。您可以直接在RadTreeViewItem上設置命令。