Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:11:26+00:00 2026-06-06T12:11:26+00:00

I have been trying to find a solution to this one but could not

  • 0

I have been trying to find a solution to this one but could not find a relevant answer online.

I have a bunch of text boxes that I need to populate with data, for example in my case address. I have a combo box that is bound to an enum and has a list of values to select from

Home, Office, MainOffice, Laboratory. etc. When I make a selection on combobox, I need to populate its address in the text boxes below. I can get Home address from object X, Office Address from Object Y, MainOffice from Z. How do I do this conditional databinding using combobox selection. Please advise.

These are the options that I could select

public enum MailToOptions
{
    Home,
    Office,
    CorporateOffice,
    Laboratory,
}



    <!-- Row 1 -->
    <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Content="Mail To:" />
    <ComboBox Grid.Column="0" Grid.Row="1"  Grid.ColumnSpan="5" Name="MailToComboBox" 

     ItemsSource="{Binding Source={StaticResource odp}}"    
     SelectionChanged="HandleMailToSelectionChangedEvent" >

    </ComboBox>
    <!-- Agency ID -->


    <!-- Name -->
    <Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5" Content="Name" />
    <TextBox Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5">
        <TextBox.Text>
            <Binding Path="Order.Agency.PartyFullName" Mode="TwoWay" />
        </TextBox.Text>
    </TextBox>

    <!-- Row 2 -->

    <!-- Address Line 1 -->
    <Label Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="5" Content="Address 1" />
    <TextBox Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="5">
        <TextBox.Text>
            <Binding Path="Order.Agency.AddressLine1" Mode="TwoWay"     />
        </TextBox.Text>
    </TextBox>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:11:28+00:00Added an answer on June 6, 2026 at 12:11 pm

    The best way would be to make the items in your ComboBox objects, and bind your text fields to the ComboBox.SelectedItem

    For example,

    <ComboBox x:Name="AddressList" ItemsSource="{Binding Addresses}" DisplayMemberPath="Name" />
    
    <TextBox Text="{Binding SelectedItem.Street, ElementName=AddressList}" ... />
    <TextBox Text="{Binding SelectedItem.City, ElementName=AddressList}" ... />
    <TextBox Text="{Binding SelectedItem.State, ElementName=AddressList}" ... />
    <TextBox Text="{Binding SelectedItem.ZipCode, ElementName=AddressList}" ... />
    

    A cleaner way would be to set the DataContext of whatever panel holds the TextBoxes

    <ComboBox x:Name="AddressList" ItemsSource="{Binding Addresses}" DisplayMemberPath="Name" />
    
    <Grid DataContext="{Binding SelectedItem, ElementName=AddressList}">
        <TextBox Text="{Binding Street}" ... />
        <TextBox Text="{Binding City}" ... />
        <TextBox Text="{Binding State}" ... />
        <TextBox Text="{Binding ZipCode}" ... />
    </Grid>
    

    You can either bind the ComboBox to something like an ObservableCollection<Address>, or set the ItemsSource manually in the code behind.

    I’d recommending binding, however to set it manually in the code behind it would look something like this:

    var addresses = new List<Addresses>();
    addresses.Add(new Address { Name = "Home", Street = "1234 Some Road", ... });
    addresses.Add(new Address { Name = "Office", Street = "1234 Main Street", ... });
    ...
    AddressList.ItemsSource = addresses;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to find this information online but I'm not getting the answer.
I have been trying this for a while but can't find the right solution.
I've been trying to find a solution to this, but perhaps I'm not understanding
I've been trying to find a solution for this one for the last couple
I have been trying to find decent Image Acquisition + Image Processing solution at
I have been trying to find some resource on this topic for a while
This may have been asked already, but I can't find it, so here goes.
I have been looking around for an answer to my question but couldn't find
I've been trying to find the answer to this question here. Several people seem
I've been trying all night to find a solution to this problem and haven't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.