Aba*_*oub 3 c# wpf wpf-controls
我为wpf项目添加了一个Image资源:
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>
Run Code Online (Sandbox Code Playgroud)
但它没有工作它继续抛出这个恼人的错误System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '6' and line position '10,我应该如何修复它,所以我使用与项目一起构建的静态资源?
小智 8
@HighCore是对的,使用应用程序解决了给定方案中的问题
<ImageBrush ImageSource="pack://application:,,,/Resources/ClientBackground.png"/>
Run Code Online (Sandbox Code Playgroud)
你仍然可以使用siteoforigin.为此,您必须设置图像属性
复制到输出目录为" 始终复制 "
| 归档时间: |
|
| 查看次数: |
13303 次 |
| 最近记录: |