This project is read-only.


May 9, 2014 at 8:36 PM
I would like to bind my drag template to the items being dragged and am running into a couple issues.

First, in the DragNDropSample project I attempted to use the following:
<DataTemplate x:Key="dragTemplate" DataType="dragNDrop:DragContent">
                <Border BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Background="WhiteSmoke">
                        <TranslateTransform X="20" Y="20"/>
                    <ContentPresenter x:Name="content">
                                <StackPanel Orientation="Vertical">
                                    <ContentControl Content="{StaticResource forbiddenIcon}" Width="16" Height="16" VerticalContentAlignment="Center" Margin="4,1,0,2"/>
                                    <TextBlock Text="Drop is not allowed here." Margin="-2,2,0,2"/>
                                    <ListBox ItemsSource="{Binding Items}">
                                                <TextBlock Text="{Binding Path=Name}" FontWeight="Bold"/>
                </Border> ...
That works to show the names of what is being dragged if they originate in the treeview (They show up as Nodes in the draggable items), but not for the TextBlock content (Drop Me In Tree!) being dragged (which shows as type System.Windows.DataObject).

Also, if I drag the content in my application and drag off of the tree, the view (of what I'm dragging) changes to just be "System.Windows.DataObject", which I'm sure is just the ToString being called on the content of the draggable items. Any suggestions for how to get this to work would be appreciated.