Is there a way to add an icon to a Dialogbox.
This is where i create the settings for the Dialogbox:
dynamic settings = new ExpandoObject();
settings.WindowStartupLocation =
WindowStartupLocation.CenterOwner;
settings.WindowStyle = WindowStyle.SingleBorderWindow;
settings.ResizeMode = ResizeMode.NoResize;
settings.Title = "System Error";
//settings.(set my icon here);
status.UpdateMessage(ex.Message, $"{ex.Message} To the products list");
_window.ShowDialog(_status, null, settings);
CodePudding user response:
I'm assuming we are talking about the icon on the very left side of the title bar.
One way would be like this (inside your ExpandoObject constructor):
Uri iconUri = new Uri("PathToYourIcon");
Icon = BitmapFrame.Create(iconUri);
For more details, see: How to set window icon in code behind in wpf?
You should also be able to set the Icon attribute of your Window in your XAML template. A dialog should just be a Window like any other after all.