Creating Lookless Controls for WPF and Silverlight

Download this episode

Download Video

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

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    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?

       

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.