Windows 10上的GridView重新排序

时间:2015-12-15 15:43:18

标签: windows-phone-8.1 uwp windows-10-mobile

我有一个Windows Phone 8.1应用程序(WinRT),我有一个gridview,我可以重新排序图像,它工作正常。

在运行Windows 10的手机上使用相同的应用程序无法重新排序项目。

重新排序模式设置正确,图像有点漂浮,就像在WP8.1上一样,但当我删除项目时,没有任何变化。

这是一个已知的错误还是这是一个解决方法,使其工作?

我的代码如下:

<GridView x:Name="GridView"
          VerticalAlignment="Top"
          Margin="-3"
          IsSwipeEnabled="True"
          AllowDrop="True"
          CanReorderItems="True"
          ItemsSource="{Binding ImagesReordered}">

并在代码中

private void EnableReorderMode()
{
    this.IsReordering = true;
    this.GridView.ReorderMode = ListViewReorderMode.Enabled;
}

修改

尝试使用更简单的代码(仅限xaml):

<GridView AllowDrop="true"
              CanReorderItems="true"
              ReorderMode="Enabled">
        <GridViewItem>
            <Rectangle Width="80"
                       Height="80"
                       Fill="Red"
                       Margin="4" />
        </GridViewItem>
        <GridViewItem>
            <Rectangle Width="80"
                       Height="80"
                       Fill="Yellow"
                       Margin="4" />
        </GridViewItem>
        <GridViewItem>
            <Rectangle Width="80"
                       Height="80"
                       Fill="Green"
                       Margin="4" />
        </GridViewItem>
</GridView>

在WP 8.1应用程序上,重新排序正在使用WP 8.1,而不是在Windows 10移动版上。 在W10 uwp上,重新排序在Windows 10上正常工作。

1 个答案:

答案 0 :(得分:0)

这应与我们在MSDN论坛https://social.msdn.microsoft.com/Forums/en-US/49a84f9f-69d7-4304-9cb7-ac44fd570252/w81-listview-canreorderitems-functionality-broken-in-windows-10-build-1511?forum=wpdevelop

上跟踪的问题相同

请继续监控该案例,我们会在那里更新任何进展。 ListView和GridView也会出现同样的问题。通过检查内部状态,建议的修复程序将解决来自其基类的两个控件问题。但我仍然不能说这个修复程序何时/如何可用。如果对您有很大的影响,请按照Prashant在该MSDN线程中介绍的说明联系MS支持。

要解决此问题,如果以上信息无法帮助您,您需要自行处理拖放操作。