WPF如何设置Image.Source为资源图片
XAML里是Source="/GalaxyErp.Main;component/Images/btnMinimize.png"
现在应该要做最大化和还原按钮,请问如何用代码设置Image.Source=?
[解决办法]
string realPath = string.Format(”/GalaxyErp.Main;component/Images/btnMinimize.png”); Uri pathUri = new Uri(realPath); System.Windows.Media.Imaging.BitmapImage bi = new System.Windows.Media.Imaging.BitmapImage(); bi.BeginInit(); bi.UriSource = pathUri; bi.EndInit(); return bi;