Question

I want to bind a ListBox with images from the media library.

Till now i have done this but it doesn't seem to work :

xaml code:

<ListBox Name="pictureHolder" FlowDirection="LeftToRight" 
                 Width="445" Margin="0,417,12,26"
                 ScrollViewer.HorizontalScrollBarVisibility="Auto"
                 ScrollViewer.VerticalScrollBarVisibility="Disabled">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Image Name="imageFile" Source="{Binding Picture}"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

cs code:

private void bindPictures()
    {
        pictureHolder.ItemsSource = library.Pictures;
    }

What's wrong with the code?? Any help would be appreciated.

Was it helpful?

Solution

try searching msdn its got whole article about it

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top