WPF In-Memory Image Display

Posted by Aren B on Stack Overflow See other posts from Stack Overflow or by Aren B
Published on 2010-06-10T19:59:44Z Indexed on 2010/06/10 20:02 UTC
Read the original article Hit count: 369

Filed under:
|
|
|

Im trying to build an Item Template for my list-view and im bound to a list of Entities. The entity I have has a System.Drawing.Image that I'd like to display, but so far I cannot for the life of me figure out how to bind it to the <Image> block.

Every example and documentation I can find on the internet pertains to Images accessible via an uri i.e. File on HDD or On Website

    <DataTemplate x:Key="LogoPreviewItem">
        <Border BorderBrush="Black" BorderThickness="1">
            <DockPanel Width="150" Height="100">
                <Image>
                    <Image.Source>
                        <!--
                            {Binding PreviewImage} is where the System.Drawing.Image
                            is in this context
                        -->
                    </Image.Source>
                </Image>
                <Label DockPanel.Dock="Bottom" Content="{Binding CustomerName}" />
            </DockPanel>
        </Border>
    </DataTemplate>

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf