title: How to update binding of Textbox when clicking off the textbox
body: <p>In my application I have a Usercontrol which represents some configuration for an object. Inside this is a Texblock which contains the name of said object. I wanted to be able to click on this Textblock and turn it into a Textbox so you were able to edit the name.</p>
  
  <p>I want it to have the following 3 behaviours</p>
  
  <ol>
  <li>Sets the value in the ViewModel when enter is pressed</li>
  <li>Gain Keyboard focus when it becomes visible</li>
  <li>Sets the value in the ViewModel when the mouse is clicked outside of the textbox (like a combobox does)</li>
  </ol>
  
  <p>and I am currently stuck on 3. <strong>How can I get my textbox to satisfy requirement 3 - Clicking off the textbox sets the value</strong> I have implemented some attachment behaviours to make the other 2 work but can't get the mouse one to work.</p>
  
  <p>I have tried the following</p>
  
  <ol>
  <li>Added PreviewMouseDown event - This only seems to get detected when mouse down is in the textbox</li>
  <li>Added PreviewMouseDown even in the usercontrol - this seems to get hit even when the textbox is clicked. Also it isn't the only usercontrol inside my window so It won't work on the grander scale.</li>
  <li>Added a PreviewMouseDownOutsideCapturedElement - but can never get this to fire.</li>
  <li>Lost focus on both UpdateSourceTrigger and as an event - This works but only when you click a different input field rather than just clicking off</li>
  </ol>
  
  <p>The code for my textbox is as follows. </p>
  
  <pre><code>            &lt;TextBox x:Name="text" VerticalAlignment="Center"
                   Margin="5,2,0,0"
                   Text="{Binding Name, Mode=TwoWay}"
                   Visibility="{Binding IsEditingName, Converter={StaticResource VisConverter}, FallbackValue=Collapsed}"
                   b:FocusBehaviours.ShouldFocusWhenVisible="True"
                   b:InputBehaviours.UpdatePropertySourceWhenEnterPressed="TextBox.Text"/&gt;
  </code></pre>
  
  <p>I've looked at countless SO posts and none of them seems to be able to help me with this, they all recommend adding it to the window/usercontrol which I can't do.</p>