Reputation: 2585
I have the following code for reading a FlowDocument
into memory but whenever I try to parse it I get XamlParseException
with the following error:
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'Cannot create unknown type '{http://schemas.microsoft.com/expression/2010/drawing}Arc'.' Line number '6' and line position '5'.
Here is what my FD.xaml
file contains:
FD.xaml
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
ColumnWidth="400" FontSize="14" FontFamily="Georgia"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" >
<Paragraph>
<Canvas Canvas.Top="100" Canvas.Left="402">
<ed:Arc ArcThickness="10" Fill="Black" EndAngle="360" Height="7" Width="11" Margin="0,0,0,0"/>
<ed:Arc ArcThickness="10" Fill="Black" EndAngle="360" Height="7" Width="11" Margin="0,12,0,0"/>
<ed:Arc ArcThickness="10" Fill="Black" EndAngle="360" Height="7" Width="11" Margin="0,24,0,0"/>
<ed:Arc ArcThickness="10" Fill="Black" EndAngle="360" Height="7" Width="11" Margin="368,108,0,0"/>
</Canvas>
</Paragraph>
</FlowDocument>
MainWindow.xaml.cs
...
String xamlContent = ReadFileContents("FD.xaml");
FlowDocument doc = XamlReader.Parse(xamlContent) as FlowDocument; // Error occurs right here
...
What I tried so far:
Added reference to Microsoft.Expression.Drawing
but I still can't get it to work.
Upvotes: 1
Views: 2177
Reputation: 36
Try replacing:
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
with:
xmlns:ed="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing"
Upvotes: 2