CustomXamlResourceLoader class

0 out of 1 rated this helpful - Rate this topic

Enables loading of custom resource dictionaries as sources. Override GetResource to provide the logic that a XAML parser can use to look up the necessary resources at load time.

Inheritance

Object
  CustomXamlResourceLoader

Syntax


public class CustomXamlResourceLoader : Object

Attributes

MarshalingBehaviorAttribute(Agile)
StaticAttribute(Windows.UI.Xaml.Resources.ICustomXamlResourceLoaderStatics, NTDDI_WIN8)
ThreadingAttribute(Both)
VersionAttribute(NTDDI_WIN8)
WebHostHiddenAttribute()

Members

The CustomXamlResourceLoader class has these types of members:

Constructors

The CustomXamlResourceLoader class has these constructors.

ConstructorDescription
CustomXamlResourceLoader Initializes a new instance of the CustomXamlResourceLoader class.

 

Methods

The CustomXamlResourceLoader class has these methods. It also inherits methods from the Object class.

MethodDescription
GetResource When overridden in a derived class, specifies the logic of resource lookup for this CustomXamlResourceLoader. Given a resource ID and some type information about the expected result, returns the requested resource.

 

Properties

The CustomXamlResourceLoader class has these properties.

PropertyAccess typeDescription

Current

Read/writeReturns the active CustomXamlResourceLoader instance.

 

Remarks

CustomXamlResourceLoader supports a markup extension usage {CustomResource}. This markup extension is unique to the Windows Runtime XAML framework (it did not exist in precursor XAML technologies such as Windows Presentation Foundation (WPF) and Microsoft Silverlight.)

CustomResource can be used from XAML in a similar way to StaticResource, which performs built-in resource lookup from various ResourceDictionary locations. The difference is that the app itself implements the resource lookup logic for a CustomResource usage by supplying a custom resource loader. To implement the custom resource loader, the application must provide a class that derives from CustomXamlResourceLoader and override the GetResource method. The app must register its custom resource loader by setting the static property CustomXamlResourceLoader.Current to an instance of its custom resource loader class. This registration must be done on a XAML UI thread before any parsing of XAML that uses CustomResource. If the application uses multiple UI threads, a separate registration must be done on each.

The way in which the CustomXamlResourceLoader stores its resources is probably not related to ResourceDictionary at all. Typically, in addition to the required overrides, your CustomXamlResourceLoader class would provide internal or public methods that enable storing, keying and otherwise working with the resource items in an underlying collection.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Namespace

Windows.UI.Xaml.Resources
Windows::UI::Xaml::Resources [C++]

Metadata

Windows.winmd

See also

StaticResource
ResourceDictionary and StaticResource references

 

 

Build date: 12/4/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.