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

The Archive Base Latest Questions

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

im having a View with a ComboBox bound to my viewModel property. Everything works

  • 0

im having a View with a ComboBox bound to my viewModel property.
Everything works fine but i actually want to reuse my View and need to
update the controls with a given value. Setting the property wont update the visual UI
even to event is fired and everyting looks good.

Everything works accept the ComboBox visual UI.

Tips?!

XAML control

<telerik:RadComboBox 
            ItemTemplate="{StaticResource SelectUserComboBoxTemplate}"
            SelectedItem="{Binding Path=SelectedUser, Mode=TwoWay,
            UpdateSourceTrigger=PropertyChanged}" 
            ItemsSource="{Binding Path=C_users}" 
            telerik:TextSearch.TextPath="displayName"
            Name="radComboBox1" 
            Margin="14,12,0,0" 
            Height="31" 
            VerticalAlignment="Top" 
            HorizontalAlignment="Left" 
            Width="253" 
            TextSearchMode="Contains"
            IsEditable="True"
            OpenDropDownOnFocus="True" 
            IsFilteringEnabled="True"
            >
    </telerik:RadComboBox>

The overloaded constructor that sets the values

    public TicketControlTabViewModel(ticket t)
    {
        activeTicket = t;
        SelectedUser = customerServiceClient.getUser(t.customer_users.id);
        MetaString = t.meta;
        Description = t.description;
        ActiveId = t.id.ToString();
        Selected_priority = t.priority;
        SelectedStatus = t.status;
        this.RefreshC_users();
        this.RefreshSupportDepartments();
        this.RefreshSupportUsers();
    }

The property in my ViewModel

    private customer_users selectedUser { get; set; }
    public customer_users SelectedUser
    {

        get {
            return this.selectedUser;
            }
        set {
              if (value != null){
              this.selectedUser = value;
              this.UpdateCustomerDepartment(value);
              this.OnPropertyChanged("SelectedUser");
              SaveTicket();
              }

            }
    }
  • 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-27T06:12:52+00:00Added an answer on May 27, 2026 at 6:12 am

    By default, WPF compares the SelectedItem by reference, not by value. That means if the SelectedItem isn’t the exact same object in memory as the item in your ItemsSource, then the comparisom will return false and the item will not get selected.

    For example, this will probably not work

    MyCollection = new ObservableCollection<User>(DAL.GetUsers());
    SelectedUser = DAL.GetUser(1);
    

    however this would:

    MyCollection = new ObservableCollection<User>(DAL.GetUsers());
    SelectedUser = MyCollection.FirstOrDefault(p => p.Id == 1);
    

    That’s because the 2nd example sets the SelectedUser to an item that actually exists in MyCollection, while the 1st example might not. Even if the data is the same, they reference different objects in memory.

    If your selected item doesn’t reference the same item in memory as your ItemsSource item, then either use SelectedValue and SelectedValuePath to bind your ComboBox’s default selection, or overwrite the .Equals() method of your class to return true if the data in the objects being compared is the same.

    public override bool Equals(object obj)
    {
        if (obj == null || !(obj == MyClass))
            return false; 
    
        return ((MyClass)obj).Id == this.Id);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

G'day! I want my WPF ComboBox to display some alternative text when its data-bound
I'm having issues using a GridView as a ListView's View, what I want to
I want to make a custom List View having Two TextViews and a radio
I an having list view of Image and i want something like...when user long
I'm having 5 view controllers in my navigation based application, I need to support
I want to implement a view having two layers on it. Then i want
How do I go about having two view models communicate with one another using
Having this XML view: <?xml version=1.0 encoding=utf-8?> <LinearLayout android:id=@+id/myScrollLayout android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical xmlns:android=http://schemas.android.com/apk/res/android> <ScrollView
I am having an Android view with a Spinner on it. I call a
In ASP.NET MVC it's possible to choice between having a typed view were you

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.