Archive for the ‘XAML’ Category

Problem: When adding Visio diagrams, saved as HTML and published as XAML,  to SharePoint you may receive the error: An error has occurred. : CreateFromXaml shown in the screen dump below.

 An error has occurred. : CreateFromXaml

On investigation, it appears that this error occurs when the you mouse over any box containing an ampersand. This, in turn, throws an exception when it tries to load the alternative text/title. 

Solution: To resolve this issue, find the offending ampersand by searching for the Content of the culprit box (remember the “&” will be an “&”) in the data.xml file, which is created as part of the Visio HTML files.  After finding the rogue &

Once found replace the &amp with <![CDATA[&amp;]]>

Advertisements

Problem: After including some XAML files from a Visio document in a Visual Studio solution you’re unable to build the solution and receive the error:

Project file must include the .NET Framework assembly ‘WindowsBase, PresentationCore, PresentationFramework’ in the reference list 

Cause: When you include XAML files in a solution it assumes you want to compile the XAML resources and subsequently throws the above exception because it can’t find the required WPF assemblies.

In this case, I was only wanting the add the files as content to the solution to keep them under source control.

Solution: To solve this, firstly, unload the project from the solution by right clicking the project and choosing unload project. This can be seen in figure 1Figure 1.

Then, right click the project and choose edit project. This will open the XML for the project file. Now, find the XAML entries.

  1. <Content Include="Processes\Flowcharts\Change\xaml_2.xaml">
  2.       <Generator>MSBuild:Compile</Generator>
  3.       <SubType>Designer</SubType>
  4.     </Content>

Change this to read.

  1. <Content Include="Processes\Flowcharts\Change\xaml_2.xaml"/>

The project should now build.