如何以编程方式将按钮的背景设置为图像?我知道如何在 XAML 中做到这一点,但在代码中,我一直卡住,我试过了
Button.Background = new ImageBrush{ ImageSource = "source" };
但后来我得到字符串无法转换为 ImageSource 的错误。
如何以编程方式将按钮的背景设置为图像?我知道如何在 XAML 中做到这一点,但在代码中,我一直卡住,我试过了
Button.Background = new ImageBrush{ ImageSource = "source" };
但后来我得到字符串无法转换为 ImageSource 的错误。