title: Combobox passed as a Control template then as a popup
body: <p>I have a combobox &quot;recent_users&quot; as a control template and then as a poppup. How can I pass the selected value of the popup to the method below?(popup click)</p>
  <p>recent_users.SelectedItem.ToString() always returns null.</p>
  <pre><code>    private void usernameEnter_PreviewMouseUp(object sender, MouseButtonEventArgs e)
      {
          Trace.WriteLine(&quot;testing dropdown&quot;);
          ControlTemplate ct = recent_users.Template;
          Popup popup1 = ct.FindName(&quot;PART_Popup&quot;, recent_users) as Popup;
  
          if (popup1 != null)
          {
              popup1.Placement = PlacementMode.Top;
          }
          
          recent_users.IsDropDownOpen = true;
          popup1.PreviewMouseUp += new MouseButtonEventHandler((s,e) =&gt; popupClick(s,e,recent_users.SelectedItem.ToString()));
      }
  
      private void popupClick(object sender, MouseButtonEventArgs e, String recent)
      {
          usernameEnter.Text = recent;
          Trace.WriteLine(&quot;appending norms&quot;);
      }
  }
  </code></pre>
  <p>}</p>