Creating Lookless Controls for WPF and Silverlight

Sign in to queue

Description

This screencast is a continuation of a previous screencast entitled “Skins for WPF and Silverlight”. In this session we go beyond skinning built-in controls and learn what’s required to create our own skinnable (or ‘lookless’) controls.

This screencast assumes existing knowledge about styles and templates, so if you aren’t up to speed on those topics please consider watching the skinning screencast first.

The sample demonstrated in this screencast can be downloaded here.

Embed

Download

Download this episode

The Discussion

  • User profile image
    tkchen7

    This is a great presentation to distinguish from User Control to Custom Control

  • User profile image
    magicalclick

    I am confused on how to make a Custom Control from User Control. Do I first make a User Control with all the limited functionalities, and then, make the Custom Control from that to add those data binding and style functionalities?

     

    Is there a screencast for that? Thank you.

  • User profile image
    MLL8088

    Great info thanks this article cleared up a gap for me.
     
    @magicalclick
    In this context a Custom Control is simply a dependency property class that inherits from Control instead of directly from DependencyObject. I assume the reasons are so it picks up features of the Control class for UI  / (Other?) functionality whereas a straight DepO is not suitable.
     
    The Custom Control becomes a backing store without any visual representation convoluting the intent / code. This is probably why it's called lookless. It doesn't know (or care) about how its own data is externally used, manipulated or represented. It just provides properties that expose this data to consumers. In the RW it would likely include data validation and a host of other methods focused on the minutiae of data processing. It's a perfect simple example of the fundamental WPF feature: Separation of UI / Code.

     
    So to me your question seems backwards. You're wanting to try and turn a User Control into a Custom Control. To me that would mean you're trying to decompose the UI elements of the User Control into property code. Maybe what you're after/need instead is an Attached Properties (RegisterAttached) class and not an actual Custom Control class?

     

Add Your 2 Cents