Edit

Share via


ImageExBase Class

Definition

Base Code for ImageEx

[Microsoft.UI.Xaml.TemplatePart(Name="Image", Type=typeof(System.Object))]
[Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Loading")]
[Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Loaded")]
[Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Unloaded")]
[Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Failed")]
public abstract class ImageExBase : Microsoft.UI.Xaml.Controls.Control
[<Microsoft.UI.Xaml.TemplatePart(Name="Image", Type=typeof(System.Object))>]
[<Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Loading")>]
[<Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Loaded")>]
[<Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Unloaded")>]
[<Microsoft.UI.Xaml.TemplateVisualState(GroupName="CommonStates", Name="Failed")>]
type ImageExBase = class
    inherit Control
Public MustInherit Class ImageExBase
Inherits Control
Inheritance
Microsoft.UI.Xaml.Controls.Control
ImageExBase
Derived
Attributes
Microsoft.UI.Xaml.TemplatePartAttribute Microsoft.UI.Xaml.TemplateVisualStateAttribute

Constructors

ImageExBase()

Initializes a new instance of the ImageExBase class.

Fields

CommonGroup

VisualStates name in template

DecodePixelHeightProperty

Identifies the DecodePixelHeight dependency property.

DecodePixelTypeProperty

Identifies the DecodePixelType dependency property.

DecodePixelWidthProperty

Identifies the DecodePixelWidth dependency property.

EnableLazyLoadingProperty

Identifies the EnableLazyLoading dependency property.

FailedState

Failed name in template

IsCacheEnabledProperty

Identifies the IsCacheEnabled dependency property.

LazyLoadingThresholdProperty

Identifies the LazyLoadingThreshold dependency property.

LoadedState

Loaded state name in template

LoadingState

Loading state name in template

PartImage

Image name in template

PlaceholderSourceProperty

Identifies the PlaceholderSource dependency property.

PlaceholderStretchProperty

Identifies the PlaceholderStretch dependency property.

SourceProperty

Identifies the Source dependency property.

StretchProperty

Identifies the Stretch dependency property.

UnloadedState

Unloaded state name in template

Properties

DecodePixelHeight

Gets or sets DecodePixelHeight for underlying bitmap

DecodePixelType

Gets or sets DecodePixelType for underlying bitmap

DecodePixelWidth

Gets or sets DecodePixelWidth for underlying bitmap

EnableLazyLoading

Gets or sets a value indicating whether gets or sets is lazy loading enable. (17763 or higher supported)

Image

Gets the backing image object

IsCacheEnabled

Gets or sets a value indicating whether gets or sets cache state

IsInitialized

Gets a value indicating whether control has been initialized.

LazyLoadingThreshold

Gets or sets a value indicating the threshold for triggering lazy loading.

PlaceholderSource

Gets or sets the placeholder source.

PlaceholderStretch

Gets or sets the placeholder stretch.

Source

Gets or sets the source used by the image

Stretch

Gets or sets the stretch behavior of the image

Methods

AttachImageFailed(ExceptionRoutedEventHandler)

Attach image failed event handler

AttachImageOpened(RoutedEventHandler)

Attach image opened event handler

GetAlphaMask()

Returns a mask that represents the alpha channel of an image as a Microsoft.UI.Composition.CompositionBrush

OnApplyTemplate()

Update the visual state of the control when its template is changed.

OnImageFailed(Object, ExceptionRoutedEventArgs)

Underlying Microsoft.UI.Xaml.Controls.Image.ImageFailed event handler.

OnImageOpened(Object, RoutedEventArgs)

Underlying Microsoft.UI.Xaml.Controls.Image.ImageOpened event handler.

OnPlaceholderSourceChanged(DependencyPropertyChangedEventArgs)

Invoked when Placeholder source has changed

ProvideCachedResourceAsync(Uri, CancellationToken)

This method is provided in case a developer would like their own custom caching strategy for ImageExBase. By default it uses the built-in UWP cache provided by Microsoft.UI.Xaml.Media.Imaging.BitmapImage and the Image control itself. This method should return an Microsoft.UI.Xaml.Media.ImageSource value of the image specified by the provided uri parameter. A CancellationToken is provided in case the current request is invalidated (e.g. the container is recycled before the original image is loaded). The Toolkit also has an image cache helper which can be used as well: GetFromCacheAsync(Uri, Boolean, CancellationToken, List<KeyValuePair<String,Object>>) in ImageCache.

RemoveImageFailed(ExceptionRoutedEventHandler)

Remove Image Failed handler

RemoveImageOpened(RoutedEventHandler)

Remove image opened handler

Events

ImageExFailed

Event raised if the image failed loading.

ImageExInitialized

Event raised when the control is initialized.

ImageExOpened

Event raised when the image is successfully loaded and opened.

Applies to