title: How to refresh the textbox text when tabs are Changed in WPF
body: <p>Well in my WPF application I am using Tab Control which has around 5 tabs. The view of each tab is a user control which I add via a tool box. </p>
  
  <p><strong>Main Xaml File:</strong></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;TabControl Height="Auto" HorizontalAlignment="Stretch" Margin="0" Name="tabControl1" VerticalAlignment="Stretch" Width="Auto"&gt;
          &lt;TabItem Header="Device Control" Name="Connect"&gt;
              &lt;ScrollViewer Height="Auto" Name="scrollViewer1" Width="Auto"&gt;
                  &lt;my:ConnectView Name="connectView1" /&gt;
              &lt;/ScrollViewer&gt;
          &lt;/TabItem&gt;
          &lt;TabItem Header="I2C"&gt;
              &lt;ScrollViewer Height="Auto" Name="scrollViewer2" Width="Auto"&gt;
                  &lt;my1:I2CControlView Name="i2CControlView1" /&gt;
              &lt;/ScrollViewer&gt;
          &lt;/TabItem&gt;
              &lt;TabItem Header="Voltage"&gt;
                  &lt;ScrollViewer Height="Auto" Name="scrollViewer3" Width="Auto"&gt;
                      &lt;my2:VoltageView Name="voltageView1" /&gt;
                  &lt;/ScrollViewer&gt;
              &lt;/TabItem&gt;
      &lt;/TabControl&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>If you notice each view ie.e <code>Connect</code>, <code>I2C</code> and <code>Voltage</code> is a user control which has a view, viewmodel and model class :) </p>
  
  <p>Each of these views have set of textboxes in their respective xaml files. </p>
  
  <p><strong>Connect.xaml:</strong></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Textbox Text="{Binding Box}", Name="hello" /&gt;
      // Some more textboxes
  &lt;/Grid&gt;
  </code></pre>
  
  <p><strong>I2c.xaml:</strong></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Textbox Text="{Binding I2CBox}", Name="helI2c" /&gt;
      // Some more textboxes
  &lt;/Grid&gt;
  </code></pre>
  
  <p><strong>Voltage.xaml:</strong></p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Textbox Text="{Binding VoltBox}", Name="heVoltllo" /&gt;
      // Some more textboxes
  &lt;/Grid&gt;**
  </code></pre>
  
  <p>By default I have set the text of these textboxes to some value. Lets say "12" "13" "14" respectively in my view model classes. My main requirement is to set the text of these textboxes present in each user control to get refreshed when I change the tab.</p>
  
  <p><strong>Description:</strong></p>
  
  <p>Lets say Connect View is displayed: Value of Textbox is 12 and I edit it and change it to 16. Now I click on I2C tab and then I go back to Connect tab, I want the textbox value to get refreshed back to the initial value i.e. 12. </p>
  
  <p>To be precise, is their a method called visibilitychanged() which I can write in all my user control classes, where I can set the value of these Ui components whenever tabs are changed?</p>
  
  <p>Please help :)</p>