Class StaticExtension
Implements a markup extension that returns static field and property references.
Implements
Inherited Members
Namespace: System.Windows.Markup
Assembly: OpenSilver.dll
Syntax
[TypeConverter(typeof(StaticExtensionConverter))]
public class StaticExtension : MarkupExtension, IMarkupExtension<object>
Constructors
| Improve this Doc View SourceStaticExtension()
Initializes a new instance of the StaticExtension class.
Declaration
public StaticExtension()
StaticExtension(String)
Initializes a new instance of the StaticExtension class using the provided member string.
Declaration
public StaticExtension(string member)
Parameters
Type | Name | Description |
---|---|---|
System.String | member | A string that identifies the member to make a reference to. This string uses the format prefix:typeName.fieldOrPropertyName. prefix is the mapping prefix for a XAML namespace, and is only required to reference static values that are not mapped to the default XAML namespace. |
Properties
| Improve this Doc View SourceMember
Gets or sets a member name string that is used to resolve a static field or property based on the service-provided type resolver.
Declaration
public string Member { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string that identifies the member to make a reference to. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Attempted to set Member to null. |
MemberType
Gets or sets the System.Type that defines the static member to return.
Declaration
public Type MemberType { get; set; }
Property Value
Type | Description |
---|---|
System.Type | The System.Type that defines the static member to return. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Attempted to set MemberType to null. |
Methods
| Improve this Doc View SourceProvideValue(IServiceProvider)
Returns an object value to set on the property where you apply this extension. For StaticExtension, the return value is the static value that is evaluated for the requested static member.
Declaration
public override object ProvideValue(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | serviceProvider | An object that can provide services for the markup extension. The service provider is expected to provide a service that implements a type resolver (IXamlTypeResolver). |
Returns
Type | Description |
---|---|
System.Object | The static value to set on the property where the extension is applied. |
Overrides
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The member value for the extension is null at the time of evaluation. |
System.ArgumentException | Some part of the member string did not parse properly -or- serviceProvider did not provide a service for IXamlTypeResolver -or- member value did not resolve to a static member. |
System.ArgumentNullException | serviceProvider is null. |