简体   繁体   中英

Homemade controls in WP7 Silverlight?

In Windows Phone 7 Silverlight, is there a way to design a custom control from scratch - ie with custom drawing and custom touch processing? What do I subclass for that?

Yes you can. You usually subclass Control, ItemsControl, or ContentControl. Here is a blog post that explains the process in detail: Creating a WP7 Custom Control in 7 Steps

As mentioned, you can create a custom control from scratch by deriving from the Control class. To implement gesture handling you can use the GestureService from the Silverlight Toolkit for WIndows Phone 7 or you can directly handle the ManipulationStarted , ManipulationDelta , and ManipulationCompleted UIElement events.

Jeff Prosise has a great series of four posts that cover touch manipulation in great detail:

For the "custom drawing" part, what did you have in mind? If a control built up from primitives isn't what you had in mind, what about lines and shapes ?

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