I'm try to create a custom MessageBox in WPF(c#). I need to convert MessageBoxImage to ImageSource. Is there any way?
You should use CreateBitmapSourceFromHIcon
method (msdn) and SystemIcons
class (msdn).
Example:
img.Source = Imaging.CreateBitmapSourceFromHIcon(
SystemIcons.Warning.Handle,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With