O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a User Control

In this section, we’ll create a simple user control called NumericUpDown, which provides a numeric display with associated increment and decrement buttons that enable the user to change its value.

First, we add a new user control to a Visual Studio solution by selecting User Control from the Add New Item dialog. If you do this and name it NumericUpDown, you get NumericUpDown.xaml and its NumericUpDown.xaml.cs code-behind file added to your project. This defines a NumericUpDown class that derives from UserControl, a simple control with a Content property of type UIElement. (Note that Content does not support generic objects, so UserControl is not a content control.)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required