Table of Contents

Class IconPresenter

Namespace
Loehnert.Controls
Assembly
Loehnert.Controls.dll

Represents a control to show an icon from an URI (images or .xaml).

public class IconPresenter : Control, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient
Inheritance
IconPresenter
Implements
Inherited Members

Examples

This example shows a XAML icon the IconColor can be set.

<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <Canvas Width="24" Height="24">
        <Path Data="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"
              Width="24"
              Height="24"/>
    </Canvas>
</Viewbox>

Remarks

This controls supports bitmap images (e.g. JPG, BMP), vector images (XAML, SVG), and animated GIF images.

The IconColor can only be set for XAML icons that contain a Viewbox containing a Canvas or Rectangle, see example.

This control also supports animated GIF files. In order not to consume too many resources, the animated GIF should be small.

Fields

ContentProperty

Identifies the Content dependency property.

public static readonly DependencyProperty ContentProperty

Field Value

DependencyProperty

IconColorProperty

Identifies the IconColor dependency property.

public static readonly DependencyProperty IconColorProperty

Field Value

DependencyProperty

UriProperty

Identifies the Uri dependency property.

public static readonly DependencyProperty UriProperty

Field Value

DependencyProperty

UriStringProperty

Identifies the UriString dependency property.

public static readonly DependencyProperty UriStringProperty

Field Value

DependencyProperty

Properties

Content

Gets the data used to generate the child elements (icon) of a IconPresenter.

public object Content { get; }

Property Value

object

IconColor

Gets or sets the color of the icon. This can only be used with XAML icons. The icon must contain a Viewbox. The child of the Viewbox must be a Canvas or Rectangle instance.

public Brush IconColor { get; set; }

Property Value

Brush

Uri

Gets or sets a Uri for the icon.

public Uri Uri { get; set; }

Property Value

Uri

UriString

Gets or sets an Uri as string for the icon.

public string UriString { get; set; }

Property Value

string