title: WPF Combobox with string Bind to Int property
body: <p>I want a Combobox with numbers 1-8 and bind the selected value to a property "NumberOfZones" of int type. By default, combobox returns string value so this can't be saved in int property. How do I type cast it to int. </p>
  
  <p>How do I set items and make selection in int. </p>
  
  <pre><code>   &lt;ComboBox Background="#FFB7B39D" Height="23" Name="cboNumZones" Width="74" Margin="158,16,368,247" Grid.Row="2" SelectionChanged="cboNumZones_SelectionChanged" 
      SelectedValue="{Binding Path=NumberOfZones, Mode=TwoWay}"&gt;
     &lt;/ComboBox&gt;
                  &lt;!--
                  &lt;ComboBoxItem &gt;1&lt;/ComboBoxItem&gt;
                      &lt;ComboBoxItem &gt;2&lt;/ComboBoxItem&gt;
                      &lt;ComboBoxItem &gt;3&lt;/ComboBoxItem&gt;
                      &lt;ComboBoxItem &gt;4&lt;/ComboBoxItem&gt;
                      &lt;ComboBoxItem &gt;5&lt;/ComboBoxItem&gt;
                      &lt;ComboBoxItem &gt;6&lt;/ComboBoxItem&gt;
                      &lt;ComboBoxItem &gt;7&lt;/ComboBoxItem&gt;
                      &lt;ComboBoxItem &gt;8&lt;/ComboBoxItem&gt;
                  --&gt;
  </code></pre>
  
  <p>The object that contains NumberOfZones property is the DataContext of the UserControl.</p>
  
  <p>Many Many Thanks.</p>