0

I have made a calendar control based on the pivot control. Every pivot item represents one month. In this way I don't have the annoying arrows, which usually everybody use to switch between the months and I really love the native way you can browse the calendar. The calendar itself is pretty fancy and in each cell for every day, I have several images. The problem is that the performance is awful. Initially I have bound the images visibility property with a bool property(using a converter), but I have read that the visibility binding isn't good, cause it redraws the UI elements again. Then I have decided to bind the Opacity property of the images with the same bool property from my ViewModel. The performance got better, but it is still slow. So, basically, I have a calendar with cells and 3-4 images in each cell. I am setting each image's visibility/opacity using binding, but in both ways the performance is very bad.

So, basically in each calendar cell I have 5 x this image:

<Image Source="../Images/blabla.png" IsHitTestVisible="False"
                                    Opacity="{Binding IsBlaBla, Converter={StaticResource BoolToOpacityConverter}}" />

Have you guys have an idea how I can improve the performance? I am out of ideas. :-(

Matt Lacey
  • 65,560
  • 11
  • 91
  • 143
Tech0
  • 253
  • 3
  • 16

2 Answers2

2

You could try setting the CacheMode to BitmapCache. See my answer to another question, it contains details of the BitmapCache option.

<Image Source="../Images/blabla.png" 
       IsHitTestVisible="False"
       Opacity="{Binding IsBlaBla, Converter={StaticResource BoolToOpacityConverter}}"
       CacheMode="BitmapCache" />

I also remember reading somewhere that the jpeg decoder is a lot faster than the png decoder. So, unless you need transparency, you could convert your images to jpeg.

Community
  • 1
  • 1
Praetorian
  • 106,671
  • 19
  • 240
  • 328
1

Assuming your performance issue is one of the UI being slow to interact with, you might consider using David Anson's LowProfileImageLoader to alleviate the bottleneck affecting this.

Keep a low profile [LowProfileImageLoader helps the Windows Phone 7 UI thread stay responsive by loading images in the background] - Delay's Blog

There's no substitute for customer feedback! [Improving Windows Phone 7 application performance now a bit easier with LowProfileImageLoader and DeferredLoadListBox updates] - Delay's Blog

Also, there are a lot of things you can look at to tune performance. Details in the latter parts of my answer in this Question.

Design advices for quick navigation between view

Community
  • 1
  • 1
Mick N
  • 14,892
  • 2
  • 35
  • 41