简体   繁体   English

Uno 平台中的 UIElement.InvalidateArrange() 和 UpdateLayout() 替代方案

[英]UIElement.InvalidateArrange() and UpdateLayout() Alternatives in Uno Platforms

It seems the Uno Platform doesn't support InvalidateArrange() and UpdateLayout() methods within UIElement. Uno 平台似乎不支持 UIElement 中的 InvalidateArrange() 和 UpdateLayout() 方法。 When building an existing UWP project warnings such as below may appear:在构建现有的 UWP 项目时,可能会出现如下警告:

...\Source\UserControls\View\TableView.xaml.cs(743,17,743,39): warning Uno0001: Windows.UI.Xaml.UIElement.InvalidateArrange() is not implemented in Uno
...\Source\UserControls\View\TableView.xaml.cs(745,17,745,34): warning Uno0001: Windows.UI.Xaml.UIElement.UpdateLayout() is not implemented in Uno

What is the suggested alternative?建议的替代方案是什么? How should a UIElement be invalidated and then updated in Uno?应该如何使 UIElement 失效,然后在 Uno 中更新? I note that InvalidateMeasure() does appear to be implemented.我注意到 InvalidateMeasure() 似乎已实现。

In UWP it was necessary to manually invalidate both measure and arrange and then force an update or glitches would occur.在 UWP 中,必须手动使测量和排列无效,然后强制更新,否则会发生故障。 Whether or not this is a UWP internal issue is probably not important here.这是否是 UWP 内部问题在这里可能并不重要。

While those methods are not yet implemented on all platforms, invoking them anyways is safe.虽然这些方法尚未在所有平台上实现,但无论如何调用它们是安全的。

You may need still to invoke UIElement.InvalidateMeasure() for this to work properly on Uno.您可能仍需要调用UIElement.InvalidateMeasure()才能使其在 Uno 上正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM