WPF笔记(2)Control和pannel

  Control    

 WPF中的控件都是从Control派生而来。类层次如下:

Object
       DispatcherObject (abstract)
                DependencyObject
                           Visual (abstract)
                                     UIElement
                                            FrameworkElement
                                                      Control

                                                             ContentControl
                                                                   ButtonBase (abstract)
                                                                        Button
                                                                    Window

从上图中可以看出ButtonBase和Window都是从ContentControl继承而来,因此他们的Content属性都可以放置其他从UIElement继承来的对象。Button控件是WPF控件的原型(archetypal )控件。

     Margin和Padding

Margin属性(defined by FrameworkElement)影响的是控件的外部空间(exterior)。

Padding属性(defined by Control)影响的是控件的内部控件(interior)。

     Panel
     WPF定义了几个面板类。我们可以将控件或者其他元素在这上面进行布局。类层次关系如下:

UIElement
    FrameworkElement
         Panel (abstract)
                Canvas
                DockPanel
                Grid
                StackPanel
                UniformGrid
                WrapPanel

                                                      

posted @ 2008-09-16 14:49  bluealarm  阅读(389)  评论(0编辑  收藏  举报