title: WPF .NET4.0 Listbox and ItemsControl
body: <p>Im trying to populate a ListBox with items. The <code>ItemsSource</code> is as follows:</p>
  
  <pre><code>public SortedDictionary&lt;string, List&lt;int&gt;&gt; AvailableValues
  </code></pre>
  
  <p>when I have the following the items seem to be nicely layed out. Except that I cant select a whole item and perform some function on it.</p>
  
  <pre><code>&lt;ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" &gt;
          &lt;ItemsControl ItemsSource="{Binding AvailableValues}"&gt;
  
              &lt;ItemsControl.Template&gt;
                  &lt;ControlTemplate&gt;
                      &lt;CustomControls:UniformWrapPanel IsItemsHost="True"/&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/ItemsControl.Template&gt;
  
              &lt;ItemsControl.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
  
                      &lt;Grid&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height="*"/&gt;
                          &lt;/Grid.RowDefinitions&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="*"/&gt;
                              &lt;ColumnDefinition Width="60"/&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
  
  
                          &lt;Label  Grid.Row="0" Grid.Column="0" Content="{Binding Key}" /&gt;
                          &lt;ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Value}" SelectedItem="{Binding SelectedInputValue, UpdateSourceTrigger=PropertyChanged}" IsSynchronizedWithCurrentItem="True" /&gt;
  
                      &lt;/Grid&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ItemsControl.ItemTemplate&gt;
          &lt;/ItemsControl&gt;
      &lt;/ScrollViewer&gt;
  </code></pre>
  
  <p>Ive tried replacing <code>ItemsControl</code> with <code>ListBox</code> (as well as <code>ListBox.ItemTemplate</code>) and cant seem to get a display where by the <code>Label</code> <code>Content</code> is left aligned and the <code>Combobox</code> content is right aligned. </p>
  
  <p>The <code>UniformWrapPanel</code> is from the CodeProject article.</p>
  
  <p>Thanks,</p>