ResourceDictionary.MergedDictionaries Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a collection of the ResourceDictionary dictionaries that constitute the various resource dictionaries in the merged dictionaries.
public:
property System::Collections::ObjectModel::Collection<System::Windows::ResourceDictionary ^> ^ MergedDictionaries { System::Collections::ObjectModel::Collection<System::Windows::ResourceDictionary ^> ^ get(); };
public System.Collections.ObjectModel.Collection<System.Windows.ResourceDictionary> MergedDictionaries { get; }
member this.MergedDictionaries : System.Collections.ObjectModel.Collection<System.Windows.ResourceDictionary>
Public ReadOnly Property MergedDictionaries As Collection(Of ResourceDictionary)
Property Value
The collection of merged dictionaries.
Examples
The following example specifies two ResourceDictionary elements to be merged into the primary ResourceDictionary.
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="myresourcedictionary.xaml"/>
<ResourceDictionary Source="myresourcedictionary2.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Page.Resources>
Remarks
Dictionaries are merged by adding a ResourceDictionary to the generic collection referenced by MergedDictionaries. A merged ResourceDictionary does not have resource elements defined within it in markup. Instead, the merged dictionary is a ResourceDictionary with no markup child elements defined (or with no elements added through code), but with a URI specified for Source. The Source designation enables the merged dictionary to come from an external source, such as a separate resource assembly that ships with the application, "loose XAML", or a specific localization or global resources assembly.
Specifying resource elements within a ResourceDictionary that has Source specified is not supported.
Lookup behavior within the MergedDictionaries collection will search the last-added ResourceDictionary first, and the search stops as soon as a requested key is found. Duplicate keys across the collection of merged dictionaries are not illegal. For more information on merged dictionary behavior, see Merged Resource Dictionaries.
XAML Property Element Usage
<object>
<object.MergedDictionaries>
oneOrMoreResourceDictionaries
</object.MergedDictionaries>
</object>
XAML Values
oneOrMoreResourceDictionaries
One or more ResourceDictionary object elements. A ResourceDictionary used for MergedDictionaries does not have collection content, and specifies a Source attribute that references the complete ResourceDictionary remotely.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기