<Window
  x:Class="DisplayAndValueMemberBinding.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:DisplayAndValueMemberBinding"
  Title="DisplayAndValueMemberBinding"
  Height="300"
  Width="300">
  <Window.Resources>
    <local:People x:Key="Family">
      <local:Person Name="Tom" Age="11" />
      <local:Person Name="John" Age="12" />
      <local:Person Name="Melissa" Age="38" />
    </local:People>

    <local:NamedAges x:Key="NamedAgeLookup">
      <local:NamedAge NameForAge="zero" AgeId="0" />
      <local:NamedAge NameForAge="one" AgeId="1" />
      <local:NamedAge NameForAge="two" AgeId="2" />
      <local:NamedAge NameForAge="three" AgeId="3" />
      <local:NamedAge NameForAge="four" AgeId="4" />
      <local:NamedAge NameForAge="five" AgeId="5" />
      <local:NamedAge NameForAge="six" AgeId="6" />
      <local:NamedAge NameForAge="seven" AgeId="7" />
      <local:NamedAge NameForAge="eight" AgeId="8" />
      <local:NamedAge NameForAge="nine" AgeId="9" />
      <local:NamedAge NameForAge="ten" AgeId="10" />
      <local:NamedAge NameForAge="eleven" AgeId="11" />
      <local:NamedAge NameForAge="twelve" AgeId="12" />
      <local:NamedAge NameForAge="thirteen" AgeId="13" />
      <local:NamedAge NameForAge="fourteen" AgeId="14" />
      <local:NamedAge NameForAge="fifteen" AgeId="15" />
      <local:NamedAge NameForAge="sixteen" AgeId="16" />
      <local:NamedAge NameForAge="seventeen" AgeId="17" />
      <local:NamedAge NameForAge="eighteen" AgeId="18" />
      <local:NamedAge NameForAge="nineteen" AgeId="19" />
      <local:NamedAge NameForAge="twenty" AgeId="20" />
      <local:NamedAge NameForAge="twenty-one" AgeId="21" />
      <local:NamedAge NameForAge="twenty-two" AgeId="22" />
      <local:NamedAge NameForAge="twenty-three" AgeId="23" />
      <local:NamedAge NameForAge="twenty-four" AgeId="24" />
      <local:NamedAge NameForAge="twenty-five" AgeId="25" />
      <local:NamedAge NameForAge="twenty-six" AgeId="26" />
      <local:NamedAge NameForAge="twenty-seven" AgeId="27" />
      <local:NamedAge NameForAge="twenty-eight" AgeId="28" />
      <local:NamedAge NameForAge="twenty-nine" AgeId="29" />
      <local:NamedAge NameForAge="thirty" AgeId="30" />
      <local:NamedAge NameForAge="thirty-one" AgeId="31" />
      <local:NamedAge NameForAge="thirty-two" AgeId="32" />
      <local:NamedAge NameForAge="thirty-three" AgeId="33" />
      <local:NamedAge NameForAge="thirty-four" AgeId="34" />
      <local:NamedAge NameForAge="thirty-five" AgeId="35" />
      <local:NamedAge NameForAge="thirty-six" AgeId="36" />
      <local:NamedAge NameForAge="thirty-seven" AgeId="37" />
      <local:NamedAge NameForAge="thirty-eight" AgeId="38" />
      <local:NamedAge NameForAge="thirty-nine" AgeId="39" />
    </local:NamedAges>
  </Window.Resources>
  <Grid DataContext="{StaticResource Family}">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <ListBox Name="lb" Grid.Row="0" Grid.Column="1" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" Margin="5" DisplayMemberPath="Name" SelectedValuePath="Age" />

    <TextBlock Grid.Row="1" Grid.Column="0" Margin="5" VerticalAlignment="Center">Name:</TextBlock>
    <TextBox Grid.Row="1" Grid.Column="1" Margin="5" Text="{Binding Path=Name}" />
    <TextBlock Grid.Row="2" Grid.Column="0" Margin="5" VerticalAlignment="Center">Age:</TextBlock>
    <ComboBox Grid.Row="2" Grid.Column="1" Margin="5" ItemsSource="{Binding Source={StaticResource NamedAgeLookup}}" DisplayMemberPath="NameForAge" SelectedValuePath="AgeId" SelectedValue="{Binding Path=Age}" />
    <StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal">
      <Button Name="birthdayButton" Width="75" Margin="5">Birthday</Button>
      <Button Name="backButton" Width="75" Margin="5">&lt;</Button>
      <Button Name="forwardButton" Width="75" Margin="5">&gt;</Button>
    </StackPanel>
  </Grid>
</Window>
