0
最近我开始在XAML和C#中制作Windows应用商店应用。不幸的是,我添加了一个存储在'/ Assets'中的背景PNG图像失败。无处不在寻找任何胶水,但我找不到任何有用的东西。在Windows应用商店应用中添加背景图片
这里是我的代码:
<Page
x:Class="BoggleV01.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BoggleV01"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Margin="160,100" Width="1040">
<Grid.Background>
<ImageBrush ImageSource="/Assets/Background.png" Stretch="UniformToFill" />
</Grid.Background>
<StackPanel x:Name="levelsStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260"/>
<StackPanel x:Name="playersStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260" Margin="260,0,0,0"/>
<StackPanel x:Name="statisticsStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260" Margin="520,0,0,0"/>
<StackPanel x:Name="settingsStackPanel" HorizontalAlignment="Left" Height="568" VerticalAlignment="Top" Width="260" Margin="780,0,0,0"/>
</Grid>
</Page>
Dhaval,不知怎的,这并没有解决我的问题,我也试过'<图像刷的ImageSource =“/ BoggleV01 ; component/Assets/Background.png“Stretch =”UniformToFill“/>'以防万一我需要用我的命名空间替换Applicationname。 – Smoothal
你有没有在应用程序名字符串中替换你的应用程序名称? –
应用程序名称是命名空间我是正确的吗?在那种情况下,我已经做到了。 – Smoothal