2013-07-27 147 views
0

我正在爲Windows Phone 8製作單人紙牌遊戲,我想拖放圖像。到目前爲止,我可以拖動和移動圖像角落找尋使用此功能,但有時圖像的背後是一些項目簡單的拖放在Windows Phone 8中

private void MouseMoving(object sender, MouseEventArgs e) 
    { 
      Image realSender = (Image)sender; 
      Canvas.SetZIndex(realSender, -2147483645); 
    } 

任何想法如何解決此問題,並如何在畫布上滴的形象呢?

回答

0

您是否嘗試過Microsoft.Expression.Interactions程序集中的MouseDragElementBehavior。它允許你拖動一個對象,你可以將它限制在它的父級內部,這可能是一個畫布。

的XAML看起來是這樣的:

<Image Height="110" Name="image1" Stretch="Fill" Source="/Assets/Tiles/IconicTileMediumLarge.png" Margin="254,90,95,407" MouseMove="MouseMoving"> 
      <i:Interaction.Behaviors> 
       <el:MouseDragElementBehavior ConstrainToParentBounds="True"/> 
      </i:Interaction.Behaviors> 
     </Image>