public ClearValue ( |
||
dp | ||
return | void |
TextBox textBox = new TextBox(); textBox.Text = "Hello"; textBox.ClearValue(TextBox.TextProperty);
public static readonly DependencyProperty MyProperty= DependencyProperty.RegisterAttached("MyProperty", typeof(string), typeof(MyClass)); public static string GetMyProperty(DependencyObject obj) { return (string)obj.GetValue(MyProperty); } public static void SetMyProperty(DependencyObject obj, string value) { obj.SetValue(MyProperty, value); } public static void ClearMyProperty(DependencyObject obj) { obj.ClearValue(MyProperty); }This example shows how to define a custom attached property and then remove its value using ClearValue method. The package library for this functionality should be WindowsBase.dll.