Reference Sorceを読む。 Panel - 1Page
Reference Sorceを勉強ついでに読み込んでいきます。
個人的な備忘録を兼ねた記事となります。
概要
まずはクラスの概要から。
/// <summary> /// Base class for all layout panels. /// </summary> [Localizability(LocalizationCategory.Ignore)] [ContentProperty("Children")] public abstract class Panel : FrameworkElement, IAddChild
abstractの定義なのであくまでベースクラス。
コメントでも書いてますがパネルのベースクラスとなります。
パネル(枠)なので提供する機能としてはやはり子要素の操作・保持が主目的です。
LocalizationCategory.Ignoreなのでローカライゼーションは不要。
ContentPropertyにChildrenを指定しているため、Xamlで指定した内容はChildrenに格納されています。
IAddChildのインターフェースの役割も指定していますね。
<StackPanel> <Label>AAAA</Label> <Label>BBBB</Label> </StackPanel>
主要素
Panelの子要素の操作・保持がメインですので主な要素をピックアップ
public UIElementCollection Children public bool ShouldSerializeChildren() public static readonly DependencyProperty IsItemsHostProperty public bool IsItemsHost protected internal UIElementCollection InternalChildren protected override int VisualChildrenCount protected override Visual GetVisualChild(int index) void IAddChild.AddChild (Object value) private void ClearChildren() protected override void OnRender(DrawingContext dc) protected internal override IEnumerator LogicalChildren
次回はさらに主要素の掘り下げの作業にしたいと思います。