Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I´m trying to do a program that automatically put a picture in a XML template (inside the red rectangle for example).

I create a graphic in Inkscape and export it as XML
<img src="http://i.imgur.com/xflYUJ7.jpg" title="Hosted by imgur.com" />


Using the code below I can render all graphics except the textblock in whic an error appear " Whitespacecollapse was not found in type Span"

VB
Dim st As New FileStream(s.FileName, FileMode.Open)
Dim gridl As New Viewbox
gridl = System.Windows.Markup.XamlReader.Load(st)
Panel.Children.Add(gridl)
st.Close()


I tried to remove whitespacecollapse="preserve and too changed it for xml:space="preserve" but doesnt work.
Is there any way to keep the text format?

XML
<?xml version="1.0" encoding="UTF-8"?>
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
<Canvas Name="svg2" Width="744" Height="1052">
<Canvas.Resources/>
<!--Unknown tag: sodipodi:namedview-->
<!--Unknown tag: metadata-->
<Canvas Name="layer1">
<Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="63" Canvas.Top="50" Width="606" Height="311" RadiusY="16.246428" RadiusX="16.246428" Name="rect2985" Fill="#FFFF0000"/>
<TextBlock xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" FontSize="40" FontWeight="Normal" FontFamily="arial" FontStyle="normal" Foreground="#FF000000" Canvas.Left="109" Canvas.Top="370" Name="text2987">
<Span whiteSpaceCollapse="preserve" FontSize="40">123</Span>
<Span whiteSpaceCollapse="preserve" FontSize="40">456</Span>
<Span whiteSpaceCollapse="preserve" FontSize="40">  7</Span>
</TextBlock>
</Canvas>
</Canvas>
</Viewbox>
Posted
Comments
Sergey Alexandrovich Kryukov 25-Dec-13 17:02pm    
I did it a number of times, never had any problems. How did you do it? First, saved SVG as XAML, didn't you? What's next? All I did after that is removed redundant name attributes, nothing else.
—SA
pablogvivo 3-Jan-14 10:35am    
Yeah, I saved as XAML and try load directly, in the link below I put the program with two pictures(svg and xaml), one, only shapes and the other with numbers too.

As you can see, the problem is in whiteSpaceCollapse line.

https://dl.dropboxusercontent.com/u/56220834/CALENDAR.rar

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900