title: C# winforms databinding a usercontrol on a tab page
body: <p>I have a design question regarding databinding usercontrols that are loaded into tabpages in a tabcontrol.
  I'd like to be able to bind these controls to a static list of objects that I'm using.  I'll add simple code to illustrate what I'm after.</p>
  <p>The objects:</p>
  <pre><code>    public static List&lt;DrawerData&gt; Drawer = new List&lt;DrawerData&gt;
      {
          new DrawerData(),
          new DrawerData()
      }
      
      public class DrawerData 
      {
          private decimal apple;
          private decimal orange;             
          public decimal Apple { get; set; }
          public decimal Orange { get; set; }
     }
  </code></pre>
  <p>usercontrol:</p>
  <pre><code>public partial class UcDrawers : UserControl
  { 
      private readonly int DrawerNum;
      public UcPid( int drawer)
      {
          InitializeComponent();
          DrawerNum = drawer;
      }
  
  
      private void UcDrawers_Load(object sender, EventArgs e)
      {
          UpDnApples.Value = Drawer[DrawerNum].Apple;
          UpDnOranges.Value = Drawer[DrawerNum].Orange;           
      }
  
      private void UpDnApples_ValueChanged(object sender, EventArgs e)
      {
           Drawer[DrawerNum].Apple= UpDnApples.Value;
      }
  
      private void UpDnOranges_ValueChanged(object sender, EventArgs e)
      {
           Drawer[DrawerNum].Orange= UpDnOranges.Value;
      }
  </code></pre>
  <p>Form where the tabcontrol is (DrawerTabControl) :</p>
  <pre><code>public partial class FrmKitchen : Form
  {
      private readonly int dr;    
  
      public FrmKitchen(int NumOfDrawers)
      {
          InitializeComponent();
          dr = NumOfDrawers;
      
      }
  
      private void FrmPIDSettings_Load(object sender, EventArgs e)
      {
          for (int i = 0; i &lt; dr; i++)
          {
              AddTab(i+1);
          }
      }
  
      private void AddTab(int d)
      {
          UcDrawers ucDrawers = new UcDrawers(d) { Dock = DockStyle.Fill };
          TabPage myTabPage = new TabPage();
          myTabPage.Controls.Add(ucDrawers);
          DrawerTabControl.TabPages.Add(myTabPage);
          
          myTabPage.Name = &quot;DrawerTab&quot; + d;
          myTabPage.Text = &quot;Drawer &quot; + d;
      }
              
  }
  </code></pre>
  <p>Let's say that the user control has two labels on it that will show the number of apples and oranges in each drawer.     Is there a good way to set up databinding to accomplish something like this?  The values of the apples and oranges can be changed outside of this form and I'd like them to be updated in real time ideally.</p>
  <p>For instance:
  <code>DrawerTab1.LblApple</code> and <code>DrawerTab1.LblOrange</code> being bound to <code>Drawer[0].Apple</code> and <code>Drawer[0].Orange</code></p>