I tried to search, but I could not find the answer to this question: are there any improvements in using ImageBrush to fill the rectangle, and not to create BitmapImage and set its source property?
I have to display a large number of images (we are trying to click more than 5000), and so far I am creating them as follows:
<Image x:Name="img" RenderOptions.BitmapScalingMode="LowQuality" Source="{Binding Path, Converter={StaticResource StringToImageConverter}, ConverterParameter={StaticResource string}}" > </ext:IdImage>
and in the converter:
System.Windows.Media.Imaging.BitmapImage image = new System.Windows.Media.Imaging.BitmapImage(); image.BeginInit(); image.UriSource = new Uri(value as String); image.DecodePixelWidth = int.Parse((String)parameter); image.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; image.EndInit(); return image;
Note. I need to use a converter to set the DecodePixelWidth property.
Using ImageBrush, I could freeze the brush this way, according to what I read, increasing performance, so I was wondering if I should change the way I create images.
PS Images are not static, but translated.
source share