为什么此 Xaml 路径会导致 Silverlight 崩溃? [英] Why does this Xaml Path crash silverlight?

查看:31
本文介绍了为什么此 Xaml 路径会导致 Silverlight 崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于知道答案的人来说,快速简单的要点:

Quick easy points for anyone who knows the answer:

以下 Xaml 路径在 WPF 中运行良好,但在 Silverlight 中崩溃.我可以在 Kaxaml 中验证这种行为.

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

路径代码是

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

异常是脚本错误

Silverlight 应用程序中未处理的错误.无法创建System.Windows.Media.PathFigureCollection 来自文本 'm 1 2 l4.0525 5.2361 l 4.0527 -5.2361 z'

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:

有什么想法吗?

推荐答案

与 WPF Silverlight 不同,Silverlight 不支持将字符串转换为数字.

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

我在 Expression Blend 中收到以下下划线/悬停错误消息:

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

通过 Blend 为 Silverlight 编写的等效三角形是:

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" />

这篇关于为什么此 Xaml 路径会导致 Silverlight 崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆