Silverlight 的控件生命周期
2009-02-24 22:46
134 查看
微软的 Dave Relyea 在 blog 中解释了 Silverlight 中控件的生命周期,以及一些可以 override 的基类方法发生的时机。
http://blogs.msdn.com/devdave/archive/2008/10/11/control-lifecycle.aspx
http://blogs.msdn.com/devdave/archive/2008/10/11/control-lifecycle.aspx
Action | Control instantiated in XAML | Control instantiated in code |
Control ctor | As soon as begin tag is parsed. | When you call it. |
Explicit Style applied | If the Style property is set in XAML, it will be applied as soon as the end tag is parsed. | As soon as Style property is set. |
Built-in Style (from generic.xaml) applied | As soon as the end tag is parsed, after the explicit Style (if any) has been applied. Will not override explicit Style. | When the control enters the tree. Will not override explicit Style. |
Properties set | When the attributes are parsed. | When you set them. |
Loaded event | Posted when the element is been added to the tree. Fired before the next frame. Happens before layout. | Same. |
Template applied (i.e. control's visual are created from the Template) | In the Measure pass of layout. The Template property will be applied if the control has no visual tree. The control starts life with no visual tree, and the visual tree will be cleared when the Template property is set. You can also callApplyTemplate yourself. | Same. |
OnApplyTemplate called | Whenever the Template is applied. It is not necessary to call the base OnApplyTemplate for the Template to be applied, but inherited types might be relying on it for their implementations. | Same. |
Visuals first available | In OnApplyTemplate. Use GetTemplateChild. | Same. |
MeasureOverride called | In the Measure pass of layout. If the Template was expanded during this Measure pass, MeasureOverride will be called after the Template has been expanded. | Same. |
ArrangeOverride called | In the Arrange pass of layout, which occurs after theMeasure pass. | Same. |
SizeChanged event | After the Measure and Arrange passes have completed. | Same. |
LayoutUpdated event | After SizeChanged events have fired. | Same. |
相关文章推荐
- Silverlight 的控件生命周期
- Silverlight 的控件生命周期
- Android基础——控件的混合生命周期
- WPF and Silverlight 学习笔记(十):WPF控件模型
- Silverlight 2 跨域访问控件与WebService的资料整理
- 浅谈ASP.NET页面生命周期(控件)
- [Silverlight入门系列]动态创建控件和绑定
- 深入理解 ASP.NET 动态控件 (Part 3 - 页面生命周期)
- Silverlight 信息显示与编辑控件 示例
- Silverlight 数据显示和布局控件 示例
- silverlight控件翻转
- Silverlight玩转控件(四)——Grid布局
- asp.net服务器控件开发(一) :控件的生命周期
- 用Silverlight制作一个广告控件,第一步
- Silverlight教程第六部分:使用用户控件实现主从表场景
- 控件模板Template(Silverlight)
- 控件的Content属性(Silverlight)
- 【转】Asp.net控件开发学习笔记整理篇 - 服务器控件生命周期
- Silverlight自定义数据绑定控件应该如何处理IEditableObject和IEditableCollectionView对象
- 为Silverlight控件添加鼠标滚轮支持的小类