title: Setting and removing ToolTips in WPF
body: <p>I'm having an issue that I just can't get figured out.</p>
  
  <p>I have a WPF window that is a representation of a physical keyboard used in a POS application. Each physical button is represented by a WPF button.  The user will click on a button which opens another window with controls to change the function that is assigned to it.  When the user hovers over the button, a tooltip is displayed showing the currently assigned function.</p>
  
  <p>After the new settings are set, I need to refresh the toolTips.  The new tooltips appear correctly, but the old ones do not remove.  If I use <code>Button.ToolTip = null</code>, all the tool tips disappear.  If I use <code>Button.ToolTip = String.Empty</code>, I get a blank tooTip.  I don't want any tooltip displayed if there is not function assigned to the button.</p>
  
  <p>How do I simply remove / deactivate the toolTip when there is nothing to show?</p>
  
  <p>loadToolTips() is fired during the Window_Activated event in the parent window.</p>
  
  <p>Code:</p>
  
  <pre><code>private void loadToolTips()
          {
              JPOSDB db = new JPOSDB();
              SqlDataReader dr = default(SqlDataReader);
              StringBuilder tt = new StringBuilder();
  
              dr = db.getDR("SELECT KeyName, FunctionName, Parameter1, Parameter2 FROM KeyboardSettings JOIN KeyboardFunctions ON KeySetting = FunctionID WHERE KeyboardID = " + runTime.keyboardID);
  
              while (dr.Read())
              {
                  foreach (Control ctrl in grdButtons.Children)
                  {
                      if (ctrl.GetType() == typeof(Button))
                      {
                          Button button = new Button();
                          button = (Button)ctrl;
                          button.ToolTip = null;   &lt;--- Causes all tool tips to disappear
  
                          if (button.Name.ToString() == dr[0].ToString())
                          {
                              tt.Clear();
                              tt.Append("Function: " + dr[1].ToString());
  
                              if (dr[2].ToString().Length &gt; 0)
                              {
                                  tt.Append(Environment.NewLine);
                                  tt.Append("Value: " + dr[2].ToString());
                              }
  
                              if (dr[3].ToString().Length &gt; 0)
                              {
                                  tt.Append(Environment.NewLine);
                                  tt.Append("Name: " + dr[3].ToString());
                              }
  
                              button.ToolTip = tt.ToString();                    
                          }
                      }
                  }
              }
  
              dr.Close();
          }
  </code></pre>