Custom properties on Control Template RRS feed

  • Question

  • I have read Quickstart: Control Templates and want to write a Numeric Spinner control.  I see that I can expose properties of the elements that make up my control by using {TemplateBinding ...}.  How do I create new properties that apply to my control but do not correlate 1:1 with any of the elements of my control?  For example, if I want to create a property on my control that specified the range of the numeric spinner (min value, max value, step size, etc.) how would I do this?

    Also, where is the "entry point" to a custom control?  That is, where do I put the code-behind for my control so it can do things such as populate the elements of the control with dynamic data such as filling in ListBoxes or ComboBoxes with data supplied by the control (not supplied by the user of the control)?

    I have not previously used WPF, metro is the first time I have worked with XAML so the answer to these questions may be relatively simple for an experienced WPF developer.

    Friday, March 23, 2012 6:21 PM