anfri
anfri

Reputation: 465

Custom controls in WP8

i would like to know if it's possible to define a new user control on the basis of the pre-defined ones in WP8. For example, if i wished to define a custom Application Bar (like the one in the Windows Phone Store) starting from the standard one, or a custom Context Menu, would it be possible?

Thanks

Upvotes: 1

Views: 65

Answers (1)

lsuarez
lsuarez

Reputation: 4992

The simple answer is "yes." For instance, a vast majority of the controls in the Windows Phone Toolkit are derived from their base-level analogs, such as the most obvious example of PhoneTextBox.

Regarding ApplicationBar specifically, you will note the class is sealed and cannot be inherited, but you can create predefined templates in XAML for application bar configurations you wish to reuse. As a custom control, that specific construct does not make sense as it is a baked-in OS element. Instead, depending on your use case, it may be better to completely disable the ApplicationBar and create an entirely new control that implements the custom functionality you desire.

The controls are skinned using a convention in Windows Phone development by generating a Generic.xaml file in the Themes folder that is compiled as a library resource. One such example can be found at the link inside the Windows Phone Toolkit's WP8 library.

Upvotes: 1

Related Questions