[This documentation is preliminary and is subject to change.]
Sets the local value of a dependency property on a DependencyObject.
Syntax
Parameters
- dp
-
Type: DependencyProperty
The identifier of the dependency property to set.
- value
-
Type: System.Object [.NET] | Platform::Object [C++]
The new local value.
Examples
This example shows a simple dependency property declaration. A call to SetValue constitutes the entirety of the set accessor implementation for the property wrapper of the new dependency property. For more examples, see Custom dependency properties.
public class Fish : Control { public static readonly DependencyProperty SpeciesProperty = DependencyProperty.Register( "Species", typeof(String), typeof(Fish), null ); public string Species { get { return (string)GetValue(SpeciesProperty); } set { SetValue(SpeciesProperty, (string)value); } } }
Requirements
|
Minimum supported client | Windows 8 Release Preview |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
- DependencyObject
- Custom dependency properties
- Dependency properties overview
- XAML user and custom controls sample
Build date: 5/22/2012
