Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

wpf - Why does this Xaml Path crash silverlight?

Quick easy points for anyone who knows the answer:

The following Xaml path works fine in WPF but crashes in Silverlight. I can verify this behaviour in Kaxaml.

The path code is

<Path Fill="#FFEDEDED" StrokeThickness="1" Stroke="#FFA3A3A3" Opacity="0.7" 
                VerticalAlignment="Center" HorizontalAlignment="Center" >
    <Path.Data>
        <PathGeometry Figures="m 1 2 l 4.0525 5.2361 l 4.0527 -5.2361 z "/>
    </Path.Data>
</Path>

The exception is a script error

Unhandled error in Silverlight Application. Failed to create a System.Windows.Media.PathFigureCollection from the text 'm 1 2 l 4.0525 5.2361 l 4.0527 -5.2361 z'

Its supposed to draw a triangle like so:

enter image description here

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Unlike WPF Silverlight does not support converting a string to Figures.


I got the following underline/hover error message in Expression Blend:

enter image description here


The equivalent triangle, authored via Blend, for Silverlight is:

<Path Fill="#FFEDEDED" StrokeThickness="1" Stroke="#FFA3A3A3" Opacity="0.7" 
                VerticalAlignment="Center" HorizontalAlignment="Center"
                Data="m 1 2 l 4.0525 5.2361 l 4.0527 -5.2361 z" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...