Silverlight Canvas 儿童集合已更改

发布于 2024-08-04 17:08:04 字数 133 浏览 1 评论 0 原文

如果 Silverlight 中画布的 childcollection 发生变化,有没有办法捕获? (当添加或删除一个孩子时)

我知道 ObservableCollection 有这样一个事件,我如何为我的 Canvas 引发一个事件?

Is there a way to Catch if the childrencollection of a canvas in Silverlight has changed? (when a child is added or removed)

I know the ObservableCollection has such an event, how could i rase one for my Canvas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜无邪 2024-08-11 17:08:04

UIElementCollection 或 Canvas 对象不会引发此类事件,但是,从 Canvas.Children 集合中添加或删除元素将触发测量传递,然后触发布局更新传递,这意味着 LayoutUpdated 事件将被引发,但是在许多情况下也会引发该事件(如调整大小)。这是您可以了解画布的子集合可能已被修改的结束,除非您自己完成所有添加和删除操作。

No such event is raised by UIElementCollection or the Canvas object, however, adding or removing an element from Canvas.Children collection will trigger measure pass followed by an layout update pass, meaning the LayoutUpdated event will be raised, however the event is also raised in many cases (like resizing). This is the closes you can get to knowing a canvas's child collection could have been modified, unless you do all the adding and removing yourself.

鸩远一方 2024-08-11 17:08:04

面板的唯一职责是设置其子级的位置和大小。这是在 MeasureOverride 和 ArrangeOverride 这两个有点“纯粹”的过程中完成的。继承自 ItemsControl 以获得更多控制。

The only responsibility of a Panel is setting the position and size of its children. This is done in MeasureOverride and ArrangeOverride, two somewhat 'pure' procedures. Inherit from ItemsControl to get more control.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文