我正在尝试设计我正在处理的应用程序,并且我正在研究XAML。有一个DockPanel,里面是一个StackPanel停靠在左边,另一个停靠在右边。我一直收到错误A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
。错误发生在ImageBrush标记所在的行上。为什么会这样?
这是我的XAML:
<Window x:Class="MyProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="730" Width="1220">
<DockPanel>
<Border BorderBrush="#FF5AD8E5" BorderThickness="0,0,3,0">
<StackPanel DockPanel.Dock="Left" Width="208">
<StackPanel.Background>
<ImageBrush ImageSource="/assets/img/nav_primary.png"></ImageBrush>
</StackPanel.Background>
<Label Content="Welcome, Scott!" Foreground="White" HorizontalAlignment="Right" FontSize="16" Padding="5,15,15,5" OpacityMask="Black" />
</StackPanel>
</Border>
<StackPanel DockPanel.Dock="Right" Width="Auto">
</StackPanel>
</DockPanel>
</Window>