Class TypeExtension
Implements a markup extension that returns a Type based on a string input.
Inheritance
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.dll
Syntax
public class TypeExtension : MarkupExtension
Constructors
TypeExtension()
Initializes a new instance of the TypeExtension class.
Declaration
public TypeExtension()
TypeExtension(String)
Initializes a new instance of the TypeExtension class, initializing the TypeName value based on the provided typeName string.
Declaration
public TypeExtension(string typeName)
Parameters
System.String
typeName
A string that identifies the type to make a reference to. This string uses the format prefix:className. prefix is the mapping prefix for a XAML namespace. |
Remarks
This value is not evaluated when you set it in the constructor. If the value is not null, the value will be initially accepted. The actual parsing and evaluation of the value is deferred until ProvideValue(IServiceProvider) is called on this extension, when XAML is parsed and with available service contexts active. At this time the typeName is expected to be resolvable as a type within a XAML schema context, and that type is returned.
Properties
Type
Gets the type information for this extension.
Declaration
public Type Type { get; }
Property Value
System.Type
|
Remarks
This property will not be reset when ProvideValue(IServiceProvider) is called. If you want the true type represented you should always call ProvideValue(IServiceProvider) rather than check this property.
TypeName
Gets or sets the type name represented by this markup extension.
Declaration
public string TypeName { get; set; }
Property Value
System.String
|
Methods
ProvideValue(IServiceProvider)
Returns an object that should be set on the property where this extension is applied. For TypeExtension, this is the Type value as evaluated for the requested type name.
Declaration
public override object ProvideValue(IServiceProvider serviceProvider)
Parameters
System.IServiceProvider
serviceProvider
Object that can provide services for the markup extension. The provider is expected to provide a service for System.Windows.Markup.IXamlTypeResolver. |
Returns
System.Object
The Type to set on the property where the extension is applied. |
Remarks
This markup extension implementation relies on services based on the passed serviceProvider. It must not be null. The serviceProvider is expected to provide a service for System.Windows.Markup.IXamlTypeResolver.