示例#1
0
 private void Image_Loaded(object sender, RoutedEventArgs e)
 {
     if (sender is Image img && img.Source is DrawingImage drawingImage)
     {
         img.Source = new DrawingImage
         {
             Drawing = ImageThemingUtilities.TransformDrawing(drawingImage.Drawing, IconThemeSelector.KnownThemes.Dark.GetIconTheme())
         };
     }
 }
示例#2
0
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     if (Source is DrawingImage drawingImage)
     {
         return(new DrawingImage
         {
             Drawing = ImageThemingUtilities.TransformDrawing(drawingImage.Drawing, Theme)
         });
     }
     else
     {
         return(Source);
     }
 }
示例#3
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var image = new Image { Source = source };
            if (source is DrawingImage drawingImage)
            {
                image.Source = new DrawingImage()
                {
                    Drawing = ImageThemingUtilities.TransformDrawing((source as DrawingImage)?.Drawing, IconThemeSelector.KnownThemes.Dark.GetIconTheme())
                };
            }

            RenderOptions.SetBitmapScalingMode(image, scalingMode);
            if (width >= 0 && height >= 0)
            {
                image.Width = width;
                image.Height = height;
            }
            return image;
        }
示例#4
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var image = new Image {
                Source = source
            };

            if (source is DrawingImage drawingImage)
            {
                image.Source = new DrawingImage()
                {
                    Drawing = ImageThemingUtilities.TransformDrawing((source as DrawingImage)?.Drawing, ThemeController.CurrentTheme.GetThemeBase().GetIconTheme())
                };
            }

            RenderOptions.SetBitmapScalingMode(image, scalingMode);
            if (width >= 0 && height >= 0)
            {
                image.Width  = width;
                image.Height = height;
            }
            return(image);
        }