title: Minimizing memory consumption listbox of images (WPF)
body: <p>I have listbox which bind to ObservableCollection and take filename to display images
  <img src="https://i.stack.imgur.com/7URQD.jpg" alt="enter image description here"></p>
  
  <p>My xaml is:</p>
  
  <pre><code>&lt;Window x:Class="ThumbnailsView.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="578" WindowStartupLocation="CenterScreen"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="*"/&gt;
              &lt;RowDefinition Height="55"/&gt;
          &lt;/Grid.RowDefinitions&gt;
  
              &lt;ListBox Grid.Row="0" x:Name="ImageListbox"
          ItemsSource="{Binding}" 
          Background="AliceBlue" ScrollViewer.HorizontalScrollBarVisibility="Disabled"&gt;
  
                  &lt;ListBox.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
                              &lt;CheckBox Height="16" VerticalAlignment="Top" Margin="0,10,0,0"/&gt;
                              &lt;Image Margin="10,10,10,0" Height="64" Width="64" VerticalAlignment="Top"&gt;
                                  &lt;Image.Source&gt;
                                      &lt;BitmapImage DecodePixelWidth="64" UriSource="{Binding Path=Name}"/&gt;
                                  &lt;/Image.Source&gt;                            
                              &lt;/Image&gt;
                      &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ListBox.ItemTemplate&gt;
  
          &lt;ListBox.ItemsPanel&gt;
                      &lt;ItemsPanelTemplate&gt;
                          &lt;WrapPanel/&gt;
                      &lt;/ItemsPanelTemplate&gt;
                  &lt;/ListBox.ItemsPanel&gt;
              &lt;/ListBox&gt;
  
              &lt;Button Grid.Row="1" Content="Get Images" Name="getImageBtn" Click="getImageBtn_Click" Width="100" Height="30"&gt;&lt;/Button&gt;
  
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>The problem is, it loads entire images and will consume a lot of ram if I have a large collection. How to minimize its memory consumption ?</p>