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

  • SEARCH
  • Home
  • 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 7951821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:40:42+00:00 2026-06-04T02:40:42+00:00

So, I have a customer table, containing customer records, record, each of which has

  • 0

So, I have a customer table, containing customer records, record, each of which has a customertype field. I also have a customertype table, containing the valid values for the customertype field.

And I need a WPF to do CRUD. (Create, Review, Update, Delete).

The obvious solution is to use a ComboBox, with its SelectedValue property bound to the customertype field, and its ItemsSource property bound to a list populated by a query of the customertype table.

Problem is, this doesn’t work except in the sort of simple problem that you see in exercises.

The difficulty arises when you are viewing or editing a customer record that has a customertype value that isn’t in the customertype table. This can happen by error, or it can happen because the customertype has been deprecated, and removed from the table.

What WPF does, in this circumstance, is to set the customertype field to null, because the SelectedValue isn’t in the ItemsSource list. And that’s a problem.

If you’re only viewing, you should see the value that is in the table, regardless of whether it is in the list. If you’re editing, you can make a reasonable argument that you should also show the value that is in the table, at least initially, though if you change the selection, you can’t get what you started with.

So, any ideas? This is a problem that occurs on pretty much every edit/view form I have, so I’d prefer something that is reasonably clean at point of use. (That is, given the choice of complication in the XAML, everyplace I need to handle one of these fields, or complication in the code that backs the XAML I insert to handle one of these fields, I’d prefer the latter.)

  • 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-04T02:40:43+00:00Added an answer on June 4, 2026 at 2:40 am

    For this, I would suggest not binding your ItemsSource directly to the contents of the CustomerType table. Instead, merge an ItemsSource for Customer Type items in the Customer Type tables AND all the CustomerType values stored in Customer records which do not exist in the Customer Type table. Once the user goes from viewing into edit, update the collection to use only those items in the CustomerType table. When the user goes into view mode, switch back to the merged collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a Customer table which has a PrimaryContactId field and a
I have a customer table, which has a field categories. It's a string holding
I have a Customer table with 200.000+ records which i have to loop through
I have a MySQL table that defines values for a specific customer type. |
I have a SQL table containing customer information (we'll call it CustomerDB ), including
I have a relational table containing a foreign key in which there is no
Say I have a typical customer table; Id Int Identity Primary Key, FirstName varchar(255),
I have a performance problem on a query. First table is a Customer table
I have a simple database named customer with a single table data.I want to
I have a Customers table and would like to assign a Salesperson to each

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.