C# 如何以编程方式更改样式组件
我把一个图像做成按钮控件。现在我想用c#代码改变这个图像C# 如何以编程方式更改样式组件,c#,wpf,data-binding,controls,styles,C#,Wpf,Data Binding,Controls,Styles,我把一个图像做成按钮控件。现在我想用c#代码改变这个图像 我想用C代码更改我的图像。 感谢您的帮助在您的代码隐藏中,假设您想将图片更改为名为“s.png”的图像: 使用: 谢谢我的兄弟。这对我真的很有帮助。再次感谢s非常感谢。 myImage.Source = new BitmapImage(new Uri(@"s.png", UriKind.Relative)); ((button.Template).FindName("MyImage", button) as Image).Sourc
我想用C代码更改我的图像。
感谢您的帮助在您的代码隐藏中,假设您想将图片更改为名为“s.png”的图像: 使用:
谢谢我的兄弟。这对我真的很有帮助。再次感谢s非常感谢。
myImage.Source = new BitmapImage(new Uri(@"s.png", UriKind.Relative));
((button.Template).FindName("MyImage", button) as Image).Source = new BitmapImage(new Uri("..."));