FrameworkContentElement.SetResourceReference(DependencyProperty, Object) 方法

定義

搜尋具有指定名稱的資源,並針對指定的屬性建立該資源的資源參考。Searches for a resource with the specified name and sets up a resource reference to it for the specified property.

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

參數

dp
DependencyProperty

資源繫結到的屬性。The property to which the resource is bound.

name
Object

資源名稱。The name of the resource.

備註

資源參考類似于在標記中使用DynamicResource 標記延伸A resource reference is similar to the use of a DynamicResource Markup Extension in markup. 資源參考會建立內部運算式,以便在執行時間延遲基礎上提供指定屬性的值。The resource reference creates an internal expression that supplies the value of the specified property on a run-time deferred basis. 每當資源字典透過內部事件表示已變更的值,或每當目前的專案重新重做(父系變更會變更字典查閱路徑)時,將會重新評估運算式。The expression will be re-evaluated whenever the resource dictionary indicates a changed value through internal events, or whenever the current element is reparented (a parent change would change the dictionary lookup path).

適用於

另請參閱