Note that there are some explanatory texts on larger screens.

plurals
  1. POFind TreeViewItem to drop data
    primarykey
    data
    text
    <p>I want to drag data from a ListView and drop it in a TreeView(the draging works fine). I use DataBinding and ItemTemplate to fill the TreeView.</p> <pre><code>&lt;TreeView ItemsSource="{Binding Groups}" Name="tvGroups" AllowDrop="True" Drop="tvDrop" DragOver="tvDragOver"&gt; &lt;TreeView.ItemTemplate&gt; &lt;HierarchicalDataTemplate ItemsSource="{Binding Participants}"&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;TextBlock Text="{Binding Name}" /&gt; &lt;Button Tag="{Binding .}" Click="Button_Click_2"&gt; &lt;Image Source="Resources/cross.png" /&gt; &lt;/Button&gt; &lt;/StackPanel&gt; &lt;HierarchicalDataTemplate.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal" &gt; &lt;TextBlock Text="{Binding Alias}" /&gt; &lt;Button Tag="{Binding .}" Name="btnDeleteParticipants" Click="btnParticipants_Click" &gt; &lt;Image Source="Resources/cross.png" /&gt; &lt;/Button&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/HierarchicalDataTemplate.ItemTemplate&gt; &lt;/HierarchicalDataTemplate&gt; &lt;/TreeView.ItemTemplate&gt; &lt;/TreeView&gt; </code></pre> <hr> <pre><code>private void tvDrop(object sender, DragEventArgs e) { if (e.Effects == DragDropEffects.Copy &amp;&amp; e.Data.GetDataPresent(typeof(Participant))) { Participant data = e.Data.GetData(typeof(Participant)) as Participant; } } </code></pre> <p>A <code>Participant</code> is dragged from the ListView to the TreeView. Now I need to find the <code>Group</code>. Any ideas where to get the right <code>Group</code> from the TreeView?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload