WPF (AKA Avalon)

Tuesday, September 27, 2005

Reuse a panel with help of a UserControl

This is better sample of how You can build a component like a panel for reuse purposes. The class UserControl offers a simple way to divide a page (like a dialog) or window into pieces. The programming model is analog to Window. In this case we benefit from the advantage that a UserControl can thus be used to build a composite control for reuse within your app in multiple places. A good example is the volume-panel from the last sample, again:

    1) Add an 'Avalon User Control' to your visual studio project
    2) Fill the FixedTemplate with your desired controls
    3) Add logic to the code-behind file of your control

To use this UserControl in your application add 'Mapping' to the XAML file i which you want to refer to your UserControl. Now place the new UserControl within a layout multiple times.

0 Comments:

Post a Comment

<< Home