title: WPF ComboBox Hide (Disable) DropDown Button Programmatically
body: <p>I would like to know how to disable ComboBox DropDown Button Programmatically. I had seen many similar subjects but all of these have a XAML solution.</p>
  
  <p>By the way, if someone know how to disable all ComboBox control design and left visible only item template it can be helpful too.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>its my XAML definition</p>
  
  <pre><code>&lt;ComboBox Name="lang_ComboBox" SelectionChanged="LanguageSelection_ComboBox_SelectionChanged"/&gt;
  </code></pre>
  
  <p>And there is how i use it:</p>
  
  <pre><code>String text = "dorf";
  BitmapImage image = new BitmapImage(new Uri("http://img88.imageshack.us/img88/4351/butchermi4.png"));
  lang_ComboBox.Width = 100;
  lang_ComboBox.Height = 30;
  Grid sp;
  for (int i = 0; i &lt; 5; i++)
  {
      ColumnDefinition gridCol1 = new ColumnDefinition();
      gridCol1.Width = new GridLength(30.0);
      ColumnDefinition gridCol2 = new ColumnDefinition();
      gridCol2.Width = new GridLength(70.0);
      sp = new Grid()
      {
          Width = 100,
          Height = 30
      };
      Image im = new Image()
      {
          Source = image,
          Width = 25,
          Height = 25
      };
      Label la = new Label() 
      { 
          Content = text
      };
      sp.ColumnDefinitions.Add(gridCol1);
      sp.ColumnDefinitions.Add(gridCol2);
      Grid.SetColumn(im, 0);
      Grid.SetColumn(la, 1);
      sp.Children.Add(la);
      sp.Children.Add(im);
      lang_ComboBox.Items.Add(sp);
  }
  </code></pre>
  
  <p><strong>UPDATE 2</strong>
  Hmmm I get it now, I use wrong word. It should be "Hide" control design and still can choose from a list. My bad sorry. But i know how i can solve it with Anatoliy Nokolaev's Code. To hide control design i use:</p>
  
  <pre><code>ToggleButton dropDownButton = GetFirstChildOfType&lt;ToggleButton&gt;(lang_ComboBox);
  dropDownButton.Visibility = System.Windows.Visibility.Collapsed;
  </code></pre>
  
  <p>Unwanted behavior is now only that i cant show combobox dropdownmenu, but I'll invoke it programmatically by add on click event and should be good.</p>
  
  <p>If there is any easiest way to do this tell me :).</p>