コード例 #1
0
 private static object stretchChangeCallBack(DependencyObject d, object baseValue)
 {
     if (baseValue != null)
     {
         AutoSizeImage control = d as AutoSizeImage;
         control.img.Stretch = (Stretch)baseValue;
     }
     return(baseValue);
 }
コード例 #2
0
 private static object imageSourceChange(DependencyObject d, object baseValue)
 {
     if (baseValue != null)
     {
         AutoSizeImage control = d as AutoSizeImage;
         control.img.Source = baseValue as ImageSource;
         if (control.img.Source.Width > control.img.Source.Height)
         {
             control.Width = (control.img.Source.Width / control.img.Source.Height) * control.Height;
         }
         else
         {
             control.Height = (control.img.Source.Height / control.img.Source.Width) * control.Width;
         }
     }
     return(baseValue);
 }