English 中文(简体)
Convert WPF XAML 前往银星XAML
原标题:Convert WPF XAML to Silverlight XAML

我对使用XAML跨越WPF和银灯平台有疑问。

背景:

我有一张银灯,需要把Xaml带给世界森林论坛,并且做了一些计算,以更新XAML。 当我管理WPF的变动时,我把XAML调往Canvas的工事,而Canvas的工事完全是罚款。 问题是,世界森林论坛将银星空间排除在外,甚至删除一些元素的名称。

我用于将XAML转换成Canvas的代码

Canvas canvas = XamlReader.Parse(xaml) as Canvas

The original Xaml from Pierlight:

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="Holder" Width="58" Height="23" >

.......

在我将其改装成Canvas物体后,Canvas的Xaml成为:

<Canvas Name="Holder" Width="58" Height="23" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Canvas.Clip><RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,58,23"/>
</Canvas.Clip><Rectangle Name="HolderBackground" Canvas.Top="0.4" Canvas.Left="0.4" Width="57.2" Height="22.2" RadiusX="0" RadiusY="0" Fill="#FFFFFF" />
<Canvas Name="Image1" Canvas.Top="0.8" Canvas.Left="0.8" Width="24.37999153137207" Height="21.4"> .......

你们应当注意到xmlns:x=“http://schemas.microsoft.com/winfx/2006/xaml”失踪。 另外,所有X:现在,Name也成为名称。 如果你仔细研究,你会注意到这一要素的名称已被删除。

每个人是否有任何想法或简单的解决办法,我可以转换银星XAML-> WPF XAML->(背)银星XAML?

卡车

问题回答

它想像我这样回答,但这不是一个不好的答案。

someone wrote a custom XamlWriter class that resolves part of the problem, but the missing name of RectangleGeometry problem would still exist http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/08aebbf1-0a61-4305-83b2-a0a37bb24002





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签