VisualElement.Resources 屬性

定義

取得或設定本機資源字典。

public:
 property Microsoft::Maui::Controls::ResourceDictionary ^ Resources { Microsoft::Maui::Controls::ResourceDictionary ^ get(); void set(Microsoft::Maui::Controls::ResourceDictionary ^ value); };
public Microsoft.Maui.Controls.ResourceDictionary Resources { get; set; }
member this.Resources : Microsoft.Maui.Controls.ResourceDictionary with get, set
Public Property Resources As ResourceDictionary

屬性值

目前的資源字典,其中資源會依索引鍵儲存。

備註

在 XAML 中,資源字典會填入 XAML 中指定的索引鍵/值組,因此會在運行時間建立。 資源字典中的索引鍵會以 x:Key 要建立之型別的 XAML 標籤屬性來指定。 建立該類型的物件,並使用其他屬性或巢狀標記所指定的屬性和域值初始化,這兩者都是屬性或功能變數名稱的字串表示。 然後,物件會插入 至 ResourceDictionary ,以供運行時間使用封入類型。

資源字典及其相關聯的 XML 提供應用程式開發人員方便的方法,以重複使用 XAML 編譯時間和運行時間引擎內的程式碼。

如需詳細資訊,請參閱: Microsoft Learn) (資源字典

適用於