Ce sujet n'a pas encore été évalué - Évaluez ce sujet

Freezable.CanFreeze, propriété

Gets a value that indicates whether this object can be made unmodifiable.

Espace de noms: System.Windows
Assembly : WindowsBase (dans windowsbase.dll)
Espace de noms XML :  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public bool CanFreeze { get; }
/** @property */
public boolean get_CanFreeze ()

public function get CanFreeze () : boolean

Vous ne pouvez pas utiliser cette propriété dans XAML.

Valeur de la propriété

true if the current object can be made unmodifiable or is already unmodifiable; otherwise, false.

Remarques à l'attention des implémenteurs : This method implementation uses FreezeCore with isChecking set to true to determine whether a Freezable can be made unmodifiable. To modify the way this property behaves in a derived class, override the FreezeCore method.

This example shows how to make a Freezable read-only by calling its Freeze method.

You cannot freeze a Freezable object if any one of the following conditions is true about the object:

  • It has animated or data bound properties.

  • It has properties that are set by a dynamic resource. For more information about dynamic resources, see the Resources Overview.

  • It contains Freezable sub-objects that cannot be frozen.

If these conditions are false for your Freezable object and you do not intend to modify it, consider freezing it to gain performance benefits.

The following example freezes a SolidColorBrush, which is a type of Freezable object.

Button myButton = new Button();
SolidColorBrush myBrush = new SolidColorBrush(Colors.Yellow);          

if (myBrush.CanFreeze)
{
    // Makes the brush unmodifiable.
    myBrush.Freeze();
}

myButton.Background = myBrush;  

For more information about Freezable objects, see the Freezable Objects Overview.

Microsoft .NET Framework 3.0 est pris en charge sur Windows Vista, Microsoft Windows XP SP2 et Windows Server 2003 SP1.

.NET Framework

Prise en charge dans : 3.0
Cela vous a-t-il été utile ?
(1500 caractères restants)

Ajouts de la communauté

AJOUTER
© 2013 Microsoft. Tous droits réservés.