Edit

Share via


ImageExBase Class

Definition

Base Code for ImageEx

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

Constructors

ImageExBase()

Initializes a new instance of the ImageExBase class.

Fields

CachingStrategyProperty

Identifies the CachingStrategy dependency property.

CommonGroup

VisualStates name in template

CornerRadiusProperty

Identifies the CornerRadius dependency property.

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

PartProgress

ProgressRing 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

CachingStrategy

Gets or sets a value indicating how the ImageEx will be cached.

CornerRadius

Gets or sets the CornerRadius for underlying image.

Used to created rounded/circular images.

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.

IsLazyLoadingSupported

Gets a value indicating whether EnableLazyLoading is supported

LazyLoadingThreshold

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

LockObj

Gets object used for lock

PlaceholderSource

Gets or sets the placeholder source.

PlaceholderStretch

Gets or sets the placeholder stretch.

Progress

Gets backing object for the ProgressRing

Source

Gets or sets the source used by the image

Stretch

Gets or sets the stretch behavior of the image

WaitUntilLoaded

Gets a value indicating whether the AlphaMask needs to be retrieved after the element has loaded.

Methods

ArrangeOverride(Size) Windows.UI.Xaml.Controls.Control.ArrangeOverride(Windows.Foundation.Size)
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 Windows.UI.Composition.CompositionBrush

OnApplyTemplate()

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

OnImageFailed(Object, ExceptionRoutedEventArgs)

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

OnImageOpened(Object, RoutedEventArgs)

Underlying Windows.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 Windows.UI.Xaml.Media.Imaging.BitmapImage and the Image control itself. This method should return an Windows.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