Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The best way would be to make the items in your <code>ComboBox</code> objects, and bind your text fields to the <code>ComboBox.SelectedItem</code></p> <p>For example, </p> <pre><code>&lt;ComboBox x:Name="AddressList" ItemsSource="{Binding Addresses}" DisplayMemberPath="Name" /&gt; &lt;TextBox Text="{Binding SelectedItem.Street, ElementName=AddressList}" ... /&gt; &lt;TextBox Text="{Binding SelectedItem.City, ElementName=AddressList}" ... /&gt; &lt;TextBox Text="{Binding SelectedItem.State, ElementName=AddressList}" ... /&gt; &lt;TextBox Text="{Binding SelectedItem.ZipCode, ElementName=AddressList}" ... /&gt; </code></pre> <p>A cleaner way would be to set the <code>DataContext</code> of whatever panel holds the TextBoxes</p> <pre><code>&lt;ComboBox x:Name="AddressList" ItemsSource="{Binding Addresses}" DisplayMemberPath="Name" /&gt; &lt;Grid DataContext="{Binding SelectedItem, ElementName=AddressList}"&gt; &lt;TextBox Text="{Binding Street}" ... /&gt; &lt;TextBox Text="{Binding City}" ... /&gt; &lt;TextBox Text="{Binding State}" ... /&gt; &lt;TextBox Text="{Binding ZipCode}" ... /&gt; &lt;/Grid&gt; </code></pre> <p>You can either bind the ComboBox to something like an <code>ObservableCollection&lt;Address&gt;</code>, or set the <code>ItemsSource</code> manually in the code behind.</p> <p>I'd recommending binding, however to set it manually in the code behind it would look something like this:</p> <pre><code>var addresses = new List&lt;Addresses&gt;(); addresses.Add(new Address { Name = "Home", Street = "1234 Some Road", ... }); addresses.Add(new Address { Name = "Office", Street = "1234 Main Street", ... }); ... AddressList.ItemsSource = addresses; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload