public static FrameworkElement GetRendreable(IconVm iconVm, ImageSource sourceIcon, Color color) { var border = new Border() { Background = new SolidColorBrush(color), Width = iconVm.Width, Height = iconVm.Height }; var image = new Image() { Stretch = Stretch.Uniform, Source = sourceIcon, Width = iconVm.ImageWidth, Height = iconVm.ImageHeight, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; border.Child = image; border.Measure(new Size(border.Width, border.Height)); border.Arrange(new Rect(new Size(border.Width, border.Height))); border.UpdateLayout(); return(border); }
public static FrameworkElement GetRendreable(IconVm iconVm, ImageSource sourceIcon, Color color) { var border = new Border() { Background = new SolidColorBrush(color), Width = iconVm.Width, Height = iconVm.Height }; var image = new Image() { Stretch = Stretch.Uniform, Source = sourceIcon, Width = iconVm.ImageWidth, Height = iconVm.ImageHeight, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; border.Child = image; border.Measure(new Size(border.Width, border.Height)); border.Arrange(new Rect(new Size(border.Width, border.Height))); border.UpdateLayout(); return border; }