在网格上从Windows Phone 8移动一个形状
本文关键字:一个 移动 网格 Windows Phone | 更新日期: 2023-09-27 18:17:12
我正在开发一些Windows phone 8应用程序我有了下一个疑问:
我有一个8x8的网格,就像一个游戏桌,和矩形在所有的细胞在我的网格中,在每个单元格上,都有一个矩形,假设它是包含一个纸牌游戏,所以,这里是交易,我需要通过ManipulationDeltaEventArgs移动纸牌形状,但我不能将该形状重新排列到下一个网格单元
我认为这将是类似于 mysshape . grid . row++;,但没有父网格在我的形状属性你能帮帮我吗?
我的XAML文件看起来像这样
<Grid x:Name="MyGrid">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Fill="Black" Grid.Row="0" Grid.Column="0"/>
<!--I want to move this ellipse to the next row and collumn by drag and drop
and I already have that code, I just want to move it and stretch it to the
rectangle it is dropped
<Ellipse x:Name="e10" Fill="White" Grid.Row="0" Grid.Column="0" Width="45" Heigth="45" ManipulationCompleted="e10_ManipulationCompleted_1"/>
</Grid>
问候!
您可以通过以下方式设置Row属性:
myShape.SetValue(Grid.RowProperty, (int)myShape.GetValue(Grid.RowProperty) + 1 );
或:
Grid.SetRow(myShape, Grid.GetRow(myShape) + 1);