我为正在制作的 wpf 项目添加了一个图像资源:
right-click on the Project -> Properties -> Resources -> Images -> From Existing -> ClientBackGround.png
我把它作为主窗口的背景:
<Window x:Class="Illuminate_AutoPatcher.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Width="1000" Height="750" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen">
<Window.Background>
<ImageBrush ImageSource="pack://siteoforigin:,,,/Resources/ClientBackground.png"/>
</Window.Background>
<Grid>
<Button Content="" HorizontalAlignment="Left" VerticalAlignment="Top" Width="224" Margin="766,613,0,0" Height="124" >
</Button>
</Grid>
</Window>
但它不起作用,它一直在抛出这个令人讨厌的错误System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '6' and line position '10
,我应该如何修复它,所以我使用与项目一起构建的静态资源?