2.11.1 Decorator

提供在单个子元素(如 Border Viewbox )上或周围应用效果的元素的基类。

Decorator 包含 UIElement 由属性指定的单个 Child Decorator 影响或修饰的 UIElement Decorator 可能有也可能没有外观。 例如,会在 Border 控件周围放置一个矩形,但不会 Viewbox 显示视觉对象。

    public class Decorator : FrameworkElement, IAddChild
        //获取或设置 Decorator 的单一子元素。
        public virtual System.Windows.UIElement Child { get; set; }
        //获取一个可用于循环访问 Decorator 的逻辑子元素的枚举器。
        protected internal override System.Collections.IEnumerator LogicalChildren { get; }
        //获取一个值,该值等于 Decorator 的此实例的可视子元素数。
        protected override int VisualChildrenCount { get; }
        //排列 Decorator 元素的内容。
        protected override System.Windows.Size ArrangeOverride(System.Windows.Size arrangeSize);
        //获取位于指定 index 位置的子 Visual 元素。
        protected override System.Windows.Media.Visual GetVisualChild(int index);
        //测量 Decorator 的子元素,以准备在 ArrangeOverride(Size) 传递期间对其进行排列。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);
        //此类型或成员支持 Windows Presentation Foundation (WPF) 基础结构,并且不应在代码中直接使用。
        void IAddChild.AddChild(object value);
        //此类型或成员支持 Windows Presentation Foundation (WPF) 基础结构,并且不应在代码中直接使用。
        void IAddChild.AddText(string text);

2.11.2 ButtonChrome

为 Button 元素创建特定于主题的外观。

的实际外观取决于 Button 用户系统上活动的主题。 此类的属性使 .NET 可以基于当前主题设置外观。

在 XAML 用法中, ButtonChrome 对象元素还可以具有子内容,该内容可以是设置属性的单个内容 UIElement Child 。

XAML 对象元素用法

<theme:ButtonChrome .../>

XAML 值

theme:Microsoft.Windows.ThemesCLR 命名空间的 xmlns 前缀。 通常,xmlns 前缀和映射在 XAML 根元素中定义 (未显示) 。

    public sealed class ButtonChrome : System.Windows.Controls.Decorator
        public static readonly System.Windows.DependencyProperty BackgroundProperty;
        public static readonly System.Windows.DependencyProperty BorderBrushProperty;
        public static readonly System.Windows.DependencyProperty FillProperty;
        public static readonly System.Windows.DependencyProperty RenderDefaultedProperty;
        public static readonly System.Windows.DependencyProperty RenderMouseOverProperty;
        public static readonly System.Windows.DependencyProperty RenderPressedProperty;
        public static readonly System.Windows.DependencyProperty RoundCornersProperty;
        public static readonly System.Windows.DependencyProperty ThemeColorProperty;
        //获取或设置用于填充 Button 背景的画笔。
        public System.Windows.Media.Brush Background { get; set; }
        //获取或设置用于绘制 Button 的外边框的画笔。
        public System.Windows.Media.Brush BorderBrush { get; set; }
        //获取或设置用于绘制 Button 的内部颜色的画笔。
        public System.Windows.Media.Brush Fill { get; set; }
        //获取或设置一个值,该值指示 Button 是否具有窗体上默认按钮的外观。
        public bool RenderDefaulted { get; set; }
        //获取或设置一个值,该值指示 Button 上面是否好像具有鼠标。
        public bool RenderMouseOver { get; set; }
        //获取或设置一个值,该值指示 Button 看上去是否处于按下状态。
        public bool RenderPressed { get; set; }
        //获取或设置一个值,该值指示 Button 是否具有圆角。
        public bool RoundCorners { get; set; }
        //获取或设置主题颜色。
        public Microsoft.Windows.Themes.ThemeColor ThemeColor { get; set; }

2.11.3 ClassicBorderDecorator

创建 Decorator 类型的特定于主题的外观,以与传统型主题一起使用。

若要实现经典外观,请 ClassicBorderBrush 将指定为 BorderBrush 。 任何其他画笔都将删除经典外观,并呈现的边框 BorderThickness (元素的大小写除外 TabControl ,这种情况总是以经典外观呈现)。

XAML 对象元素用法

<theme:ClassicBorderDecorator ...>  
  singleChild  
</theme:ClassicBorderDecorator>  

XAML 值

theme:
Microsoft.Windows.ThemesCLR 命名空间的 xmlns 前缀。 通常,xmlns 前缀和映射在 XAML 根元素中定义 (未显示) 。

singleChild
单个对象元素子级,表示边框绘制的对象。 此对象必须是 UIElement 。 典型的子元素为固定 UIElement (例如 Path) ,或者是组合中的表示器或其他修饰器。

    public sealed class ClassicBorderDecorator : System.Windows.Controls.Decorator
        public static readonly System.Windows.DependencyProperty BackgroundProperty;
        public static readonly System.Windows.DependencyProperty BorderBrushProperty;
        public static readonly System.Windows.DependencyProperty BorderStyleProperty;
        public static readonly System.Windows.DependencyProperty BorderThicknessProperty;
        //public System.Windows.Media.Brush Background { get; set; }
        public System.Windows.Media.Brush Background { get; set; }
        //public System.Windows.Media.Brush BorderBrush { get; set; }
        public System.Windows.Media.Brush BorderBrush { get; set; }
        //获取或设置用于绘制元素外边框的 ClassicBorderStyle。
        public Microsoft.Windows.Themes.ClassicBorderStyle BorderStyle { get; set; }
        //获取或设置边框的宽度。
        public System.Windows.Thickness BorderThickness { get; set; }
        //获取用于绘制边框的画笔。
        public static System.Windows.Media.Brush ClassicBorderBrush { get; }

2.11.4 ListBoxChrome

为 ListBox 元素创建特定于主题的外观。

    public sealed class ListBoxChrome : System.Windows.Controls.Decorator
        public static readonly System.Windows.DependencyProperty BackgroundProperty;
        public static readonly System.Windows.DependencyProperty BorderBrushProperty;
        public static readonly System.Windows.DependencyProperty BorderThicknessProperty;
        public static readonly System.Windows.DependencyProperty RenderFocusedProperty;
        public static readonly System.Windows.DependencyProperty RenderMouseOverProperty;
        //获取或设置用于填充 ListBox 背景的画笔。
        public System.Windows.Media.Brush Background { get; set; }
        //获取或设置用于绘制 ListBox 的外边框的画笔。
        public System.Windows.Media.Brush BorderBrush { get; set; }
        //获取或设置 ListBox 的边框粗细。
        public System.Windows.Thickness BorderThickness { get; set; }
        //获取或设置一个值,该值指示 ListBox 看上去是否好像具有键盘焦点。
        public bool RenderFocused { get; set; }
        //获取或设置一个值,该值指示 ListBox 上面是否好像具有鼠标。
        public bool RenderMouseOver { get; set; }

2.11.5 SystemDropShadowChrome

创建投影效果的特定于主题的外观。

投影效果用于创建元素内容的实体剪影。 这将创建内容为浮动和转换阴影的错觉。

XAML 对象元素用法

<theme:ListBoxChrome ...>
  singleChild
</theme:ListBoxChrome>

XAML 值

theme:Microsoft.Windows.ThemesCLR 命名空间的 xmlns 前缀。 通常,xmlns 前缀和映射在 XAML 根元素中定义 (未显示) 。

singleChild 单个对象元素子级,表示修饰器绘制到的对象。 此对象必须是 UIElement 。

    public sealed class ListBoxChrome : System.Windows.Controls.Decorator
        public static readonly System.Windows.DependencyProperty BackgroundProperty;
        public static readonly System.Windows.DependencyProperty BorderBrushProperty;
        public static readonly System.Windows.DependencyProperty BorderThicknessProperty;
        public static readonly System.Windows.DependencyProperty RenderFocusedProperty;
        public static readonly System.Windows.DependencyProperty RenderMouseOverProperty;
        //获取或设置用于填充 ListBox 背景的画笔。
        public System.Windows.Media.Brush Background { get; set; }
        //获取或设置用于绘制 ListBox 的外边框的画笔。
        public System.Windows.Media.Brush BorderBrush { get; set; }
        //获取或设置 ListBox 的边框粗细。
        public System.Windows.Thickness BorderThickness { get; set; }
        //获取或设置一个值,该值指示 ListBox 看上去是否好像具有键盘焦点。
        public bool RenderFocused { get; set; }
        //获取或设置一个值,该值指示 ListBox 上面是否好像具有鼠标。
        public bool RenderMouseOver { get; set; }

2.11.6 Border

在另一个元素四周绘制边框和/或背景。

Border 只能有一个子级。 若要显示多个子元素,需要在父元素中放置一个额外的 Panel 元素 Border 。 然后,你可以在该元素中放置子元素 Panel 。

如果要在内容周围显示边框,则必须将元素放入父 Border 元素中。

    public class Border : Decorator
        public static readonly System.Windows.DependencyProperty BackgroundProperty;
        public static readonly System.Windows.DependencyProperty BorderBrushProperty;
        public static readonly System.Windows.DependencyProperty BorderThicknessProperty;
        public static readonly System.Windows.DependencyProperty CornerRadiusProperty;
        public static readonly System.Windows.DependencyProperty PaddingProperty;
        //获取或设置 Brush,它填充 Border 边界之间的区域。
        public System.Windows.Media.Brush Background { get; set; }
        //获取或设置用于绘制外部边框颜色的 Brush。
        public System.Windows.Media.Brush BorderBrush { get; set; }
        //获取或设置 Border 的相对 Thickness。
        public System.Windows.Thickness BorderThickness { get; set; }
        //获取或设置一个值,该值表示将 Border 的角倒圆的程度。
        public System.Windows.CornerRadius CornerRadius { get; set; }
        //获取或设置描述 Thickness 及其子元素之间的空间量的 Border 值。
        public System.Windows.Thickness Padding { get; set; }
        //排列 Border 元素的内容。
        protected override System.Windows.Size ArrangeOverride(System.Windows.Size finalSize);
        //在 Border 处理过程中排列 ArrangeOverride(Size) 的子元素之前,对这些子元素进行测量。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);
        //在 Border 的呈现处理过程中,绘制 DrawingContext 对象的内容。
        protected override void OnRender(System.Windows.Media.DrawingContext dc);

2.11.7 InkPresenter

在图面上呈现墨迹。

墨迹呈现以两种方式出现:动态和静态。 当墨迹写入墨迹图面时,动态呈现会出现:在收集笔画时,将呈现笔画。 在收集笔划数据并将其附加到新笔划后,会发生静态呈现。

若要使用动态呈现墨迹 InkPresenter ,请 RootVisual DynamicRenderer InkPresenter 使用 AttachVisuals 方法将的属性附加到。 若要以静态方式呈现墨迹,请将笔划对象添加到 Strokes 属性。

    public class InkPresenter : System.Windows.Controls.Decorator
        public static readonly System.Windows.DependencyProperty StrokesProperty;
        //获取或设置 InkPresenter 显示的笔划。
        public System.Windows.Ink.StrokeCollection Strokes { get; set; }
        //获取一个值,该值等于 Decorator 的此实例的可视子元素数。
        protected override int VisualChildrenCount { get; }
        //排列 Decorator 元素的内容。
        protected override System.Windows.Size ArrangeOverride(System.Windows.Size arrangeSize);
        //将 DynamicRenderer 的视觉效果附加到 InkPresenter。
        public void AttachVisuals(System.Windows.Media.Visual visual, System.Windows.Ink.DrawingAttributes drawingAttributes);
        //从 DynamicRenderer 中分离 InkPresenter 的视觉效果。
        public void DetachVisuals(System.Windows.Media.Visual visual);
        //返回一个剪裁几何图形,它指示当 ClipToBounds 属性设置为 true 时要剪裁的区域。
        protected override System.Windows.Media.Geometry GetLayoutClip(System.Windows.Size layoutSlotSize);
        //获取位于指定 index 位置的子 Visual 元素。
        protected override System.Windows.Media.Visual GetVisualChild(int index);
        //测量 Decorator 的子元素,以准备在 ArrangeOverride(Size) 传递期间对其进行排列。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);
        //提供 InkPresenterAutomationPeer 此控件的适当实现,作为 WPF 基础结构的一部分。
        protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer();    //

2.11.8 BulletDecorator

表示一个布局控件,该控件将项目符号与另一个可视对象对齐。

BulletDecorator 具有两个内容属性: Bullet 和 Child 。 Bullet属性定义 UIElement 要用作项目符号的。 Child属性定义一个 UIElement ,它与项目符号在视觉上对齐。

Bullet当对象为时,始终与第一行文本对齐 Child TextBlock 。 如果 Child 对象不是 TextBlock ,则与 Bullet 对象的中心对齐 Child 。 有关布局的详细信息 BulletDecorator ,请参阅 如何:创建用作 bulletdecorator

下图显示了控件的示例 BulletDecorator 。

    public class BulletDecorator : System.Windows.Controls.Decorator
        public static readonly System.Windows.DependencyProperty BackgroundProperty;
        //获取或设置 BulletDecorator 控件的背景色。
        public System.Windows.Media.Brush Background { get; set; }
        //获取或设置要在 BulletDecorator 中用作项目符号的对象。
        public System.Windows.UIElement Bullet { get; set; }
        //获取 BulletDecorator 控件的逻辑子元素的枚举数。
        protected internal override System.Collections.IEnumerator LogicalChildren { get; }
        //获取 BulletDecorator 控件的可视化子元素的数目。
        protected override int VisualChildrenCount { get; }
        //重写 BulletDecorator 控件的默认内容排列行为。
        protected override System.Windows.Size ArrangeOverride(System.Windows.Size arrangeSize);
        //获取位于指定索引处的子元素。
        protected override System.Windows.Media.Visual GetVisualChild(int index);
        //重写 BulletDecorator 控件的对象的默认测量行为。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);
        //呈现 BulletDecorator 控件的内容。
        protected override void OnRender(System.Windows.Media.DrawingContext dc);

2.11.9 Viewbox

定义一个内容修饰器,以便拉伸或缩放单一子项使其填满可用的控件。

Viewbox只能有一个 Child 。 如果添加其他 Child ,则会 ArgumentException 在运行时引发。

    public class Viewbox : Decorator
        public static readonly System.Windows.DependencyProperty StretchDirectionProperty;
        public static readonly System.Windows.DependencyProperty StretchProperty;
        //获取或设置 Viewbox 元素的单一子元素。
        public override System.Windows.UIElement Child { get; set; }
        //获取一个可迭代此 Viewbox 元素的逻辑子元素的枚举器。
        protected internal override System.Collections.IEnumerator LogicalChildren { get; }
        //获取或设置 ViewboxStretch 模式,该模式确定内容适应可用空间的方式。
        public System.Windows.Media.Stretch Stretch { get; set; }
        //获取或设置 StretchDirection,它确定缩放如何应用 Viewbox 的内容。
        public System.Windows.Controls.StretchDirection StretchDirection { get; set; }
        //获取此 Visual 实例中的子 Viewbox 对象数。
        protected override int VisualChildrenCount { get; }
        //排列 Viewbox 元素的内容。
        protected override System.Windows.Size ArrangeOverride(System.Windows.Size arrangeSize);
        //获取指定 index 位置处的 Visual 子级。
        protected override System.Windows.Media.Visual GetVisualChild(int index);
        //测量 Viewbox 的子元素,以便准备在 ArrangeOverride(Size) 过程中排列它们。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);

2.11.10 Adorner

表示修饰 UIElement 的 FrameworkElement 的抽象类。

装饰器是 FrameworkElement 绑定到的自定义 UIElement 。 装饰器呈现在装饰器层中,装饰器层是始终位于装饰元素或装饰元素集合之上的呈现图面;装饰器的呈现独立于呈现 UIElement 装饰器所绑定到的。 装饰器通常使用位于装饰元素左上部的标准 2D 坐标原点,相对于其绑定到的元素进行定位。

父级 Adorner 是 AdornerLayer 呈现的 Adorner ,而不是要装饰的元素。

放置在装饰器层中的任何内容将呈现在设置的其他任何样式的顶部。 换言之,装饰器始终以可见的方式位于顶部,无法使用 z 顺序重写。

    public abstract class Adorner : System.Windows.FrameworkElement
        //获取此装饰器绑定到的 UIElement。
        public System.Windows.UIElement AdornedElement { get; }
        //获取或设置一个指示是否启用装饰器剪辑的值。
        public bool IsClipEnabled { get; set; }
        //基于当前应用于装饰元素的转换,返回装饰器的 Transform。
        public virtual System.Windows.Media.GeneralTransform GetDesiredTransform(System.Windows.Media.GeneralTransform transform);
        //有关此成员的说明,请参见 GetLayoutClip(Size)。
        protected override System.Windows.Media.Geometry GetLayoutClip(System.Windows.Size layoutSlotSize);
        //实现装饰器的任何自定义度量行为。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);

AdornerDecorator

为可视化树中的子元素提供 AdornerLayer

AdornerDecorator 只能包含一个子元素。 该元素可以包含多个可以装饰的元素。

AdornerDecorator AdornerLayer 在可视化树中指定的位置。 它通常用于 ControlTemplate 可承载对象的控件 Adorner 。 例如,的 ControlTemplate Window 包含一个, AdornerDecorator 以便可以装饰窗口的子元素。 GetAdornerLayer null 如果传入元素,而该元素在 AdornerDecorator 其可视化树中不具有作为祖先的元素,则返回。

有关装饰器和可视化树的详细信息,请参阅WPF 中装饰器概述和树。

    public class AdornerDecorator : System.Windows.Controls.Decorator
        //获取与此 AdornerLayer 关联的 AdornerDecorator。
        public System.Windows.Documents.AdornerLayer AdornerLayer { get; }
        //获取或设置 AdornerDecorator 的单个子元素。
        public override System.Windows.UIElement Child { get; set; }
        //获取此 Visual 实例中的子 AdornerDecorator 对象数。
        protected override int VisualChildrenCount { get; }
        //定位子元素并确定 AdornerDecorator 的大小。
        protected override System.Windows.Size ArrangeOverride(System.Windows.Size finalSize);
        //获取指定 index 位置处的 Visual 子级。
        protected override System.Windows.Media.Visual GetVisualChild(int index);
        //测量子元素所需的大小,并确定 AdornerDecorator 的大小。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);

AdornerLayer

表示用于呈现装饰器的图面。

确保装饰器层的 Z 顺序大于) 正在装饰的元素 (,因此装饰器始终呈现在装饰的元素之上。

的父级 Adorner 是 AdornerLayer 呈现 装饰器 的,而不是要装饰的元素。

放置在装饰器层中的任何内容将呈现在设置的其他任何样式的顶部。 换言之,装饰器始终以可见的方式位于顶部,无法使用 z 顺序重写。

    public class AdornerLayer : System.Windows.FrameworkElement
        //获取一个枚举器,它可以循环访问此 AdornerLayer 元素的各个逻辑子元素。
        protected internal override System.Collections.IEnumerator LogicalChildren { get; }
        //获取此 Visual 实例中的子 AdornerLayer 对象数。
        protected override int VisualChildrenCount { get; }
        //将装饰器添加到装饰器层。
        public void Add(System.Windows.Documents.Adorner adorner);
        //获取指定点的 AdornerHitTestResult。
        public System.Windows.Media.AdornerHitTestResult AdornerHitTest(System.Windows.Point point);
        //定位子元素并确定 AdornerLayer 的大小。
        protected override System.Windows.Size ArrangeOverride(System.Windows.Size finalSize);
        //返回可视化树中指定的 Visual 上方的第一个装饰器层。
        public static System.Windows.Documents.AdornerLayer GetAdornerLayer(System.Windows.Media.Visual visual);
        //返回装饰器的数组,这些装饰器绑定到指定的 UIElement 上。
        public System.Windows.Documents.Adorner[] GetAdorners(System.Windows.UIElement element);
        //获取指定 index 位置处的 Visual 子级。
        protected override System.Windows.Media.Visual GetVisualChild(int index);
        //测量子元素所需的大小,并确定 AdornerLayer 的大小。
        protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint);
        //从装饰器层删除指定的 Adorner。
        public void Remove(System.Windows.Documents.Adorner adorner);
        //更新布局并重绘装饰器层中的所有装饰器。
        public void Update();
        public void Update(System.Windows.UIElement element);

AnchoredBlock

为 Inline 元素提供基类的抽象类,这些元素用于将 Block 元素锚定到流内容。

    public abstract class AnchoredBlock : System.Windows.Documents.Inline
        public static readonly System.Windows.DependencyProperty BorderBrushProperty;
        public static readonly System.Windows.DependencyProperty BorderThicknessProperty;
        public static readonly System.Windows.DependencyProperty LineHeightProperty;
        public static readonly System.Windows.DependencyProperty LineStackingStrategyProperty;
        public static readonly System.Windows.DependencyProperty MarginProperty;
        public static readonly System.Windows.DependencyProperty PaddingProperty;
        public static readonly System.Windows.DependencyProperty TextAlignmentProperty;
        //获取一个 BlockCollection,其中包含组成元素内容的顶级 Block 元素。
        public System.Windows.Documents.BlockCollection Blocks { get; }
        //获取或设置绘制元素边框时使用的 Brush。
        public System.Windows.Media.Brush BorderBrush { get; set; }
        //获取或设置元素的边框粗细。
        public System.Windows.Thickness BorderThickness { get; set; }
        //获取或设置各行内容的高度。
        public double LineHeight { get; set; }
        //获取或设置一种机制,根据该机制来为文本元素内的每一行文字确定一个行框。
        public System.Windows.LineStackingStrategy LineStackingStrategy { get; set; }
        //获取或设置元素的边距粗细。
        public System.Windows.Thickness Margin { get; set; }
        //获取或设置元素的填充厚度。
        public System.Windows.Thickness Padding { get; set; }
        //获取或设置一个值,该值指示文本内容的水平对齐方式。
        public System.Windows.TextAlignment TextAlignment { get; set; }
        //返回一个值,该值指示在序列化从 Blocks 派生的对象期间,是否应对 AnchoredBlock 属性的有效值进行序列化。
        public bool ShouldSerializeBlocks(System.Windows.Markup.XamlDesignerSerializationManager manager);

参考微软MSDN

动画就是一个ThicknessAnimation 和一个DoubleAnimation。程序要显示动态,日志之类的东西,在一个区域中显示一个文本,需要替换时,美观展现。实现思路很简单,两个TextBlock,轮流显示出来。 1、均派生自HeaderedItemsControl类。 2、它们都是控件,用于显示列表化的数据,同时可以显示一个标题。 3、内容属性为Items、ItemsSource和Header。 因为与ItemsControl非常类似,在此就不浪费时间了。 本族控件只有3个: MenuItem、 TreeViewItem、 ToolBar。 二、 Decorator族 本族中的元素 它们都有“装饰品”的意思。 Decorator类负责包装某个UI元素,以提供额外的行为。它有一个类型为UIElement的Child属性,其中含有待包装的内容。Decorator可被用于添加简单的视觉装饰,例如边界(Border),或者更复杂的行为,例如ViewBox,AdornerDecorator,或是InkPresenter。 当你从Decora...   看到这个标题,您可能会在脑中产生一个疑问:Adorner是什么?Adorner是WPF窗口中独立的一层,支持在界面元素之上执行独立的绘制及用户交互。可以说,Adorner在您的WPF程序中无处不在。在WPF中,从编辑框控件中光标的显示和选中效果的支持,到具有数据焦点的控件所具有的虚线外框,都是通过Adorner实现的。 什么是Adorner   鉴于您可能不熟悉Adorne... Button (一) <Style x:Key="ButtonSaveStyle" TargetType="{x:Type Button}"> <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/> 写下来,备忘。   Decorator,有装饰器、装饰品的意思,很容易让人联想到设计模式里面的装饰器模式。Decorator类负责包装某个UI元素,用来提供额外的行为。它有一个类型为UIElement的Child属性,其中含有待包装的内容。Decorator可以被用于添加简单的视觉装饰,比如Border边框,或者更为复杂的行为,比如ViewBox、AdornerDecorator。 ... 目录概述需求说明无边框窗体 Windows Presentation Foundation (WPF) 是一个可创建桌面客户端应用程序的 UI 框架。 WPF 开发平台支持广泛的应用开发功能,包括应用模型、资源、控件、图形、布局、数据绑定、文档和安全性。 此框架是 .NET Framework 的一部分,因此,在未来如果想快速的开发桌面软件,WPF腚是你的不二选择。 WPF既然是桌面软件UI,那一定绕不开桌面软件的多元化(chan pin jing li de chou pi)显示方式,最常    其实这部分的文章已经很多了,写下来方便自己查询. wpf内置提供了很多容器(Panel),容器分为多容器和单容器.下面介绍单容器.内置的单容器,大家最熟悉的如Border,其作用用于装饰容器内的元素,单一容器继承自Decorator,下面来看一个未使用装饰器的例子.  &lt;Window x:Class="WPFControlTutorialPart6_WPFApp.Window1" 一、Panel内容模型 Panel内容模型指从System.Windows.Controls.Panel继承的控件,这些控件都是容器,可以在内部承载其他的控件和子容器。Panel内容模型包含的容器有: Canvas DockPanel TabPanel ToolBarOverflowPanel UniformGrid StackPanel ToolBarPanel