ResourceDictionary.AddFactory Method
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.
Overloads
| Name | Description |
|---|---|
| AddFactory(String, Func<Object>, Boolean) |
Adds a resource factory to the dictionary. The factory is invoked lazily when the resource is first accessed. |
| AddFactory(Type, Func<Style>, Boolean) |
Adds an implicit style factory to the dictionary. The factory is invoked lazily when the style is first accessed. |
AddFactory(String, Func<Object>, Boolean)
- Source:
- ResourceDictionary.cs
Adds a resource factory to the dictionary. The factory is invoked lazily when the resource is first accessed.
public void AddFactory(string key, Func<object> factory, bool shared = true);
member this.AddFactory : string * Func<obj> * bool -> unit
Public Sub AddFactory (key As String, factory As Func(Of Object), Optional shared As Boolean = true)
Parameters
- key
- String
The resource key.
- shared
- Boolean
If true (default), the factory result is cached. If false, the factory is invoked on each access.
Applies to
AddFactory(Type, Func<Style>, Boolean)
- Source:
- ResourceDictionary.cs
Adds an implicit style factory to the dictionary. The factory is invoked lazily when the style is first accessed.
public void AddFactory(Type targetType, Func<Microsoft.Maui.Controls.Style> factory, bool shared = true);
member this.AddFactory : Type * Func<Microsoft.Maui.Controls.Style> * bool -> unit
Public Sub AddFactory (targetType As Type, factory As Func(Of Style), Optional shared As Boolean = true)
Parameters
- targetType
- Type
The target type for the implicit style. The type's full name is used as the key.
- shared
- Boolean
If true (default), the factory result is cached. If false, the factory is invoked on each access.