有沒有辦法將圖示添加到對話框。
這是我為對話框創建設定的地方:
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);
uj5u.com熱心網友回復:
我假設我們正在談論標題欄最左側的圖示。
一種方法是這樣的(在您的 ExpandoObject 建構式中):
Uri iconUri = new Uri("PathToYourIcon");
Icon = BitmapFrame.Create(iconUri);
更多詳細資訊,請參見:如何在 wpf 中的代碼隱藏中設定視窗圖示?
您還應該能夠在 XAML 模板中設定 Window 的 Icon 屬性。畢竟,對話框應該只是一個像任何其他視窗一樣的視窗。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/344995.html
下一篇:無法更新作曲家
