private static void IconBytesPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e) { var control = (CurrentWindowServiceEx)sender; if (control.ActualWindow != null) { var converter = new BytesToSvgImageConverter(); control.ActualWindow.Icon = ((ImageSource)converter.Convert(e.NewValue, typeof(ImageSource), null, CultureInfo.CurrentCulture)); } }
protected override IWindowSurrogate CreateWindow(object view) { var window = base.CreateWindow(view); if (_size != null) { window.RealWindow.SizeToContent = SizeToContent.Manual; window.RealWindow.Height = _size.Value.Height; window.RealWindow.Width = _size.Value.Width; window.RealWindow.SizeToContent = _sizeToContent; } if (_icon != null) { var converter = new BytesToSvgImageConverter(); window.RealWindow.Icon = converter.Convert(_icon, typeof(ImageSource), null, CultureInfo.CurrentCulture) as ImageSource; } return(window); }
protected override void OnActualWindowChanged(Window oldWindow) { base.OnActualWindowChanged(oldWindow); if (ActualWindow != null) { if (!string.IsNullOrWhiteSpace(Title)) { ActualWindow.Title = Title; } if (IconSource != null) { ActualWindow.Icon = IconSource; } if (IconBytes != null) { var converter = new BytesToSvgImageConverter(); ActualWindow.Icon = ((ImageSource)converter.Convert(IconBytes, typeof(ImageSource), null, CultureInfo.CurrentCulture)); } } }