DependencyObject.SetCurrentValue(DependencyProperty, Object) 方法

定義

設定相依性屬性的值,而不需要變更其值來源。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

要設定之相依性屬性的識別項。The identifier of the dependency property to set.

value
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. @No__t-0 方法會變更屬性的有效值,但是現有的觸發程式、資料系結和樣式將會繼續工作。The SetCurrentValue method changes the effective value of the property, but existing triggers, data bindings, and styles will continue to work.

適用於