简体   繁体   中英

Porting silverlight control to WPF

I would like to use this for my WPF application. WPF Battery Control . It is about a IPhone based battery control in silverlight.

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/

And source code: 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. it should build w/o any problem.

silverlight is a sub-set of WPF, so most silverlight code should build w/o any problem. the reverse is not true, however--most WPF code won't build in silverlight.

The code you've linked to is a Silverlight 1 application, so porting isn't simply a case of copy the source across.

The XAML markup for the battery is in 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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