简体   繁体   English

将Silverlight控件移植到WPF

[英]Porting silverlight control to WPF

I would like to use this for my WPF application. 我想将此用于我的WPF应用程序。 WPF Battery Control . WPF电池控制 It is about a IPhone based battery control in silverlight. 这是关于Silverlight中基于iPhone的电池控制。

However, I have no idea how to go about it, and would like to ask for help. 但是,我不知道如何处理,想寻求帮助。

Here is the link: http://advertboy.wordpress.com/2007/09/11/iphones-beautiful-battery-recharger-as-a-silverlight-animation/ 这是链接: http : //advertboy.wordpress.com/2007/09/11/iphones-beautiful-battery-recharger-as-a-silverlight-animation/

And source code: https://skydrive.live.com/?cid=1e3f9e1e2f8bc994&id=1E3F9E1E2F8BC994%21221# 和源代码: https : //skydrive.live.com/?cid=1e3f9e1e2f8bc994&id=1E3F9E1E2F8BC994%21221#

if you have the source, just make a WPF app, and add the code for the control. 如果有源代码,只需制作一个WPF应用程序,然后添加控件的代码。 it should build w/o any problem. 它应该建立没有任何问题。

silverlight is a sub-set of WPF, so most silverlight code should build w/o any problem. silverlight是WPF的子集,因此大多数silverlight代码都应构建任何问题。 the reverse is not true, however--most WPF code won't build in silverlight. 相反,事实并非如此-大多数WPF代码不会在Silverlight中构建。

The code you've linked to is a Silverlight 1 application, so porting isn't simply a case of copy the source across. 您链接到的代码是Silverlight 1应用程序,因此移植不只是复制源代码的情况。

The XAML markup for the battery is in iTunesControls\\Recharging\\BatteryRecharging.xaml . 电池的XAML标记位于iTunesControls\\Recharging\\BatteryRecharging.xaml Most of this appears to work as-is. 其中大多数似乎按原样工作。 Copy the entire contents of this file into a user control or custom control in your WPF project, and then remove the xmlns , xmlns:x and xmlns:a namespace references and the x:Class attribute from the root <Canvas> element. 将此文件的全部内容复制到WPF项目中的用户控件或自定义控件中,然后从根<Canvas>元素中删除xmlnsxmlns:xxmlns:a命名空间引用以及x:Class属性。

To vary the amount of charge shown within the battery, set the Width s of the elements with names pthFiller and pthFiller1 to a value between 0 (empty) and 314 (100% full). 要改变电池中显示的电量,请将名称为pthFillerpthFiller1的元素的Width设置为0(空)到314(100%充满)之间的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM