title: How to set focus to a default child control unless the user clicks on a different child control?
body: <p>I have a pretty simple use case but I cannot make it work right. I've got a <code>ListView</code> whose item template is a <code>Note</code> custom <code>UserControl</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/jHjT3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jHjT3.png" alt="enter image description here"></a></p>
  
  <p>Each <code>Note</code> has a few simple controls as shown.</p>
  
  <p>I want this to work so that if a row is selected programmatically or by clicking somewhere in it, it sets focus to the first textbox in that row. But if you click on a control in the row, it activates that control (i.e. lets you edit the <code>Exhibit</code> contents or click the <code>Delete</code> button).</p>
  
  <p>If I don't do anything to set focus, clicking on the row highlights the row but doesn't set focus to any child control.</p>
  
  <p>Within the <code>Note</code> control I have tried this:</p>
  
  <pre><code>protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
  {
      base.OnGotKeyboardFocus(e);
  
      text.Focus();
  }
  </code></pre>
  
  <p><code>text</code> is the name of that first <code>TextBox</code>, and it does set focus, but it also does this if I click directly on the <code>Exhibit</code> textbox or <code>Delete</code> button, making them unusable.</p>
  
  <p>So, how can I enable the focusing that I want when the container control gets focus, UNLESS it got that focus via a click on a specific child control (which should then keep the focus)?</p>