TaskbarItemInfo TaskbarItemInfo TaskbarItemInfo TaskbarItemInfo Class

定义

表示有关任务栏缩略图显示方式的信息。Represents information about how the taskbar thumbnail is displayed.

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

示例

下面的示例演示如何创建TaskbarItemInfo标记中。The following example shows how to create a TaskbarItemInfo in markup. TaskbarItemInfo包含一系列ThumbButtonInfo提供从任务栏项访问的播放和停止命令的对象。The TaskbarItemInfo contains a collection of ThumbButtonInfo objects that provide access to the Play and Stop commands from the taskbar item.

<Window.TaskbarItemInfo>
    <TaskbarItemInfo x:Name="taskBarItemInfo1" 
                     Overlay="{StaticResource ResourceKey=StopImage}"
                     ThumbnailClipMargin="80,0,80,140"
                     Description="Taskbar Item Info Sample">
        <TaskbarItemInfo.ThumbButtonInfos>
            <ThumbButtonInfoCollection>
                <ThumbButtonInfo
                    DismissWhenClicked="False"
                    Command="MediaCommands.Play"
                    CommandTarget="{Binding ElementName=btnPlay}"
                    Description="Play"
                    ImageSource="{StaticResource ResourceKey=PlayImage}"/>
                <ThumbButtonInfo
                    DismissWhenClicked="True"
                    Command="MediaCommands.Stop"
                    CommandTarget="{Binding ElementName=btnStop}"
                    Description="Stop"
                    ImageSource="{StaticResource ResourceKey=StopImage}"/>
            </ThumbButtonInfoCollection>
        </TaskbarItemInfo.ThumbButtonInfos>
    </TaskbarItemInfo>
</Window.TaskbarItemInfo>

以下标记和代码在其完整的上下文中显示上一个示例。The following markup and code shows the previous example in its full context. 应用程序使用BackgroundWorker从 0 计数到 100 之间,并在用户界面中显示其进度。The application uses a BackgroundWorker to count from 0 to 100 and displays its progress in the user interface. 该任务可以启动和停止从任务栏预览。The task can be started and stopped from the taskbar preview. 任务栏按钮中显示进度。The progress is displayed in the taskbar button.

<Window x:Class="Shell_TaskbarItemSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="300" Width="300">
    <Window.Resources>
        <DrawingImage x:Key="PlayImage">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Brush="Green" Geometry="F1 M 50,25L 0,0L 0,50L 50,25 Z "/>
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
        <DrawingImage x:Key="StopImage">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Brush="Gray" Geometry="F1 M 0,0L 50,0L 50,50L 0,50L 0,0 Z "/>
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
    </Window.Resources>
    <Window.CommandBindings>
        <CommandBinding Command="MediaCommands.Play"
                  Executed="StartCommand_Executed"
                  CanExecute="StartCommand_CanExecute"/>
        <CommandBinding Command="MediaCommands.Stop"
                  Executed="StopCommand_Executed"
                  CanExecute="StopCommand_CanExecute"/>
    </Window.CommandBindings>
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo x:Name="taskBarItemInfo1" 
                         Overlay="{StaticResource ResourceKey=StopImage}"
                         ThumbnailClipMargin="80,0,80,140"
                         Description="Taskbar Item Info Sample">
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfoCollection>
                    <ThumbButtonInfo
                        DismissWhenClicked="False"
                        Command="MediaCommands.Play"
                        CommandTarget="{Binding ElementName=btnPlay}"
                        Description="Play"
                        ImageSource="{StaticResource ResourceKey=PlayImage}"/>
                    <ThumbButtonInfo
                        DismissWhenClicked="True"
                        Command="MediaCommands.Stop"
                        CommandTarget="{Binding ElementName=btnStop}"
                        Description="Stop"
                        ImageSource="{StaticResource ResourceKey=StopImage}"/>
                </ThumbButtonInfoCollection>
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Window.TaskbarItemInfo>

    <Grid>
        <StackPanel>
            <TextBlock x:Name="tbCount" FontSize="72" HorizontalAlignment="Center"/>
            <StackPanel Orientation="Horizontal">
                <Button x:Name="btnPlay" Content="Play" Command="MediaCommands.Play" />
                <Button x:Name="btnStop" Content="Stop" Command="MediaCommands.Stop" />
            </StackPanel>    
        </StackPanel>
    </Grid>
</Window>
// MainWindow.xaml.cs
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shell;

namespace Shell_TaskbarItemSample
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private BackgroundWorker _backgroundWorker = new BackgroundWorker();

        public MainWindow()
        {
            InitializeComponent();

            // Set up the BackgroundWorker.
            this._backgroundWorker.WorkerReportsProgress = true;
            this._backgroundWorker.WorkerSupportsCancellation = true;
            this._backgroundWorker.DoWork += new DoWorkEventHandler(bw_DoWork);
            this._backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
            this._backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
        }

        private void StartCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
            e.Handled = true;
        }
        
        private void StartCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (this._backgroundWorker.IsBusy == false)
            {
                this._backgroundWorker.RunWorkerAsync();
                // When the task is started, change the ProgressState and Overlay
                // of the taskbar item to indicate an active task.
                this.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Normal;
                this.taskBarItemInfo1.Overlay = (DrawingImage)this.FindResource("PlayImage");
            }
            e.Handled = true;
        }

        private void StopCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = this._backgroundWorker.WorkerSupportsCancellation;
            e.Handled = true;
        }

        private void StopCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            this._backgroundWorker.CancelAsync();
            e.Handled = true;
        }

        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // When the task ends, change the ProgressState and Overlay
            // of the taskbar item to indicate a stopped task.
            if (e.Cancelled == true)
            {
                // The task was stopped by the user. Show the progress indicator
                // in the paused state.
                this.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Paused;
            }
            else if (e.Error != null)
            {
                // The task ended with an error. Show the progress indicator
                // in the error state.
                this.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Error;
            }
            else
            {
                // The task completed normally. Remove the progress indicator.
                this.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.None;
            }
            // In all cases, show the 'Stopped' overlay.
            this.taskBarItemInfo1.Overlay = (DrawingImage)this.FindResource("StopImage");
        }

        void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            this.tbCount.Text = e.ProgressPercentage.ToString();
            // Update the value of the task bar progress indicator.
            this.taskBarItemInfo1.ProgressValue = (double)e.ProgressPercentage / 100;
        }

        void bw_DoWork(object sender, DoWorkEventArgs e)
        {        
            BackgroundWorker _worker = sender as BackgroundWorker;
            if (_worker != null)
            {
                for (int i = 1; i <= 100; i++)
                {
                    if (_worker.CancellationPending == true)
                    {
                        e.Cancel = true;
                        break;
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(25);
                        _worker.ReportProgress(i);
                    }
                }
            }
        }
    
    }   
}
' MainWindow.xaml.vb
Imports System.ComponentModel
Imports System.Windows.Shell

Class MainWindow
    Private _backgroundWorker As New BackgroundWorker

    Public Sub New()
        InitializeComponent()

        ' Set up the BackgroundWorker
        Me._backgroundWorker.WorkerReportsProgress = True
        Me._backgroundWorker.WorkerSupportsCancellation = True
        AddHandler Me._backgroundWorker.DoWork, AddressOf bw_DoWork
        AddHandler Me._backgroundWorker.ProgressChanged, AddressOf bw_ProgressChanged
        AddHandler Me._backgroundWorker.RunWorkerCompleted, AddressOf bw_RunWorkerCompleted
    End Sub

    Private Sub StartCommand_CanExecute(ByVal sender As System.Object, ByVal e As System.Windows.Input.CanExecuteRoutedEventArgs)
        e.CanExecute = True
        e.Handled = True
    End Sub

    Private Sub StartCommand_Executed(ByVal sender As System.Object, ByVal e As System.Windows.Input.ExecutedRoutedEventArgs)
        If Me._backgroundWorker.IsBusy = False Then
            Me._backgroundWorker.RunWorkerAsync()
            ' When the task is started, change the ProgressState and Overlay
            ' of the taskbar item to indicate an active task.
            Me.taskBarItemInfo1.ProgressState = Shell.TaskbarItemProgressState.Normal
            Me.taskBarItemInfo1.Overlay = Me.FindResource("PlayImage")
        End If
        e.Handled = True
    End Sub

    Private Sub StopCommand_CanExecute(ByVal sender As System.Object, ByVal e As System.Windows.Input.CanExecuteRoutedEventArgs)
        e.CanExecute = Me._backgroundWorker.WorkerSupportsCancellation
        e.Handled = True
    End Sub

    Private Sub StopCommand_Executed(ByVal sender As System.Object, ByVal e As System.Windows.Input.ExecutedRoutedEventArgs)
        Me._backgroundWorker.CancelAsync()
        e.Handled = True
    End Sub

    Private Sub bw_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs)
        ' When the task ends, change the ProgressState and Overlay
        ' of the taskbar item to indicate a stopped task.
        If e.Cancelled = True Then
            ' The task was stopped by the user. Show the progress indicator
            ' in the paused state.
            Me.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Paused
        ElseIf e.Error IsNot Nothing Then
            ' The task ended with an error. Show the progress indicator
            ' in the error state.
            Me.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.Error
        Else
            ' The task completed normally. Remove the progress indicator.
            Me.taskBarItemInfo1.ProgressState = TaskbarItemProgressState.None
            ' In all cases, show the 'Stopped' overlay.
            Me.taskBarItemInfo1.Overlay = Me.FindResource("StopImage")
        End If
    End Sub

    Private Sub bw_ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
        Me.tbCount.Text = e.ProgressPercentage.ToString()
        ' Update the value of the task bar progress indicator.
        Me.taskBarItemInfo1.ProgressValue = e.ProgressPercentage / 100
    End Sub

    Private Sub bw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
        Dim _worker As BackgroundWorker = CType(sender, BackgroundWorker)
        If _worker IsNot Nothing Then
            For i As Integer = 1 To 100 Step 1
                If _worker.CancellationPending = True Then
                    e.Cancel = True
                    Return
                Else
                    System.Threading.Thread.Sleep(25)
                    _worker.ReportProgress(i)
                End If
            Next
        End If
    End Sub
End Class

注解

TaskbarItemInfo类提供的托管包装器Windows 7Windows 7任务栏功能。The TaskbarItemInfo class provides a managed wrapper for Windows 7Windows 7 taskbar functionality. 有关 Windows shell 和本机任务栏 Api 的详细信息,请参阅任务栏扩展For more information about the Windows shell and native taskbar APIs, see Taskbar Extensions. TaskbarItemInfo 作为公开Window.TaskbarItemInfo上的依赖项属性WindowTaskbarItemInfo is exposed as the Window.TaskbarItemInfo dependency property on a Window.

Windows 7Windows 7任务栏提供了增强的功能,可以使用任务栏项来传达给用户的状态,并且最小化或隐藏窗口时公开常见任务。The Windows 7Windows 7 taskbar provides enhanced functionality that enables you to use the taskbar item to communicate status to a user and expose common tasks when the window is minimized or hidden. 通过公开的功能TaskbarItemInfo类是比以前的 Windows 版本中不可用Windows 7Windows 7The functionality that is exposed by the TaskbarItemInfo class is unavailable in versions of Windows earlier than Windows 7Windows 7. 使用的应用程序TaskbarItemInfo类仍可运行 Windows 的早期版本中; 但是,这些任务栏增强功能是在早期版本中不可用。Applications that use the TaskbarItemInfo class can still run in earlier versions of Windows; however, these taskbar enhancements are unavailable in the earlier versions.

Windows 7Windows 7,任务栏的部分功能可能不可用,具体取决于用户的设置。In Windows 7Windows 7, some taskbar functionality might be unavailable, depending on the user's settings. 例如,任务栏功能将不可用如果Windows AeroWindows Aero是已禁用,或者如果使用提升的权限启动该应用程序。For example, taskbar functionality is unavailable if Windows AeroWindows Aero is disabled or if the application is started with elevated permissions. 你的应用程序应提供的其他方法与用户交互,不依赖于增强的任务栏功能中Windows 7Windows 7Your application should provide other ways to interact with the user that do not depend on the enhanced taskbar functionality in Windows 7Windows 7.

在通知区域中,这是在任务栏最右侧,程序图标通常用于传达给用户的应用程序状态。Program icons in the notification area, which is at the far right of the taskbar, are typically used to communicate application status to a user. 默认情况下,Windows 7Windows 7任务栏隐藏通知区域中的程序图标。By default, the Windows 7Windows 7 taskbar hides program icons in the notification area. 但是,可以设置Overlay属性将图像添加到任务栏按钮进行通信状态,例如消息传递应用程序中的联机状态。However, you can set the Overlay property to add an image to the taskbar button to communicate status, such as online status in a messaging application. 覆盖图像允许用户查看应用程序状态,即使它们不能看到通知区域中的程序图标。The overlay image lets users see the application status even if they cannot see the program icon in the notification area. 此外可以显示任务栏按钮中的设置运行任务的进度ProgressStateProgressValue属性。You can also display the progress of running tasks in the taskbar button by setting the ProgressState and ProgressValue properties.

Windows 7Windows 7任务栏时您将鼠标指针移到任务栏按钮显示的应用程序的缩略图。The Windows 7Windows 7 taskbar displays a thumbnail of the application when you move the mouse pointer over the taskbar button. 默认情况下显示了整个应用程序窗口。By default the whole application window is shown. 可以指定特定窗口,通过设置在缩略图中显示的部分ThumbnailClipMargin属性。You can specify a particular part of the window to display in the thumbnail by setting the ThumbnailClipMargin property. 此外可以指定Description任务栏缩略图上方的工具提示中显示。You can also specify a Description that is displayed in a tooltip above the taskbar thumbnail. 即使在缩略图不能看到由于用户设置时,才显示工具提示。The tooltip is displayed even when the thumbnail cannot be seen because of user settings.

可以将按钮添加到任务栏缩略图,而无需切换到应用程序窗口中提供的常见任务的访问权限。You can add buttons to the taskbar thumbnail to provide access to common tasks without switching to the application window. 例如,窗口 Media Player 提供播放、 暂停、 前进,和后退按钮,您可以控制从任务栏缩略图的媒体播放,当应用程序最小化。For example, Window Media Player provides Play, Pause, Forward, and Back buttons that let you control media playback from the taskbar thumbnail when the application is minimized. 表示在任务栏缩略图中的按钮ThumbButtonInfo对象,并包含在ThumbButtonInfos集合。Buttons in the taskbar thumbnail are represented by ThumbButtonInfo objects and are contained in the ThumbButtonInfos collection.

下图显示了的增强的功能Windows 7Windows 7任务栏。The following illustration shows the enhanced features of the Windows 7Windows 7 taskbar.

任务栏项目信息示例Taskbar Item Info Sample
Windows 任务栏增强功能Windows Taskbar Enhanced Features

构造函数

TaskbarItemInfo() TaskbarItemInfo() TaskbarItemInfo() TaskbarItemInfo()

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

字段

DescriptionProperty DescriptionProperty DescriptionProperty DescriptionProperty

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

OverlayProperty OverlayProperty OverlayProperty OverlayProperty

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

ProgressStateProperty ProgressStateProperty ProgressStateProperty ProgressStateProperty

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

ProgressValueProperty ProgressValueProperty ProgressValueProperty ProgressValueProperty

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

ThumbButtonInfosProperty ThumbButtonInfosProperty ThumbButtonInfosProperty ThumbButtonInfosProperty

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

ThumbnailClipMarginProperty ThumbnailClipMarginProperty ThumbnailClipMarginProperty ThumbnailClipMarginProperty

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

属性

CanFreeze CanFreeze CanFreeze CanFreeze

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

(Inherited from Freezable)
DependencyObjectType DependencyObjectType DependencyObjectType DependencyObjectType

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

(Inherited from DependencyObject)
Description Description Description Description

获取或设置任务栏项工具提示的文本。Gets or sets the text for the taskbar item tooltip.

Dispatcher Dispatcher Dispatcher Dispatcher

获取DispatcherDispatcherObject与相关联。Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
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)
Overlay Overlay Overlay Overlay

获取或设置在任务栏按钮中的程序图标上方显示的图像。Gets or sets the image that is displayed over the program icon in the taskbar button.

ProgressState ProgressState ProgressState ProgressState

获取或设置一个值,该值指示在任务栏按钮中显示进度指示器的方式。Gets or sets a value that indicates how the progress indicator is displayed in the taskbar button.

ProgressValue ProgressValue ProgressValue ProgressValue

获取或设置一个值,该值指示任务栏按钮中进度指示器的填满状态。Gets or sets a value that indicates the fullness of the progress indicator in the taskbar button.

ThumbButtonInfos ThumbButtonInfos ThumbButtonInfos ThumbButtonInfos

获取或设置与 ThumbButtonInfo 关联的 Window 对象的集合。Gets or sets the collection of ThumbButtonInfo objects that are associated with the Window.

ThumbnailClipMargin ThumbnailClipMargin ThumbnailClipMargin ThumbnailClipMargin

获取或设置一个值,该值指定在任务栏缩略图中显示的应用程序窗口工作区的部件。Gets or sets a value that specifies the part of the application window's client area that is displayed in the taskbar thumbnail.

方法

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()

在派生类中实现时,将创建的新实例Freezable派生的类。When implemented in a derived class, creates a new instance of the Freezable derived class.

(Inherited from Freezable)
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)
GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator()

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

(Inherited from DependencyObject)
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)
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()

确保Freezable正在从有效线程访问。Ensures 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)
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)
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()

强制执行调用线程可以访问此DispatcherObjectEnforces 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)

适用于