Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将背景从黑色更改为来自 URI 的图像,我环顾四周,只能找到有关 XAML 代码的示例,但如果我想以编程方式完成这一切怎么办?
this.Background = new ImageBrush { ImageSource = new BitmapImage { UriSource = uri } };
假设“this”是应用程序的布局根,并且页面或其他控件不会用自己的背景覆盖背景。