UserControl 中的 RelativePanel 排列使我的 UWP 应用程序中父页面的 Visual Studio 设计器崩溃

RelativePanel arrangement in UserControl crashes the parent page's Visual Studio designer in my UWP app

当我尝试在 UserControl 中使用 RelativePanel 容器时,随后在 DataTemplate 中的 another/parent 页面中使用 GridView ] 或 ListView 它会使该页面的 Visual Studio 设计器崩溃。在 运行 时间,它仍然有效,但无法在 Visual Studio 设计器中看到结果,我不得不返回使用 StackPanel 控件,这有效。

请注意,我在我的 UserConrol 中使用 x:Bind 并且 Visual Studio 设计器中的崩溃仅在我尝试使用 [=12= 排列子控件时发生] 使用类似 RelativePanel.Below 属性.

设计器抛出的异常是这样的:

我在 UserControl 中使用 xRelatedMovieImg 如下:

RelativePanel.Below="xRelatedMovieImg"

那么有没有其他人看到这个问题,如果有,他有没有修复或解决方法?

根据我的经验,Designer 可能非常脆弱并且会因为最奇怪的事情而崩溃。通常它通过重建项目 (Ctrl+Shift+B) 来提供帮助。

此外,如果您只是更改设计而不进行调试,则可以使用 Visual Studio 中“调试”菜单中的 "Start without debugging" (Ctrl+F5) 来加快启动速度。这样您就不必等待调试器完成所有设置。

遇到了同样的问题。发现在我的案例中使用 Binding 有效。所以你的可能是 RelativePanel.Below="{Binding ElementName=xRelatedMovieImg}"