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)
參數
要設定之相依性屬性的識別項。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. SetCurrentValue方法會變更屬性的有效值,但是現有的觸發程式、資料系結和樣式將繼續運作。The SetCurrentValue method changes the effective value of the property, but existing triggers, data bindings, and styles will continue to work.