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 object
s, so UserControl
is not a content control.)
Get XAML Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.