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 3285198
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:14:24+00:00 2026-05-17T20:14:24+00:00

Hi all I have a combobox which is databound to a list of elements.

  • 0

Hi all
I have a combobox which is databound to a list of elements. But in addition to that list of elements, i want to have another item. This item should display the text ‘New…’
The idea is if they select one of the normal elements, it performs some action involving that element. If they select the ‘New’ element, it will take them to a screen where they can create a new item.
The problem is, When you databind something you dont get the option to add another item to it, and there is no question of adding a dummy item to the list of elements…

Is this an opportunity to create a new control based on the ComboBox which has a ‘DefaultElement’ property? (with all of the associated templating and command binding etc)

  • 1 1 Answer
  • 1 View
  • 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-05-17T20:14:25+00:00Added an answer on May 17, 2026 at 8:14 pm

    To do this I have previously created a dummy wrapper class for the normal type, allowing you to bind to a list containing mostly the correct values and also your “New…” one, e.g.

    public class DisplayClass
    {
        public DisplayClass(ModelClass mc)
        {
             this.mc = mc;
        }
    
        public string Name
        {
            get { return this.mc != null ? this.mc.Name : "New..."; }
        }
    
        public bool IsDummy
        {
            return this.mc == null;
        }
    
        public ModelClass Model
        {
            return this.mc;
        }
    }
    

    You can then host a collection of these in your data context (ViewModel), and handle the selection appropriately based on IsDummy. It’s not as automatic as a control with this functionality built in, but is pretty simple and could probably easily be made generic and so reusable.

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

Sidebar

Related Questions

I have a combobox that populates with a list of addresses: this.entityAddressField = new
I have a comboBox that is bound to a list of strings from my
How can have a combobox which has all values from a specific column in
I have about 8 entities that all have a one to one relationship with
I have three classes that all have a static function called 'create'. I would
I have 50 newsletters which all have different email accouts, hex colour codes and
I have a database with Points of Interest that all have an address. I
I have a form[method=get] which has a number of checkboxes all have the same
i have hundreds of [mostly different] files in many different directories that all have
I have 3 similar tables, that would all have the same enum type field.

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.