DependencyObject.SetCurrentValue(DependencyProperty, Object) DependencyObject.SetCurrentValue(DependencyProperty, Object) DependencyObject.SetCurrentValue(DependencyProperty, Object) DependencyObject.SetCurrentValue(DependencyProperty, Object) Method

定义

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

public:
 void SetCurrentValue(System::Windows::DependencyProperty ^ dp, System::Object ^ value);
public void SetCurrentValue (System.Windows.DependencyProperty dp, object value);
member this.SetCurrentValue : System.Windows.DependencyProperty * obj -> unit
Public Sub SetCurrentValue (dp As DependencyProperty, value As Object)

参数

dp
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

要设置的依赖项属性的标识符。The identifier of the dependency property to set.

value
Object Object Object Object

新的本地值。The new local value.

异常

尝试修改只读依赖项属性,或尝试修改密封 DependencyObject 上的属性。Attempted to modify a read-only dependency property, or a property on a sealed DependencyObject.

value 的类型不是为 dp 属性注册时使用的正确类型。value was not the correct type as registered for the dp property.

注解

此方法由组件使用, 该组件以编程方式设置其自己的属性之一的值, 而无需禁用应用程序声明的属性用法。This method is used by a component that programmatically sets the value of one of its own properties without disabling an application's declared use of the property. SetCurrentValue方法可更改属性的有效值, 但现有触发器、数据绑定和样式将继续工作。The SetCurrentValue method changes the effective value of the property, but existing triggers, data bindings, and styles will continue to work.

适用于