0

I currently have a ListView which has has a datatemplate so that it displays all .jpg files in a given folder. Currently I have it set up as a wrap panel and I found that when the jpgs in this folder get large the program slows down. I'm guessing due to the loss of visualization. I have tried using This Example of a Visualizing WrapPanel - The reason this doesn't work for me is because I still get the obscure scroll-bar behavior, even though each item is the same height / width. I was just wondering if there was a better way to implement this. I wouldn't be bothered if I had to fix the amount of columns, e.g. a 3 x 3 displayed at one time.

My current listview looks like this:

 <ListView ItemsSource="{Binding FilteredPhotoFiles}" SelectedItem="{Binding SelectedPhotoVM.SelectedPhoto}">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType={x:Type ScrollContentPresenter}}}"
                            ItemWidth="{Binding (ListView.View).ItemWidth, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
                            MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
                            ItemHeight="{Binding (ListView.View).ItemHeight, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"/>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="2,4,2,4">
                            <Grid.Background>
                                <SolidColorBrush Color="LightGray" Opacity="0.5"/>
                            </Grid.Background>
                            <Image Source="{Binding PhotoFileInfo.FullName}" Width="300" Height="170" />                                
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

I was just wondering if there was a better way of doing this so that I do not lose perfomace, maybe some kind of GridView?

JKennedy
  • 18,150
  • 17
  • 114
  • 198
  • If you are ok with 3 columns per row you could do that with a ListView/GridView. You would need an ItemsSource that has the three columns as properties. – paparazzo Aug 04 '14 at 16:19
  • @user1 - Try the answer from [here](http://stackoverflow.com/a/13560758/632337). – Rohit Vats Aug 04 '14 at 17:06

0 Answers0