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.

適用於