WindowChrome WindowChrome WindowChrome WindowChrome Class

定义

表示一个对象,它描述窗口非工作区区域的自定义。Represents an object that describes the customizations to the non-client area of a window.

public ref class WindowChrome : System::Windows::Freezable
public class WindowChrome : System.Windows.Freezable
type WindowChrome = class
    inherit Freezable
Public Class WindowChrome
Inherits Freezable
继承

注解

利用WindowChrome类, 您可以将 Windows Presentation Foundation (WPF) 内容扩展到通常为操作系统的窗口管理器保留的窗口的非工作区。The WindowChrome class enables you to extend Windows Presentation Foundation (WPF) content into the non-client area of a window that is typically reserved for the operating system's window manager.

标准窗口Standard Windows

标准窗口由两个重叠矩形组成。Standard windows are composed of two overlapping rectangles. 外部矩形是非工作区, 通常称为chromeThe outer rectangle is the non-client area, which is often referred to as chrome. 它由操作系统的窗口管理器进行绘制和管理。It is drawn and managed by the operating system's window manager. 其维度由标准操作系统设置确定。Its dimensions are determined by standard operating system settings. 非客户端框架提供了标准的窗口功能和行为。The non-client frame provides standard window features and behaviors. 其中包括标题按钮 (最小化、最大化和关闭)、窗口边框、调整大小和移动行为、应用程序图标和标题, 以及 "系统" 菜单。These include caption buttons (Minimize, Maximize, and Close), the window border, resize and move behaviors, the application icon and title, and the system menu. 内部矩形是工作区The inner rectangle is the client area. 它包含应用程序的内容, 由应用程序进行绘制和管理。It contains the contents of your application, and it is drawn and managed by the application. 有关 WPF 应用程序中的 windows 的详细信息, 请参阅Wpf 窗口概述For more information about windows in WPF applications, see WPF Windows Overview.

下图显示了标准窗口的各个部分。The following illustration shows the parts of a standard window.

Window 元素Window elements

自定义窗口Custom Windows

可以通过将Window.WindowStyle属性设置为None或, 使用WindowChrome类自定义窗口边框。You can customize a window border by setting the Window.WindowStyle property to None or by using the WindowChrome class.

WindowStyle.NoneWindowStyle.None

自定义 WPF 应用程序窗口外观的一种方法是将Window.WindowStyle属性设置为。 NoneOne way to customize the appearance of a WPF application window is to set the Window.WindowStyle property to None. 这将从窗口中删除非客户端框架并仅离开工作区, 您可以将自定义样式应用到该区域。This removes the non-client frame from the window and leaves only the client area, to which you can apply a custom style. 但是, 在删除非客户端框架时, 还会丢失系统功能和所提供的行为, 例如标题按钮和窗口大小调整。However, when the non-client frame is removed, you also lose the system features and behaviors that it provides, such as caption buttons and window resizing. 另一个副作用是窗口在最大化时将覆盖 Windows 任务栏。Another side effect is that the window will cover the Windows taskbar when it is maximized. 通过WindowStyle.None设置, 你可以创建完全自定义的应用程序, 但也需要在应用程序中实现自定义逻辑来模拟标准窗口行为。Setting WindowStyle.None enables you to create a completely custom application, but also requires that you implement custom logic in your application to emulate standard window behavior.

WindowChromeWindowChrome

若要在保留其标准功能的同时自定义窗口, 可以WindowChrome使用类。To customize a window while retaining its standard functionality, you can use the WindowChrome class. WindowChrome类将窗口框架的功能与视觉对象隔开, 并使你能够控制应用程序窗口的客户端和非工作区之间的边界。The WindowChrome class separates the functionality of the window frame from the visuals, and lets you control the boundary between the client and non-client areas of your application window. 通过WindowChrome使用类, 您可以通过扩展工作区以覆盖非工作区来将 WPF 内容置于窗口框架中。The WindowChrome class lets you put WPF content in the window frame by extending the client area to cover the non-client area. 同时, 它将通过两个不可见区域保留系统行为;调整边框标题区的大小。At the same time, it retains system behaviors through two invisible areas; the resize border and caption areas.

使用WindowChrome类创建自定义窗口分为两个主要部分。There are two main parts to creating a custom window using the WindowChrome class. 首先, 通过设置WindowChrome对象上公开的属性来自定义窗口的非客户端部分。First, you customize the non-client part of the window by setting properties exposed on the WindowChrome object. 然后, 为窗口提供一个模板, 该模板定义扩展到非工作区的应用程序部分。WindowChrome对象上公开的属性为ResizeBorderThicknessCaptionHeight CornerRadius、和GlassFrameThicknessThen you provide a template for the window that defines the part of your application that is extended into the non-client area.The properties exposed on the WindowChrome object are ResizeBorderThickness, CaptionHeight, CornerRadius, and GlassFrameThickness.

ResizeBorderThickness属性指定应用程序窗口外的不可见边框, 用户可以单击并拖动它来调整窗口的大小。The ResizeBorderThickness property specifies an invisible border around the outside of the application window that the user can click-and-drag to resize the window.

CaptionHeight属性在窗口顶部指定一个不可见的区域, 该区域启用通常与标题栏关联的系统行为。The CaptionHeight property specifies an invisible area at the top of the window that enables system behaviors typically associated with the title bar. 这些行为包括: 单击并拖动以移动窗口, 双击以最大化窗口, 并右键单击以显示 "系统" 菜单。These behaviors include: click and drag to move the window, double-click to maximize the window, and right-click to show the system menu.

调整边框和标题区的大小不包含任何可视元素;它们仅定义响应输入和启用标准系统提供的窗口行为的区域。The resize border and caption area do not have any visual elements; they only define areas that respond to input and enable standard system-provided window behaviors.

CornerRadius属性指定窗口的角的舍入量。The CornerRadius property specifies the amount that the corners of the window are rounded. 如果为窗口启用了玻璃框架, 则此属性不起作用。This property does not have any effect if the glass frame is enabled for a window.

GlassFrameThickness属性指定窗口周围的玻璃帧的宽度。The GlassFrameThickness property specifies the width of the glass frame around the window. 默认情况下, 它使用WindowNonClientFrameThickness属性指定的系统值来模拟标准窗口的外观。By default, it uses the system value specified by the WindowNonClientFrameThickness property to emulate the appearance of a standard window. 使用玻璃帧时, "最小化"、"最大化" 和 "关闭" 的标题按钮是可见的, 并且是交互式的。When the glass frame is used, the caption buttons for Minimize, Maximize, and Close are visible and interactive. 应用程序负责显示应用程序图标和标题文本。The application is responsible for displaying the application icon and caption text. 可以设置GlassFrameThickness属性, 使玻璃框架更宽或更小。You can set the GlassFrameThickness property to make the glass frame wider or narrower than the default.

注意

更改GlassFrameThickness属性时, 标题按钮的大小不会更改。The size of the caption buttons does not change when the GlassFrameThickness property is changed. 如果玻璃框架顶部的高度小于标题按钮的高度, 则标题按钮将不完全可见。If the height of the top of the glass frame is less than the height of the caption buttons, the caption buttons will not be completely visible.

若要使自定义窗口不具有玻璃框架, 请将GlassFrameThickness属性设置为统一值0。To make a custom window that does not have a glass frame, set the GlassFrameThickness property to a uniform value of 0. 这将禁用并隐藏标准标题按钮。This will disable and hide the standard caption buttons.

若要扩展玻璃帧以覆盖整个窗口, 请将GlassFrameThickness属性设置为任意一侧的负值。To extend the glass frame to cover the entire window, set the GlassFrameThickness property to a negative value on any side. 如果任何GlassFrameThickness一侧的属性都设置为负值, 则其强制值将GlassFrameCompleteThickness等于。When the GlassFrameThickness property is set to a negative value for any side, its coerced value will be equal to GlassFrameCompleteThickness.

备注

Aero 是对 Windows Vista 中引入的 Windows 桌面的外观和功能的一组可视化增强功能。Aero is a set of visual enhancements to the look and functionality of the Windows desktop that was introduced in Windows Vista. Aero 更为直观易懂的功能之一是半透明的玻璃窗口边框。One of the more visually obvious features of Aero is translucent glass window borders. Windows Aero 由桌面窗口管理器 (DWM) 的桌面合成功能启用。Windows Aero is enabled by the desktop composition feature of the Desktop Window Manager (DWM).

并非所有操作系统都支持 Windows Aero 玻璃效果, 可在支持的操作系统上禁用它。Windows Aero glass effects are not supported on all operating systems, and can be disabled on supported operating systems. 如果 Windows Aero 不可用, 则不会显示玻璃框架, 无论GlassFrameThickness属性值如何。If Windows Aero is not available, the glass frame will not be displayed regardless of the GlassFrameThickness property value. 此属性指定的边框区域将显示为黑色。IsGlassEnabled检查属性以验证是否可以使用 Windows Aero 玻璃效果。The border area specified by this property will appear black instead.Check the IsGlassEnabled property to verify that Windows Aero glass effects are available. 如果 "玻璃效果" 不可用, 则应提供一种不使用玻璃帧的替代窗口样式, 或通过将窗口样式设置为 null 来使用 "标准" 窗口。If glass effects are not available, you should provide an alternate window style that does not use the glass frame or use the standard window by setting the window style to null.

通过指定定义框架内容的外观和行为的 System.windows.controls.controltemplate>, 可将 WPF 内容扩展到窗口框架。You extend your WPF content into the window frame by specifying a ControlTemplate that defines the appearance and behavior of the frame content. 将 System.windows.controls.controltemplate> 的 TargetType 设置为要自定义的窗口的类型。You set the TargetType of the ControlTemplate to the type of the window that you are customizing.

<ControlTemplate TargetType="{x:Type local:MainWindow}">  

默认情况下, 位于窗口非工作区内的任何可视元素部分都不是交互式的。By default, the parts of any visual elements that are within the non-client area of the window are not interactive. 若要启用非工作区中的交互式元素, 请将 IsHitTestVisibleInChrome 附加属性附加到元素, 并将其设置为 true。To enable interactive elements in the non-client area, attach the WindowsChrome.IsHitTestVisibleInChrome attached property to the element and set it to true.

以下 XAML 标记显示了使用 WindowChrome 类自定义窗口所需的主要元素。The following XAML markup shows the main elements needed to customize a window using the WindowChrome class.

<Style x:Key="StandardStyle" TargetType="{x:Type local:MainWindow}">  
    <Setter Property="shell:WindowChrome.WindowChrome">  
        <Setter.Value>  
            <shell:WindowChrome />  
        </Setter.Value>  
    </Setter>  
    <Setter Property="Template">  
        <Setter.Value>  
            <ControlTemplate TargetType="{x:Type local:MainWindow}">  
                <Grid>  
                    <Border Background="White"  
                            Margin="{Binding Source={x:Static shell:SystemParameters2.Current}, Path=WindowNonClientFrameThickness}">  
                        <ContentPresenter Content="{TemplateBinding Content}" />  
                    </Border>  
                    <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title}"   
                               VerticalAlignment="Top" HorizontalAlignment="Left"   
                               Margin="36,8,0,0"/>  
                    <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Icon}"  
                           VerticalAlignment="Top" HorizontalAlignment="Left"  
                           Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(shell:WindowChrome.WindowChrome).ResizeBorderThickness}"   
                           Width="{Binding Source={x:Static shell:SystemParameters2.Current}, Path=SmallIconSize.Width}"  
                           shell:WindowChrome.IsHitTestVisibleInChrome="True"/>  
                </Grid>  
            </ControlTemplate>  
        </Setter.Value>  
    </Setter>  
</Style>  

第一个资源库将 WindowChrome 附加到窗口中。The first setter attaches the WindowChrome to the window. 它使用 "WindowChrome" 属性的所有默认值, 这会使窗口类似于 "标准" 窗口。It uses all default values for the WindowChrome properties, which makes the window look like a standard window.

<Setter Property="shell:WindowChrome.WindowChrome">  
    <Setter.Value>  
        <shell:WindowChrome />  
    </Setter.Value>  
</Setter>  

窗口模板必须指定内容表示器, 以显示应用程序中指定的窗口的内容。The window template must specify a content presenter to display the contents of the window specified in your application. 默认情况下, WindowChrome 类将工作区扩展为涵盖非客户端边框。By default the WindowChrome class extends the client area to cover the non-client border. 若要发现玻璃帧, 需要指定 System.windows.controls.contentpresenter> 周围的边距。In order to uncover the glass frame, you need to specify a margin around the ContentPresenter. 此标记指定围绕内容表示器的白色背景, 以模拟标准窗口的外观。This markup specifies a border with a white background around the content presenter to emulate the appearance of a standard window. 它还指定绑定到 WindowNonClientFrameThickness 属性的边距, 此属性获取框架的默认系统宽度。It also specifies a margin that is bound to the WindowNonClientFrameThickness property, which gets the default system width for the frame.

<Border Background="White"  
    Margin="{Binding Source={x:Static shell:SystemParameters2.Current}, Path=WindowNonClientFrameThickness}">  
    <ContentPresenter Content="{TemplateBinding Content}" />  
</Border>  

WindowChrome 类不显示应用程序图标和标题;它们必须作为自定义内容添加到边框。The application icon and title are not displayed by the WindowChrome class; they have to be added to the border as custom content. 下面的 XAML 将添加一个图像和一个 textblock 以显示该图标和标题。The following XAML adds an image and a textblock to display the icon and title. 这两个元素都绑定到窗口中的相应属性。Both elements are bound to the corresponding properties on the window. 图像宽度绑定到 SmallIconSize 宽度, 这将获取图标的默认系统大小。The image width is bound to the SmallIconSize width, which gets the default system size for the icon. 已在图像上设置 IsHitTestVisibleInChrome 附加属性, 使其能够接收鼠标事件。The IsHitTestVisibleInChrome attached property is set on the image so that it can receive mouse events.

<Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Icon}"  
       VerticalAlignment="Top" HorizontalAlignment="Left"  
       Margin="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(shell:WindowChrome.WindowChrome).ResizeBorderThickness}"   
       Width="{Binding Source={x:Static shell:SystemParameters2.Current}, Path=SmallIconSize.Width}"  
       shell:WindowChrome.IsHitTestVisibleInChrome="True"/>  

<TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title}"   
           VerticalAlignment="Top" HorizontalAlignment="Left"   
           Margin="36,8,0,0"/>  

构造函数

WindowChrome() WindowChrome() WindowChrome() WindowChrome()

初始化 WindowChrome 类的新实例。Initializes a new instance of the WindowChrome class.

字段

CaptionHeightProperty CaptionHeightProperty CaptionHeightProperty CaptionHeightProperty

标识 CaptionHeight 依赖项属性。Identifies the CaptionHeight dependency property.

CornerRadiusProperty CornerRadiusProperty CornerRadiusProperty CornerRadiusProperty

标识 CornerRadius 依赖项属性。Identifies the CornerRadius dependency property.

GlassFrameThicknessProperty GlassFrameThicknessProperty GlassFrameThicknessProperty GlassFrameThicknessProperty

标识 GlassFrameThickness 依赖项属性。Identifies the GlassFrameThickness dependency property.

IsHitTestVisibleInChromeProperty IsHitTestVisibleInChromeProperty IsHitTestVisibleInChromeProperty IsHitTestVisibleInChromeProperty

标识 System.Windows.Shell.WindowChrome.IsHitTestVisibleInChrome 依赖项属性。Identifies the System.Windows.Shell.WindowChrome.IsHitTestVisibleInChrome dependency property.

NonClientFrameEdgesProperty NonClientFrameEdgesProperty NonClientFrameEdgesProperty NonClientFrameEdgesProperty

标识 NonClientFrameEdges 依赖项属性。Identifies the NonClientFrameEdges dependency property.

ResizeBorderThicknessProperty ResizeBorderThicknessProperty ResizeBorderThicknessProperty ResizeBorderThicknessProperty

标识 ResizeBorderThickness 依赖项属性。Identifies the ResizeBorderThickness dependency property.

ResizeGripDirectionProperty ResizeGripDirectionProperty ResizeGripDirectionProperty ResizeGripDirectionProperty

标识 System.Windows.Shell.WindowChrome.ResizeGripDirection 依赖项属性。Identifies the System.Windows.Shell.WindowChrome.ResizeGripDirection dependency property.

UseAeroCaptionButtonsProperty UseAeroCaptionButtonsProperty UseAeroCaptionButtonsProperty UseAeroCaptionButtonsProperty

标识 UseAeroCaptionButtons 依赖项属性。Identifies the UseAeroCaptionButtons dependency property.

WindowChromeProperty WindowChromeProperty WindowChromeProperty WindowChromeProperty

标识 WindowChrome 依赖项属性。Identifies the WindowChrome dependency property.

属性

CanFreeze CanFreeze CanFreeze CanFreeze

获取一个值,该值指示是否可将对象变为不可修改。Gets a value that indicates whether the object can be made unmodifiable.

(Inherited from Freezable)
CaptionHeight CaptionHeight CaptionHeight CaptionHeight

获取或设置窗口顶部标题区域的高度。Gets or sets the height of the caption area at the top of a window.

CornerRadius CornerRadius CornerRadius CornerRadius

获取或设置一个值,该值表示圆形窗口边角的度数。Gets or sets a value that indicates the amount that the corners of a window are rounded.

DependencyObjectType DependencyObjectType DependencyObjectType DependencyObjectType

获取对此实例的 CLRCLR 类型进行包装的 DependencyObjectTypeGets the DependencyObjectType that wraps the CLRCLR type of this instance.

(Inherited from DependencyObject)
Dispatcher Dispatcher Dispatcher Dispatcher

获取与此 Dispatcher 关联的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
GlassFrameCompleteThickness GlassFrameCompleteThickness GlassFrameCompleteThickness GlassFrameCompleteThickness

获取统一的粗细为 -1。Gets a uniform thickness of -1.

GlassFrameThickness GlassFrameThickness GlassFrameThickness GlassFrameThickness

获取或设置一个值,该值表示窗口周围透明边框的宽度。Gets or sets a value that indicates the width of the glass border around a window.

IsFrozen IsFrozen IsFrozen IsFrozen

获取一个值,该值指示对象当前是否可修改。Gets a value that indicates whether the object is currently modifiable.

(Inherited from Freezable)
IsSealed IsSealed IsSealed IsSealed

获取一个值,该值指示此实例当前是否为密封的(只读)。Gets a value that indicates whether this instance is currently sealed (read-only).

(Inherited from DependencyObject)
NonClientFrameEdges NonClientFrameEdges NonClientFrameEdges NonClientFrameEdges

获取或设置一个值,该值表示窗口框架边缘是否归客户端所有。Gets or sets a value that indicates which edges of the window frame are not owned by the client.

ResizeBorderThickness ResizeBorderThickness ResizeBorderThickness ResizeBorderThickness

获取或设置一个值,该值表示边框的宽度,用于调整窗口大小尺寸。Gets or sets a value that indicates the width of the border that is used to resize a window.

UseAeroCaptionButtons UseAeroCaptionButtons UseAeroCaptionButtons UseAeroCaptionButtons

获取或设置一个值,表示是对 Windows Aero 标题按钮启用的命中测试是否可用。Gets or sets a value that indicates whether hit-testing is enabled on the Windows Aero caption buttons.

附加属性

WindowChrome WindowChrome WindowChrome WindowChrome

获取或设置附加到窗口的 WindowChrome 的实例。Gets or sets the instance of WindowChrome that is attached to a window.

方法

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

确定调用线程是否可以访问此 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

清除属性的本地值。Clears the local value of a property. 要清除的属性由 DependencyProperty 标识符指定。The property to be cleared is specified by a DependencyProperty identifier.

(Inherited from DependencyObject)
ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey)

清除只读属性的本地值。Clears the local value of a read-only property. 要清除的属性由 DependencyPropertyKey 指定。The property to be cleared is specified by a DependencyPropertyKey.

(Inherited from DependencyObject)
Clone() Clone() Clone() Clone()

创建 Freezable 的一个可修改复本,从而制作该对象的值的深层副本。Creates a modifiable clone of the Freezable, making deep copies of the object's values. 在复制此对象的依赖属性时,此方法会复制表达式(可能不再解析),但不复制动画或其当前值。When copying the object's dependency properties, this method copies expressions (which might no longer resolve) but not animations or their current values.

(Inherited from Freezable)
CloneCore(Freezable) CloneCore(Freezable) CloneCore(Freezable) CloneCore(Freezable)

使用基(未经过动画处理的)属性值使该实例成为指定 Freezable 的克隆(深层复制)。Makes the instance a clone (deep copy) of the specified Freezable using base (non-animated) property values.

(Inherited from Freezable)
CloneCurrentValue() CloneCurrentValue() CloneCurrentValue() CloneCurrentValue()

使用 Freezable 的当前值创建其可修改复本(深层副本)。Creates a modifiable clone (deep copy) of the Freezable using its current values.

(Inherited from Freezable)
CloneCurrentValueCore(Freezable) CloneCurrentValueCore(Freezable) CloneCurrentValueCore(Freezable) CloneCurrentValueCore(Freezable)

使用当前属性值使该实例成为指定 Freezable 的可修改克隆(深层复制)。Makes the instance a modifiable clone (deep copy) of the specified Freezable using current property values.

(Inherited from Freezable)
CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty)

对指定依赖属性的值进行强制。Coerces the value of the specified dependency property. 通过对调用方 DependencyObject 上存在的依赖属性的属性元数据中所指定的任何 CoerceValueCallback 函数进行调用来完成此操作。This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(Inherited from DependencyObject)
CreateInstance() CreateInstance() CreateInstance() CreateInstance()

初始化 Freezable 类的新实例。Initializes a new instance of the Freezable class.

(Inherited from Freezable)
CreateInstanceCore() CreateInstanceCore() CreateInstanceCore() CreateInstanceCore()

创建 WindowChrome 类的新实例。Creates a new instance of the WindowChrome class.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定提供的 DependencyObject 是否等效于当前 DependencyObjectDetermines whether a provided DependencyObject is equivalent to the current DependencyObject.

(Inherited from DependencyObject)
Freeze() Freeze() Freeze() Freeze()

使当前对象不可修改,并且将其 IsFrozen 属性设置为 trueMakes the current object unmodifiable and sets its IsFrozen property to true.

(Inherited from Freezable)
FreezeCore(Boolean) FreezeCore(Boolean) FreezeCore(Boolean) FreezeCore(Boolean)

使 Freezable 对象变为不可修改或测试是否可将其变为不可修改。Makes the Freezable object unmodifiable or tests whether it can be made unmodifiable.

(Inherited from Freezable)
GetAsFrozen() GetAsFrozen() GetAsFrozen() GetAsFrozen()

使用基(未经过动画处理的)属性值创建 Freezable 的冻结副本。Creates a frozen copy of the Freezable, using base (non-animated) property values. 由于副本已冻结,因此将通过引用复制任何冻结的子对象。Because the copy is frozen, any frozen sub-objects are copied by reference.

(Inherited from Freezable)
GetAsFrozenCore(Freezable) GetAsFrozenCore(Freezable) GetAsFrozenCore(Freezable) GetAsFrozenCore(Freezable)

使用基(未经过动画处理的)属性值使该实例成为指定的 Freezable 的冻结复本。Makes the instance a frozen clone of the specified Freezable using base (non-animated) property values.

(Inherited from Freezable)
GetCurrentValueAsFrozen() GetCurrentValueAsFrozen() GetCurrentValueAsFrozen() GetCurrentValueAsFrozen()

使用当前属性值创建 Freezable 的冻结副本。Creates a frozen copy of the Freezable using current property values. 由于副本已冻结,因此将通过引用复制任何冻结的子对象。Because the copy is frozen, any frozen sub-objects are copied by reference.

(Inherited from Freezable)
GetCurrentValueAsFrozenCore(Freezable) GetCurrentValueAsFrozenCore(Freezable) GetCurrentValueAsFrozenCore(Freezable) GetCurrentValueAsFrozenCore(Freezable)

使当前实例成为指定的 Freezable 的冻结复本。Makes the current instance a frozen clone of the specified Freezable. 如果对象具有经过动画处理的依赖项对象,则复制这些属性当前经过动画处理的值。If the object has animated dependency properties, their current animated values are copied.

(Inherited from Freezable)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

获取此 DependencyObject 的哈希代码。Gets a hash code for this DependencyObject.

(Inherited from DependencyObject)
GetIsHitTestVisibleInChrome(IInputElement) GetIsHitTestVisibleInChrome(IInputElement) GetIsHitTestVisibleInChrome(IInputElement) GetIsHitTestVisibleInChrome(IInputElement)

从指定的输入元素获取 System.Windows.Shell.WindowChrome.IsHitTestVisibleInChrome 附加属性的值。Gets the value of the System.Windows.Shell.WindowChrome.IsHitTestVisibleInChrome attached property from the specified input element.

GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator()

创建一个专用的枚举数,用于确定哪些依赖项属性在此 DependencyObject 上具有以本地方式设置的值。Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(Inherited from DependencyObject)
GetResizeGripDirection(IInputElement) GetResizeGripDirection(IInputElement) GetResizeGripDirection(IInputElement) GetResizeGripDirection(IInputElement)

从指定的输入元素获取 System.Windows.Shell.WindowChrome.ResizeGripDirection 附加属性的值。Gets the value of the System.Windows.Shell.WindowChrome.ResizeGripDirection attached property from the specified input element.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

DependencyObject 的此实例返回依赖属性的当前有效值。Returns the current effective value of a dependency property on this instance of a DependencyObject.

(Inherited from DependencyObject)
GetWindowChrome(Window) GetWindowChrome(Window) GetWindowChrome(Window) GetWindowChrome(Window)

从指定的 WindowChrome 中获取 Window 附加属性的值。Gets the value of the WindowChrome attached property from the specified Window.

InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty)

重新计算指定依赖项属性的有效值Re-evaluates the effective value for the specified dependency property

(Inherited from DependencyObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
OnChanged() OnChanged() OnChanged() OnChanged()

修改当前 Freezable 对象时调用。Called when the current Freezable object is modified.

(Inherited from Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject) OnFreezablePropertyChanged(DependencyObject, DependencyObject) OnFreezablePropertyChanged(DependencyObject, DependencyObject) OnFreezablePropertyChanged(DependencyObject, DependencyObject)

确保为刚刚设置的 DependencyObjectType 数据成员建立适当的上下文指针。Ensures that appropriate context pointers are established for a DependencyObjectType data member that has just been set.

(Inherited from Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty) OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty)

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

(Inherited from Freezable)
OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs)

重写 OnPropertyChanged(DependencyPropertyChangedEventArgs)DependencyObject 实现,以同时调用任何响应类型 Freezable 不断变化的依赖属性的 Changed 处理程序。Overrides the DependencyObject implementation of OnPropertyChanged(DependencyPropertyChangedEventArgs) to also invoke any Changed handlers in response to a changing dependency property of type Freezable.

(Inherited from Freezable)
ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

如果存在,则返回依赖属性的本地值。Returns the local value of a dependency property, if it exists.

(Inherited from DependencyObject)
ReadPreamble() ReadPreamble() ReadPreamble() ReadPreamble()

确保正在从有效的线程访问 FreezableEnsures that the Freezable is being accessed from a valid thread. Freezable 的继承者必须在任何 APIAPI 一开始读取不属于依赖项对象的数据成员时调用此方法。Inheritors of Freezable must call this method at the beginning of any APIAPI that reads data members that are not dependency properties.

(Inherited from Freezable)
SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object)

设置依赖属性的值而不更改其值源。Sets the value of a dependency property without changing its value source.

(Inherited from DependencyObject)
SetIsHitTestVisibleInChrome(IInputElement, Boolean) SetIsHitTestVisibleInChrome(IInputElement, Boolean) SetIsHitTestVisibleInChrome(IInputElement, Boolean) SetIsHitTestVisibleInChrome(IInputElement, Boolean)

设置指定输入元素上的 System.Windows.Shell.WindowChrome.IsHitTestVisibleInChrome 附加属性的值。Sets the value of the System.Windows.Shell.WindowChrome.IsHitTestVisibleInChrome attached property on the specified input element.

SetResizeGripDirection(IInputElement, ResizeGripDirection) SetResizeGripDirection(IInputElement, ResizeGripDirection) SetResizeGripDirection(IInputElement, ResizeGripDirection) SetResizeGripDirection(IInputElement, ResizeGripDirection)

设置指定输入元素上的 System.Windows.Shell.WindowChrome.ResizeGripDirection 附加属性的值。Sets the value of the System.Windows.Shell.WindowChrome.ResizeGripDirection attached property on the specified input element.

SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object)

设置依赖属性的本地值,该值由其依赖属性标识符指定。Sets the local value of a dependency property, specified by its dependency property identifier.

(Inherited from DependencyObject)
SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object)

设置一个只读依赖属性的本地值,该值由依赖属性的 DependencyPropertyKey 标识符指定。Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(Inherited from DependencyObject)
SetWindowChrome(Window, WindowChrome) SetWindowChrome(Window, WindowChrome) SetWindowChrome(Window, WindowChrome) SetWindowChrome(Window, WindowChrome)

设置指定的 WindowChromeWindow 附加属性的值。Sets the value of the WindowChrome attached property on the specified Window.

ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty)

返回一个值,该值指示序列化进程是否应序列化所提供的依赖属性的值。Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(Inherited from DependencyObject)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

强制调用线程具有此 DispatcherObject 的访问权限。Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
WritePostscript() WritePostscript() WritePostscript() WritePostscript()

引发 FreezableChanged 事件并调用其 OnChanged() 方法。Raises the Changed event for the Freezable and invokes its OnChanged() method. Freezable 派生的类应在修改的类成员不存储为依赖属性的任何 API 的末尾调用此方法。Classes that derive from Freezable should call this method at the end of any API that modifies class members that are not stored as dependency properties.

(Inherited from Freezable)
WritePreamble() WritePreamble() WritePreamble() WritePreamble()

验证 Freezable 是否未被冻结,并且是否正在从有效的线程上下文中访问它。Verifies that the Freezable is not frozen and that it is being accessed from a valid threading context. Freezable 的继承项应当在任何 APIAPI 一开始写入不属于依赖项属性的数据成员时调用此方法。Freezable inheritors should call this method at the beginning of any APIAPI that writes to data members that are not dependency properties.

(Inherited from Freezable)

事件

Changed Changed Changed Changed

在修改 Freezable 或其包含的对象时发生。Occurs when the Freezable or an object it contains is modified.

(Inherited from Freezable)

适用于