ImageTemplateSelector Class
Chooses a DataTemplate for an image based on the data object and the data-bound element.
public class ImageTemplateSelector : DataTemplateSelector
- Inheritance:
- object DataTemplateSelector object
Constructors
ImageTemplateSelector()
Initializes an instance of the class.
public ImageTemplateSelector()
Properties
AllowStringGeometry
Gets or sets if properly-formatted string
data can be parsed as a Geometry.
public bool AllowStringGeometry { get; set; }
Property Value
- bool:
true
to allow properly-formattedstring
data to be parsed as a Geometry; otherwise,false
. The default value is defined by the static DefaultAllowStringGeometry property.
Remarks
When true
, any string data that is not recognized as a Geometry may show a FormatException
in debugger output.
AllowStringUri
Gets or sets if properly-formatted string
data can be parsed as a System.Uri.
public bool AllowStringUri { get; set; }
Property Value
- bool:
true
to allow properly-formattedstring
data to be parsed as a System.Uri; otherwise,false
. The default value is defined by the static DefaultAllowStringUri property.
DefaultAllowStringGeometry
Gets or sets the default value of AllowStringGeometry for new class instances.
public static bool DefaultAllowStringGeometry { get; set; }
Property Value
- bool:
The default value is
true
.
Remarks
Any change in the default value must be made before any resources are loaded that use this type of selector.
DefaultAllowStringUri
Gets or sets the default value of AllowStringUri for new class instances.
public static bool DefaultAllowStringUri { get; set; }
Property Value
- bool:
The default value is
true
.
Remarks
Any change in the default value must be made before any resources are loaded that use this type of selector.
DefaultTemplate
Gets or sets the default DataTemplate to use for null
data.
public DataTemplate? DefaultTemplate { get; set; }
Property Value
- DataTemplate:
The default DataTemplate to use for
null
data.
GeometryTemplate
Gets or sets the DataTemplate to use for Geometry data.
public DataTemplate? GeometryTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for Geometry data.
ImageSourceTemplate
Gets or sets the DataTemplate to use for ImageSource or System.Uri data.
public DataTemplate? ImageSourceTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for ImageSource or System.Uri data.
Methods
ResolveStringDataTemplate(string, DependencyObject)
Gets the DataTemplate to be used for string
data.
protected virtual DataTemplate? ResolveStringDataTemplate(string data, DependencyObject container)
Parameter | Type | Description |
---|---|---|
data | string | The string data to examine. |
container | DependencyObject | The data-bound element. |
Returns
- DataTemplate:
The DataTemplate to use, or
null
if a template is not defined.
SelectTemplate(object, DependencyObject)
Returns a DataTemplate based on custom logic.
public override DataTemplate? SelectTemplate(object item, DependencyObject container)
Parameter | Type | Description |
---|---|---|
item | object | The data object. |
container | DependencyObject | The data-bound element. |
Returns
- DataTemplate:
The DataTemplate to use, or
null
if a template is not defined.