Dela via


SettingsFlyout.IconSource Property

Definition

Gets or sets the icon image displayed in the SettingsFlyout header.

public:
 property ImageSource ^ IconSource { ImageSource ^ get(); void set(ImageSource ^ value); };
ImageSource IconSource();

void IconSource(ImageSource value);
public ImageSource IconSource { get; set; }
var imageSource = settingsFlyout.iconSource;
settingsFlyout.iconSource = imageSource;
Public Property IconSource As ImageSource
<SettingsFlyout IconSource="uri"/>

Property Value

The icon image displayed in the SettingsFlyout header area, typically to the right of the Title. The default is null, which results in no displayed image.

Remarks

Note

Even though the default property value is null, the Microsoft Visual Studio Settings Flyout item template sets the IconSource to your app’s small logo (IconSource="Assets/SmallLogo.png").

The IconSource property is typically set in XAML to take advantage of the built-in conversion from string.

If you do set the IconSource property in code, you can use a BitmapImage object, constructed with the Uniform Resource Identifier (URI) that describes the path to a valid image source file. You can also initialize a BitmapSource with a stream, perhaps a stream from a storage file, but that's not typical for a SettingsFlyout UI scenario.

Setting IconSource in XAML

If you set the IconSource property as an attribute in XAML, you are setting the IconSource property using a Uniform Resource Identifier (URI). This behavior relies on underlying type conversion that processes the string as a Uniform Resource Identifier (URI), and calls the equivalent of the BitmapImage(Uri) constructor. The XAML parser interprets any strings that represent a relative Uniform Resource Identifier (URI), using the base Uniform Resource Identifier (URI) of the XAML page that is being parsed. For example, if you specify a value "Images/myimage.png" in XAML, that string is interpreted as a relative path suffix that is appended to the base Uniform Resource Identifier (URI) location within the app package where the XAML page itself exists.

<SettingsFlyout Width="346" IconSource="Images/myimage.png" />

A property element syntax in XAML is also possible, specifying a BitmapImage object element with valid source as the property value.

Applies to

See also