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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:51:27+00:00 2026-05-25T12:51:27+00:00

I am losing the selected value when going from one item to the other.

  • 0

I am losing the selected value when going from one item to the other. My combox box is like this :

<local:ComboBoxEx x:Name="MYCB" 
       ItemsSource="{Binding Committente}" 
       SelectedValue="{Binding CommittenteSelected, Mode=TwoWay}"
       SelectionChanged="committente_SelectionChanged"
/>

Committente comes from the ViewModel :

private ObservableCollection<CommittenteV> _Committente;
public ObservableCollection<CommittenteV> Committente
{
    get { return _Committente; }
    set
    {
        _Committente = value;
        RaisePropertyChanged("Committente");
    }
}

in the constructor of my viewmodel, I get my collection done like this :

Committente = ObservableCollectionConverter.GetObservableCollection<CommittenteV>(Service.getList);
Committente.Insert(0, null);

And I add a null Item in order to be able to have an item which symbolises “All Items”

My problem is that going from “real” items to this null item, I do not get CommittenteSelected equal to null but instead the value of the precedent item selected.

If this is not working, how could I decently implement this “all item” featur to feed the combobox of my filters ?

Thanks for your help,

  • 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-05-25T12:51:27+00:00Added an answer on May 25, 2026 at 12:51 pm

    You could also create a child object, of your CommittenteV object, so that when you are checking which object was selected you can use the ‘is’ operator.

    public class AllCommittenteV : CommittenteV, IRepresentAll {}
    
    Committente.Insert(0, new AllCommittenteV());
    
    if (SelectedItem is typeof(AllCommittenteV))
       // Use All
    else
       // Use One
    

    This opens the door for you to be able to create a Processor class, that you can inject into your hosting VM. Throw the processor class into the SelectionChanged method and you can change the entire behavior of the class, by simply changing what Precessor you inject.

    Using the interface you have a contract that states anytime this object is represented, to treat that object as if, all was selected.

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

Sidebar

Related Questions

I have a form, like so: <form action= method=post> <select name=pageType> <option value=main>Main Page</option>
Losing my mind with this one. My button gets a commandargument of empty string
Losing my mind on this one.. How can I do something as simple as..
I am currently having an issue of losing a message. This error occurs rarely,
Is there a way to suppress the output from popen() without losing the Wait().
I want to enable/disable a ComboBox based on if there is an item selected
This function returns text that the user has selected and wraps it in tags,
losing sleep over this issue My app hierarchy is ListVC1-->ListVC2-->DetailVC. [Working perfect] and... SearchListVC-->DetailVC
Maybe I'm losing my mind - I thought this was straight forward. ListCode.DataTextField =
For parsing JSON like this twitter API users/show response I've been using Jackson and

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.