Right click drag and contextmenu #381
Unanswered
mjanulaitis
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@mjanulaitis Normally the ContextMenu will be opened if you release the mouse button. I added a test menu to the first TreeView sample and set the The TreeViewItem style for the test: <Style x:Key="BoundTreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
<MenuItem Header="Test 1" />
</ContextMenu>
</Setter.Value>
</Setter>
</Style> The TreeView: <TreeView x:Name="LeftBoundTreeView"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
dd:DragDrop.UseDefaultDragAdorner="True"
dd:DragDrop.UseDefaultEffectDataTemplate="True"
dd:DragDrop.CanDragWithMouseRightButton="True"
dd:DragDrop.SelectDroppedItems="True"
ItemContainerStyle="{StaticResource BoundTreeViewItemStyle}"
ItemsSource="{Binding Data.TreeCollection1}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<TextBlock Margin="2" Text="{Binding Caption}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to right click and drag within a TreeView which I have done in plenty of .Net Forms apps in the past, however, the context menu keeps trying to display. I just noticed Windows Explorer actually has the same bug. Sometimes it works but many times Explorer fights with the right click drag and the context menus. I have implemented my ContextMenus on each tree node so I can't, to my knowledge, simple disable the context menu on the TreeView. Does anyone have experience trying to get this control to work when right click dragging over items that have ContextMenues?
Beta Was this translation helpful? Give feedback.
All reactions