Bind ListBox to List<Image>

Posted by Pyush on Stack Overflow See other posts from Stack Overflow or by Pyush
Published on 2010-05-29T03:18:10Z Indexed on 2010/05/29 3:22 UTC
Read the original article Hit count: 208

Filed under:

I need to bind a List of Images to a list box. My code being:

        <ListBox x:Name="lstImages">
            <ListBox.ItemTemplate>
                <DataTemplate DataType="{x:Type Image}">
                    <StackPanel>
                        <Image Source="{Binding Path=UnassignedImages}"></Image>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

Code behind:

lstImages.ItemsSource = this.audit.UnassignedImages;

Where UnassignedImages being List

I tried using both lstImages.ItemsSource & lstImages.DataContent, but none works.

Thanks.

© Stack Overflow or respective owner

Related posts about wpf-binding