【问题标题】:Move a Shape from Windows Phone 8 on Grid在网格上从 Windows Phone 8 移动形状
【发布时间】:2013-06-06 18:13:08
【问题描述】:

我正在开发一些 windows phone 8 应用程序 我得到了下一个疑问:

我有 8x8 网格,就像游戏桌一样,所有单元格上都有矩形 在我的网格中,在每个单元格中,有一个矩形形状,假设为 包含一个纸牌游戏,所以,这是交易,我需要通过 ManipulationDeltaEventArgs 移动纸牌形状,但我无法将该形状重新排列到下一个网格单元格

我认为它会类似于 myShape.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>

问候!

【问题讨论】:

    标签: c# xaml mvvm visual-studio-2012 windows-phone-8


    【解决方案1】:

    您可以通过以下方式设置 Row 属性:

    myShape.SetValue(Grid.RowProperty, (int)myShape.GetValue(Grid.RowProperty) + 1 );
    

    或:

    Grid.SetRow(myShape, Grid.GetRow(myShape) + 1);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-23
      • 1970-01-01
      • 1970-01-01
      • 2014-05-27
      • 2014-10-07
      • 1970-01-01
      • 1970-01-01
      • 2014-08-23
      相关资源
      最近更新 更多