ImageIconSource Klasse

Definition

Stellt eine Symbolquelle dar, die einen Bildtyp als Inhalt verwendet. Die derzeit unterstützten Bildtypen sind .bmp, .gif, .jpg, .png, WDP und TIFF.

Diese Dokumentation gilt für WinUI 2 für UWP (für WinUI im Windows App SDK siehe Windows App SDK Namespaces).

/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodName(value="OnPropertyChanged")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ImageIconSource : IconSource
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodName(value="OnPropertyChanged")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class ImageIconSource : IconSource
Public Class ImageIconSource
Inherits IconSource
Vererbung
ImageIconSource
Attribute
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodNameAttribute ContractVersionAttribute MarshalingBehaviorAttribute ThreadingAttribute

Beispiele

Tipp

Weitere Informationen, Entwurfsanleitungen und Codebeispiele finden Sie unter Symbole für Windows-Apps.

Die WinUI 3-Katalog- und WinUI 2-Katalog-Apps umfassen interaktive Beispiele für die meisten WinUI 3- und WinUI 2-Steuerelemente, -Features und -Funktionen.

Wenn sie bereits installiert sind, öffnen Sie sie, indem Sie auf die folgenden Links klicken: WinUI 3-Katalog oder WinUI 2-Katalog.

Wenn sie nicht installiert sind, können Sie den WinUI 3-Katalog und den WinUI 2-Katalog aus dem Microsoft Store herunterladen.

Sie können auch den Quellcode für beide von GitHub abrufen (verwenden Sie denmain-Branch für WinUI 3 und den Branchwinui2 für WinUI 2).

Das folgende Beispiel zeigt ein AppBarButton-Element mit einer ImageIconSource.The following example shows an AppBarButton with an ImageIconSource. ImageSource gibt ein Bild an, das im App-Paket enthalten ist.

<!--
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
-->

<AppBarButton >
    <AppBarButton.Icon>
        <IconSourceElement>
            <muxc:ImageIconSource ImageSource="ms-appx:///Assets/globe.png"/>
        </IconSourceElement>
    </AppBarButton.Icon>
</AppBarButton>

Hier wird gezeigt, wie Sie eine ImageIconSource aus einem Bitmapdatenstrom laden.

// using muxc = Microsoft.UI.Xaml.Controls;

var bitmapSource = new BitmapSource();
await bitmapSource.SetSourceAsync(bitmapStream);
var icon = new muxc.ImageIconSource() { ImageSource = bitmapSource };

Hinweise

ImageIconSource ähnelt ImageIcon. Da es sich jedoch nicht um ein FrameworkElement handelt, kann es freigegeben werden.

Konstruktoren

ImageIconSource()

Initialisiert eine neue Instanz der ImageIconSource-Klasse.

Diese Dokumentation gilt für WinUI 2 für UWP (für WinUI im Windows App SDK siehe Windows App SDK Namespaces).

Eigenschaften

Foreground

Ruft einen Pinsel ab, der die Vordergrundfarbe des Steuerelements zeichnet, oder legt diesen fest.

Diese Dokumentation gilt für WinUI 2 für UWP (für WinUI im Windows App SDK siehe Windows App SDK Namespaces).

(Geerbt von IconSource)
ImageSource

Ruft den URI der Bilddatei ab, die als Symbolquelle verwendet werden soll, oder legt diesen fest.

Diese Dokumentation gilt für WinUI 2 für UWP (für WinUI im Windows App SDK siehe Windows App SDK Namespaces).

ImageSourceProperty

Bezeichnet die ImageSource-Abhängigkeitseigenschaft.

Diese Dokumentation gilt für WinUI 2 für UWP (für WinUI im Windows App SDK siehe Windows App SDK Namespaces).

Methoden

CreateIconElement()

Erstellt ein IconSource-UI-Element .

Diese Dokumentation gilt für WinUI 2 für UWP (für WinUI im Windows App SDK siehe Windows App SDK Namespaces).

(Geerbt von IconSource)

Gilt für:

Weitere Informationen