use*_*456 2 wpf background image imagebrush
我正在尝试将我的WPF窗口的背景设置为图像,但是当我尝试运行它时,我得到了这个异常:
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll Additional information: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '8' and line position '10'.
我不想将图像添加到项目中,因为我希望能够在运行时更改图像.我的目的是使用数据绑定在启动过程中设置背景图片.
源代码:
<Window x:Class="ColinsTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Colin's Test Application"
WindowStyle="None"
WindowState="Maximized">
<Window.Background>
<ImageBrush
ImageSource="DeLaRue-Background.jpg"/>
</Window.Background>
<Grid></Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢