FrameworkElement.SetResourceReference(DependencyProperty, Object) FrameworkElement.SetResourceReference(DependencyProperty, Object) FrameworkElement.SetResourceReference(DependencyProperty, Object) FrameworkElement.SetResourceReference(DependencyProperty, Object) Method

定義

搜尋具有指定名稱的資源,並針對指定的屬性建立該資源的資源參考。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 DependencyProperty DependencyProperty DependencyProperty

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

name
Object Object Object 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).

適用於

另請參閱