Reputation: 3205
In my silverlight application application, I'm using a usercontrol made of a information area, and an arrow image below (like a chart element). Here is the XAML:
<UserControl xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
x:Class="ClientGUI.Components.Clusters.ClusterLeftMenuUC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<toolkit:PanelDragDropTarget AllowDrop="True">
<StackPanel Orientation="Vertical" Background="Transparent">
<Border CornerRadius="10" BorderBrush="Black" BorderThickness="2" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="ClusterName" Grid.Row="1" Grid.Column="1"/>
<TextBlock Text="{Binding Type}" Grid.Row="2" Grid.Column="1" />
<TextBlock Text="#Dest" Grid.Row="3" Grid.Column="2" />
</Grid>
</Border>
<Image Source="/ClientGUI;component/Images/arrow.png" Height="40" Margin="0,-2,0,0" Canvas.ZIndex="-1" />
</StackPanel>
</toolkit:PanelDragDropTarget>
The usercontrol contains a dropTarget, because I must be able to drop item from another source (which is not my problem here).
This usercontrol is used in a ListBox in a page. I'd like to be able to sort this list, using drag & drop mechanism.
My ListBox
is also wrapped inside a ListBoxDragDropTarget
.
The problem is that when I start dragging my usercontrol, the Image and the data inside the border act as separate controls, and so only one of them is dragged. I'd like to be able to move both at the same time. What am I doing wrong ?
Thanks in advance !
Upvotes: 1
Views: 568
Reputation: 11
I have a DataGridDragDropTarget with a DataGrid in which I have one text column and one templatecolumn with a checkbox and I can drag an drop a row into a list box.
Maybe you can try with a DataGridDragDropTarget with templatecolumns instead of a listbox. I dont know if it will work.
Upvotes: 1