PROBLEM:
This error is a very difficult one to identify. It took me a couple of hours and remembering what code I added within the last compile. Note: This error does not occur when you compile, but when you run the application.
What it turns out to be is when you write the following XAML code for a Window Form in WPF (Windows Presentation Foundation).
The error was on Line number 14 but not line position 9… as the above error display shows.
- <Window
- x:Name="PullDraftDetail"
- x:Class="PullDraftDetail"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- AllowsTransparency="True"
- Title=""
- mc:Ignorable="d"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- d:DesignHeight="200" d:DesignWidth="700"
- SizeToContent="WidthAndHeight"
- WindowStartupLocation="CenterScreen"
- WindowStyle="None" Background="{x:Null}" Icon="/PullDraft_WPF;component/images/Book_JournalwPen.ico"
- >
This code produces the following form in “Design View”.
What I wanted is to make the Window transparent and display the “GroupBox" and all the other elements by setting the Window’s “Background=”{x:Null}”
But, when I added the “Icon=”/PullDraft_WPF;component/images/Book_JournalwPen.ico” I got the error “XamlParseException occurred”. By the way… I did not need the “Icon” element because the Window was transparent anyway.
Solution:
I removed the Icon element and everything ran fine.
- <Window
- x:Name="PullDraftDetail"
- x:Class="PullDraftDetail"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- AllowsTransparency="True"
- Title=""
- mc:Ignorable="d"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- d:DesignHeight="200" d:DesignWidth="700"
- SizeToContent="WidthAndHeight"
- WindowStartupLocation="CenterScreen"
- WindowStyle="None"
- Background="{x:Null}"
- >
…End of Line…