Skip to main content
A newer version of this page is available. .

DXImageHelper.GetImageSource(String) Method

Retrieves the specified image from the image library. This method allows you to display only the raster images.

Namespace: DevExpress.Xpf.Core

Assembly: DevExpress.Xpf.Core.v21.2.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public static ImageSource GetImageSource(
    string path
)

Parameters

Name Type Description
path String

The full path to the raster image in the image library.

Returns

Type Description
ImageSource

A ImageSource object that is the retrieved raster image.

Remarks

Use the DevExpress Image Picker tool to see images included in the DevExpress.Images.v21.2 assembly and copy their paths to the clipboard.

The following code sample uses the DXImageHelper.GetImageSource method to obtain a raster image from the DevExpress.Images.v21.2 assembly:

<dx:ThemedWindow ...
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30px"/>
            <RowDefinition Height="32px"/>
        </Grid.RowDefinitions>
        <Button Content="Display Image" Click="Button_Click" Width="150" Grid.Row="0"/>
        <Image x:Name="pngImage" Height="32px" Grid.Row="1"/>
    </Grid>
</dx:ThemedWindow>
using DevExpress.Xpf.Core;
using DevExpress.Utils.Design;
// ...
private void Button_Click(object sender, RoutedEventArgs e) {
    pngImage.Source = DXImageHelper.GetImageSource(@"Images/Actions/Close_32x32.png");
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetImageSource(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also