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 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++; ...

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