Creating the Behavior

Listing 15.2 contains the entire code-behind file for Listing 15.1. This gives NumericUpDown the appropriate behavior when each Button is clicked and exposes the number as a read/write Number property.

LISTING 15.2 NumericUpDown.xaml.cs: The Logic for NumericUpDown

using Windows.UI.Xaml;using Windows.UI.Xaml.Controls;namespace Chapter15{  public sealed partial class NumericUpDown : UserControl  {    int number;    public NumericUpDown()    {      InitializeComponent();    }    public int Number    {      get { return this.number; }      set { this.number = value; this.numberText.Text = number.ToString(); }    }    void Increment_Click(object sender, RoutedEventArgs e)    {      this.number++; ...

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.