TextBox や Image などのコントロールをドラッグ アンド ドロップする必要があります。
私はこれを行うための解決策を得ました、
インタラクションとマウス要素の動作を使用したドラッグ アンド ドロップのコード
<TextBox Height="30" Margin="70,50,250,133"
Name="textBlock1" Text="Pavan Pareta" MouseMove="MouseMoving">
<i:Interaction.Behaviors>
<el:MouseDragElementBehavior ConstrainToParentBounds="True"/>
</i:Interaction.Behaviors>
</TextBox>
<Image Height="110" Name="image1" Stretch="Fill" Source="/WmDev_DragAndDrop;component/Images/house.png" Margin="254,90,95,407" MouseMove="MouseMoving">
<i:Interaction.Behaviors>
<el:MouseDragElementBehavior ConstrainToParentBounds="True"/>
</i:Interaction.Behaviors>
</Image>
MouseMoving イベントは
private void MouseMoving(object sender, MouseEventArgs e)
{
if (sender.GetType() == typeof(TextBox))
{
TextBox realSender = (TextBox)sender;
Canvas.SetZIndex(realSender, idx++);
}
else if (sender.GetType() == typeof(Image))
{
Image realSender = (Image)sender;
Canvas.SetZIndex(realSender, idx++);
}
}
しかし、動的に作成されたコントロールにこれを実装する必要があります。実用的に作成されたランタイム コントロールでこれを行う方法が見つかりません。誰でも私がそうするのを手伝ってくれますか。
ありがとうございました。