2014-01-30 78 views
1

我有了閱讀FlowDocument到內存中下面的代碼,但每當我試圖解析它,我得到XamlParseException,出現以下錯誤:FlowDocument的分析錯誤與文檔主體<ed:Arc>

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'. 

這裏是我的FD.xaml文件包含:

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 
... 

我試過到目前爲止: 新增參考Microsoft.Expression.Drawing,但我仍然無法得到它的工作。

+0

對我來說 「Microsoft.Expression.Drawing」 固定所有的編譯問題的參考(VS2013) – Allender

回答

1

嘗試更換:

xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 

有:

xmlns:ed="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing" 
+0

,你可以提高你的答案和格式 – lalithkumar