开发者

Thumbnail Control

Hi all i need to design a control that has a thumbnail views of picture.it can take list of pictures.i need it in wpf.is there any pre existed library of control? if no how can i design i have no idea Thanks

was looking something like http://开发者_如何学Pythonwww.codeproject.com/KB/graphics/crystal_image_grid_viewer.aspx?msg=3290254


If you have a list of pictures you can place a panel (StackPanel, WrapPanel, etc., depends on the behaviour you want) inside a ListBox. Set the panel to be the items host, and set the list of pictures as the ItemsSource. Something like this:

<ListBox x:Name="_listBox" >
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapPanel Orientation="Horizontal" IsItemsHost="true" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
</ListBox>

and then in the code behind set _listBox.ItemsSource to your list of pictures.

(or you can have your list of pictures in an ObservableCollection and bind the ListBox to it)

EDIT: as for the thumbnails you can use something like:

BitmapImage Picture = new BitmapImage();
Picture.BeginInit();
Picture.UriSource = ... // your picture
Picture.DecodePixelWidth = ... //how big you want your pic
Picture.EndInit();


do you want to show all the images of the list at the same time? I believe you can use the grid and put a picture control in any cell of the grid, you can start with this approach, post your results and ask more specific questions once you have it at least partly done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜