5 instantiations of ResourceDictionary
Microsoft.Maui.Controls (4)
Application\Application.cs (1)
153
_resources = new
ResourceDictionary
();
Shell\BaseShellItem.cs (2)
363
grid.Resources = new
ResourceDictionary
();
556
grid.Resources = new
ResourceDictionary
() { defaultGridClass, defaultLabelClass, defaultImageClass };
VisualElement\VisualElement.cs (1)
1076
_resources = new
ResourceDictionary
();
Microsoft.Maui.Controls.Xaml (1)
ResourceDictionaryHelpers.cs (1)
51
var rd = new
ResourceDictionary
();
78 references to ResourceDictionary
Microsoft.Maui.Controls (34)
Application\Application.cs (2)
142
ResourceDictionary
? _resources;
146
public
ResourceDictionary
Resources
IResourcesProvider.cs (1)
7
ResourceDictionary
Resources { get; set; }
ResourceDictionary.cs (28)
22
static ConditionalWeakTable<Type,
ResourceDictionary
> s_instances = new ConditionalWeakTable<Type,
ResourceDictionary
>();
24
ResourceDictionary
_mergedInstance;
28
internal static Action<
ResourceDictionary
, Uri, string, Assembly, System.Xml.IXmlLineInfo> s_setAndLoadSource;
47
where T :
ResourceDictionary
, new()
49
var
instance = s_instances.GetValue(typeof(T), static _ => new T());
67
internal static
ResourceDictionary
GetOrCreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type type)
69
return s_instances.GetValue(type, _ => (
ResourceDictionary
)Activator.CreateInstance(type));
72
internal void SetSource(Uri source,
ResourceDictionary
sourceInstance)
79
ObservableCollection<
ResourceDictionary
> _mergedDictionaries;
81
public ICollection<
ResourceDictionary
> MergedDictionaries
87
var col = new ObservableCollection<
ResourceDictionary
>();
106
IList<
ResourceDictionary
> _collectionTrack;
114
_collectionTrack = _collectionTrack ?? new List<
ResourceDictionary
>();
118
foreach (
var
dictionary in _collectionTrack)
130
var
rd = (
ResourceDictionary
)item;
142
var
rd = (
ResourceDictionary
)item;
222
var dictionaries = (ObservableCollection<
ResourceDictionary
>)MergedDictionaries;
292
ResourceDictionary
r = _mergedDictionaries[i];
310
internal bool TryGetValueAndSource(string key, out object value, out
ResourceDictionary
source)
318
bool TryGetMergedDictionaryValue(string key, out object value, out
ResourceDictionary
source)
320
var dictionaries = (ObservableCollection<
ResourceDictionary
>)MergedDictionaries;
323
var
dictionary = dictionaries[i];
359
public void Add(
ResourceDictionary
mergedResourceDictionary)
393
internal static void ClearCache() => s_instances = new ConditionalWeakTable<Type,
ResourceDictionary
>();
409
if (!((serviceProvider.GetService(typeof(Xaml.IProvideValueTarget)) as Xaml.IProvideValueTarget)?.TargetObject is
ResourceDictionary
targetRD))
VisualElement\VisualElement.cs (3)
1059
ResourceDictionary
_resources;
1066
/// <para>In XAML, resource dictionaries are filled with key/value pairs that are specified in XAML and consequently created at runtime. The keys in the resource dictionary are specified with the <c>x:Key</c> attribute of the XAML tag for the type to create. An object of that type is created, and is initialized with the property and field values that are specified either by additional attributes or by nested tags, both of which, when present, are simply string representations of the property or field names. The object is then inserted into the <see cref="
ResourceDictionary
" /> for the enclosing type at runtime.</para>
1070
public
ResourceDictionary
Resources
Microsoft.Maui.Controls.Build.Tasks (2)
CompiledConverters\RDSourceTypeConverter.cs (1)
45
var resourcePath =
ResourceDictionary
.RDSourceTypeConverter.GetResourcePath(uri, rootTargetPath);
CompiledValueProviders\StyleSheetProvider.cs (1)
58
var resourcePath =
ResourceDictionary
.RDSourceTypeConverter.GetResourcePath(uri, rootTargetPath);
Microsoft.Maui.Controls.Xaml (42)
ApplyPropertiesVisitor.cs (8)
47
public bool IsResourceDictionary(ElementNode node) => Context.Types.TryGetValue(node, out var type) && typeof(
ResourceDictionary
).IsAssignableFrom(type);
148
&& TryAddToResourceDictionary(source as
ResourceDictionary
, value, xKey, node, out xpe))
212
if (xpe == null && TryAddToResourceDictionary(collection as
ResourceDictionary
, value, xKey, node, out xpe))
352
if (xamlelement is
ResourceDictionary
rd && propertyName.LocalName == "Source" && propertyName.NamespaceURI == "")
738
if (exception == null && TryAddToResourceDictionary(collection as
ResourceDictionary
, value, xKey, lineInfo, out exception))
762
static bool TryAddToResourceDictionary(
ResourceDictionary
resourceDictionary, object value, string xKey, IXmlLineInfo lineInfo, out Exception exception)
773
else if (value is
ResourceDictionary
)
774
resourceDictionary.Add((
ResourceDictionary
)value);
CreateValuesVisitor.cs (1)
36
public bool IsResourceDictionary(ElementNode node) => typeof(
ResourceDictionary
).IsAssignableFrom(Context.Types[node]);
Diagnostics\ResourceDictionaryDiagnostics.cs (1)
6
internal static void OnStaticResourceResolved(
ResourceDictionary
resourceDictionary, string key, object targetObject, object targetProperty)
Diagnostics\StaticResourceResolvedEventArgs.cs (2)
6
internal StaticResourceResolvedEventArgs(
ResourceDictionary
resourceDictionary, string key, object targetObject, object targetProperty)
14
public
ResourceDictionary
ResourceDictionary { get; }
FillResourceDictionariesVisitor.cs (8)
26
public bool IsResourceDictionary(ElementNode node) => typeof(
ResourceDictionary
).IsAssignableFrom(Context.Types[node]);
30
if (!Context.Types.TryGetValue((IElementNode)parentNode, out var type) || !typeof(
ResourceDictionary
).IsAssignableFrom(type))
46
if (typeof(
ResourceDictionary
).IsAssignableFrom(Context.Types[node]) && node.TryGetPropertyName(parentNode, out XmlName propertyName))
49
propertyName.LocalName.EndsWith(".Resources", StringComparison.Ordinal)) && value is
ResourceDictionary
)
60
&& typeof(
ResourceDictionary
).IsAssignableFrom(parentType)
64
&& typeof(
ResourceDictionary
).IsAssignableFrom(Context.Types[((IElementNode)parentNode.Parent)])
83
&& typeof(
ResourceDictionary
).IsAssignableFrom(parentType)
87
&& typeof(
ResourceDictionary
).IsAssignableFrom(Context.Types[((IElementNode)parentNode.Parent)])
MarkupExtensions\StaticResourceExtension.cs (5)
24
if (!TryGetResource(Key, valueProvider.ParentObjects, out var resource, out
var
resourceDictionary)
55
static bool TryGetResource(string key, IEnumerable<object> parentObjects, out object resource, out
ResourceDictionary
resourceDictionary)
62
var
resDict = p is IResourcesProvider irp && irp.IsResourcesCreated ? irp.Resources : p as
ResourceDictionary
;
71
static bool TryGetApplicationLevelResource(string key, out object resource, out
ResourceDictionary
resourceDictionary)
MarkupExtensions\StyleSheetExtension.cs (1)
36
var resourcePath =
ResourceDictionary
.RDSourceTypeConverter.GetResourcePath(Source, rootTargetPath);
RegisterXNamesVisitor.cs (1)
22
public bool IsResourceDictionary(ElementNode node) => typeof(
ResourceDictionary
).IsAssignableFrom(Context.Types[node]);
ResourceDictionaryHelpers.cs (12)
20
public static void LoadFromSource(
ResourceDictionary
rd, Uri source, string resourcePath, Assembly assembly, IXmlLineInfo lineInfo)
22
var
sourceInstance = CreateFromResource(resourcePath, assembly, lineInfo);
27
internal static void LoadFromSource(
ResourceDictionary
rd, string value, Type rootType, IXmlLineInfo lineInfo)
29
(value, var assembly) =
ResourceDictionary
.RDSourceTypeConverter.SplitUriAndAssembly(value, rootType.Assembly);
32
var resourcePath =
ResourceDictionary
.RDSourceTypeConverter.GetResourcePath(new Uri(value, UriKind.Relative), rootTargetPath);
33
var sourceUri =
ResourceDictionary
.RDSourceTypeConverter.CombineUriAndAssembly(value, assembly);
39
internal static void SetAndLoadSource(
ResourceDictionary
rd, Uri value, string resourcePath, Assembly assembly, IXmlLineInfo lineInfo)
42
var
sourceInstance = type is not null
43
?
ResourceDictionary
.GetOrCreateInstance(type)
49
static
ResourceDictionary
CreateFromResource(string resourcePath, Assembly assembly, IXmlLineInfo lineInfo)
51
var
rd = new ResourceDictionary();
96
ResourceDictionary
.s_setAndLoadSource = ResourceDictionaryHelpers.SetAndLoadSource;
XamlLoader.cs (3)
173
if (resources is ElementNode resourcesEN && (resourcesEN.XmlType.NamespaceUri != XamlParser.MauiUri || resourcesEN.XmlType.Name != nameof(
ResourceDictionary
)))
175
resources = new ElementNode(new XmlType(XamlParser.MauiUri, nameof(
ResourceDictionary
), null), XamlParser.MauiUri, rootNode.NamespaceResolver);
180
resources = new ElementNode(new XmlType(XamlParser.MauiUri, nameof(
ResourceDictionary
), null), XamlParser.MauiUri, rootNode.NamespaceResolver);