title: How binding textbox and property?
body: <pre><code>&lt;UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
      xmlns:System_Windows_Controls_Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Toolkit"
      x:Class="SilverlightApplication5.MainPage"
      Width="640" Height="480"&gt;
      &lt;StackPanel x:Name="LayoutRoot" Background="White"&gt;
          &lt;TextBox x:Name="tbWidth" TextWrapping="Wrap" 
             Text="{Binding Mode=TwoWay, ValidatesOnExceptions=True, Path=RoomWidth}"/&gt;
          &lt;/StackPanel&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>RoomWidth - is property.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Net;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Animation;
  using System.Windows.Shapes;
  
  namespace SilverlightApplication5
  {
      public partial class MainPage : UserControl
      {
          public MainPage()
          {
              InitializeComponent();
          }
          private int roomWidth = 10;
          public int RoomWidth
          {
              get { return roomWidth; }
              set
              {
                  if (value &lt; 0 || value &gt; 100)
                  {
                      throw new Exception("Data not correct");
                  }
                  roomWidth = value;
              }
          }
  
      }
  }
  </code></pre>
  
  <p>I need add to Binding source this class. How do this?</p>