Playing with ComboBox.

Today I was playing little with ComboBox, and I made some binding, so here is my XAML:

<Window x:Class="TemplateChooser.MainWindow"
        Title="MainWindow" Height="350" Width="525">
            <viewModel:TemplateChooserViewModel x:Key="TemplateChooserViewModel" />
          <RowDefinition Height="30"/>
          <RowDefinition Height="30"/>
        <ComboBox Name="myCombo" DataContext="{StaticResource TemplateChooserViewModel}" ItemsSource="{Binding TemplateItems}" SelectedValue="{Binding TemplateItems[0]}"/>
        <Button Grid.Row="1" Content="{Binding Path=SelectedValue, ElementName=myCombo}"/>

Here notice line:

SelectedValue="{Binding TemplateItems[0]}"

After that, notice how I binded button

<Button Grid.Row="1" Content="{Binding Path=SelectedValue, ElementName=myCombo}"/>

I am not sure if this binding is proper, but it is working :)

Here is my view model:

public class TemplateChooserViewModel
	public IEnumerable<string> TemplateItems { get; set; }

	public TemplateChooserViewModel()
		TemplateItems = new[] { "Template1", "Template2" };

Example project you can download from here.