Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Vector graphic in Theme not draw paths (problem)

21 Oct 2017, 20:37

I created very simple background image with vector graphic and I want use it in my application. Here is code in NoesisTheme.xaml
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform" x:Key="MBack">
	  <Canvas Name="svg8" Width="800" Height="600">
		<Canvas.RenderTransform>
		  <TranslateTransform X="0" Y="0"/>
		</Canvas.RenderTransform>
		<!--Unknown tag: sodipodi:namedview-->
		<!--Unknown tag: metadata-->
		<Canvas Name="layer1">
		  <Canvas.RenderTransform>
			<TranslateTransform X="0" Y="-138.24998"/>
		  </Canvas.RenderTransform>
		  <Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="0" Canvas.Top="138.25" Width="800" Height="599.99994" Name="rect_background" Fill="#FF00008C" StrokeThickness="0.99999988"/>
		  <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="header" Fill="#FF009819" StrokeThickness="0.85975945">
			<Path.Data>
			  <PathGeometry Figures="m 0 138.24998 v 39.99999 h 619.49025 c 57.33793 0 59.6613 -39.99999 88.03517 -39.99999 z" FillRule="NonZero"/>
			</Path.Data>
		  </Path>
		  <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="glu" Fill="#FF0000A0" StrokeThickness="1.99999976" Stroke="#FFFFFFFF" StrokeMiterLimit="4">
			<Path.Data>
			  <PathGeometry Figures="m 535.98692 571.37275 c -18.40082 18.82382 -33.11618 -2.73014 -56.4333 9.48623 -23.31711 12.21634 -13.97287 36.58439 -39.92387 40.99744 -25.95095 4.41309 -25.18681 -21.67392 -51.23134 -25.49612 -26.04456 -3.82224 -32.80808 21.38433 -56.39679 9.70098 -23.58871 -11.68334 -7.63694 -32.33903 -26.46079 -50.73984 -18.82384 -18.40086 -39.11169 -1.9838 -51.32806 -25.30091 -12.21637 -23.31715 12.82999 -30.6517 8.41691 -56.60269 -4.41307 -25.95095 -30.47597 -24.59418 -26.65376 -50.63875 3.82221 -26.04453 28.3963 -17.25645 40.07964 -40.84516 11.68335 -23.58871 -10.19947 -37.81046 8.20137 -56.63432 18.40084 -18.82382 33.11619 2.73014 56.43331 -9.4862 23.31713 -12.21638 13.97289 -36.58442 39.92385 -40.99748 25.95096 -4.41308 25.18681 21.67393 51.23135 25.49613 26.04457 3.82223 32.80808 -21.38434 56.39679 -9.70099 23.58871 11.68335 7.63695 32.33903 26.46081 50.73985 18.82383 18.40085 39.11169 1.9838 51.32807 25.30095 12.21634 23.31711 -12.83003 30.6517 -8.41694 56.60265 4.41306 25.95095 30.47596 24.59421 26.65376 50.63874 -3.8222 26.04457 -28.39631 17.25649 -40.07962 40.8452 -11.68335 23.58871 10.19947 37.81043 -8.20139 56.63429 z" FillRule="NonZero"/>
			</Path.Data>
		  </Path>
		</Canvas>
	  </Canvas>
	</Viewbox>
// inside my.xaml for display background in grid
<Grid >
		<ContentControl Content="{StaticResource MBack}" />
</Grid>
Problem is, paths are not rendered, only rectangle.
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: Vector graphic in Theme not draw paths (problem)

22 Oct 2017, 12:19

I check exported xaml example from this topic and discover, my export from inkscape is different then in topic.

I have to change from
		  <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="header" Fill="#FF009819" StrokeThickness="0.85975945">
			<Path.Data>
			  <PathGeometry Figures="m 0 138.24998 v 39.99999 h 619.49025 c 57.33793 0 59.6613 -39.99999 88.03517 -39.99999 z" FillRule="NonZero"/>
			</Path.Data>
		  </Path>
to
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="header" Fill="#FF009819" StrokeThickness="0.85975945" Data="m 0 138.24998 v 39.99999 h 619.49025 c 57.33793 0 59.6613 -39.99999 88.03517 -39.99999 z" FillRule="NonZero"/>
Then path is displayed. What I must done for export my vector graphics this way and don't need to rewrite exported graphics?
 
User avatar
sfernandez
Site Admin
Posts: 1920
Joined: 22 Dec 2011, 19:20

Re: Vector graphic in Theme not draw paths (problem)

23 Oct 2017, 16:52

Did you modify this:

To generate content that is compatible with NoesisGUI you must activate the Silverlight compatibility mode. This mode generates more efficient and compact content. The line in the file inkscape/share/extensions/svg2xaml.xsl must change from:
<xsl:param name="silverlight_compatible" select="2" />
to
<xsl:param name="silverlight_compatible" select="1" />
 
Wanderer
Topic Author
Posts: 168
Joined: 08 May 2017, 18:36

Re: Vector graphic in Theme not draw paths (problem)

24 Oct 2017, 16:38

No because I have Inkscape 0.92, if I do, then it always export paths which Noesis didn't display. I discover that I need save xaml file 2x. Once with Silverlight compatibility for paths, and second for add viewbox, or add it manually.
 
User avatar
sfernandez
Site Admin
Posts: 1920
Joined: 22 Dec 2011, 19:20

Re: Vector graphic in Theme not draw paths (problem)

30 Oct 2017, 13:00

Ok, I downloaded the latest version of inkscape and I was able to generate Noesis compatible paths by doing the following:

1. "Open" any svg file
2. Click "Save As..."
3. Select "Microsoft XAML (*.xaml)" as "Type"
4. Click "Save" and a "XAML Output" dialog will open
5. Check "Silverlight compatible XAML" box and hit "OK"

Silverlight paths syntax is what we understand in Noesis, so you have to select that.

Who is online

Users browsing this forum: Google [Bot] and 3 guests