Seva Alekseyev
Seva Alekseyev

Reputation: 61341

Homemade controls in WP7 Silverlight?

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

Upvotes: 1

Views: 498

Answers (2)

Derek Lakin
Derek Lakin

Reputation: 16319

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?

Upvotes: 1

Greg Zimmers
Greg Zimmers

Reputation: 1400

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

Upvotes: 7

Related Questions