Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Imagescaling looking bad in Ribbon
  2. BitmapImage img = new BitmapImage();
  3.         try
  4.         {
  5.             Uri uri = new Uri("pack://application:,,,/UIMainWindow;component/Resources/" + iPictureName);                
  6.             img.BeginInit();
  7.             img.SetValue(BitmapImage.CacheOptionProperty, BitmapCacheOption.OnLoad);
  8.             RenderOptions.SetBitmapScalingMode(img, BitmapScalingMode.HighQuality);
  9.             img.UriSource = uri;
  10.             img.EndInit();
  11.             img.Freeze();
  12.         }
  13.         catch (Exception ex)
  14.         {
  15.             throw new Exception("Creation of image failed: " + ex.Message, ex);
  16.         }