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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:30:51+00:00 2026-06-07T06:30:51+00:00

The Binding on the ComboBox Categories is not updating when a Division is selected.

  • 0

The Binding on the ComboBox Categories is not updating when a Division is selected.
When a division is selected the ProjectCategories Property does get populated with two results, but the view does not update.

If I send ProjectCategories as a ref through to ProjectCategoriesGetByDivisionId() then the binding does update.

I don’t want to pass references to my model and data classes. How can I have the binding update without changing my model and data classes?

Here is the Divisions ComboBox that changes the value of the binding for the Categories ComboBox.

<ComboBox x:Name="Divisions" ItemsSource="{Binding Divisions}" DisplayMemberPath="Name" SelectedValuePath="DivisionId">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="SelectionChanged">
            <cmd:EventToCommand Command="{Binding DivisionChanged}" CommandParameter="{Binding ElementName=Divisions, Path=SelectedItem}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</ComboBox>

The ComboBox that isn’t updating

<ComboBox x:Name="Categories" ItemsSource="{Binding Categories}" DisplayMemberPath="Name" SelectedValuePath="CategoryId" />

The method that gets fired when the Divisions SelectedChanged event is fired.

private void DivisionChanged(Division d)
{
    ProjectCategories = ProjectCategory.GetByDivisionId(d.DivisionId);
}

ViewModel Property the ComboBox is binding to

public ObservableCollection<ProjectCategory> ProjectCategories
{
    get { return projectCategories; }
    set
    {
        projectCategories = value;

        if (base.PropertyChangedHandler != null)
            base.PropertyChangedHandler(this, new PropertyChangedEventArgs("ProjectCategories"));
    }
}

Model Method that is called

public static ObservableCollection<ProjectCategory> GetByDivisionId(int divisionId)
{
    return ProjectData.ProjectCategoriesGetByDivisionId(divisionId);
}

I think the rest is self explanitory.

public static ObservableCollection<ProjectCategory> ProjectCategoriesGetByDivisionId(int divisionId)
{
    ObservableCollection<ProjectCategory> projectCategory = new ObservableCollection<ProjectCategory>();
    SqlConnection conn = null;

    try
    {
        conn = new SqlConnection(connectionString);
        SqlCommand cmd = new SqlCommand("TRK_ProjectCategory_GetByDivisionId", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@DivisionId", SqlDbType.Int).Value = divisionId;
        conn.Open();
        SqlDataReader sdr = cmd.ExecuteReader();

        while (sdr.Read())
            projectCategory.Add(ObjectConstructors.ProjectCategoryConstructor(sdr));
    }
    catch (Exception ex)
    {
        ErrorHandler.EmailLog("MineralsData", "public static ObservableCollection<ProjectCategory> ProjectCategoriesGetByDivisionId(int divisionId)", ex.ToString(), string.Empty);
        throw ex;
    }
    finally
    {
        if (conn != null)
            conn.Close();
        conn = null;
    }

    return projectCategory;
}

public static ProjectCategory ProjectCategoryConstructor(SqlDataReader dr)
{
    ProjectCategory ec = new ProjectCategory();

    ec.CategoryId = dr["CategoryId"].SDR_GetInt();
    ec.Name = dr["Name"].SDR_GetString();
    ec.Description = dr["Description"].SDR_GetString();
    ec.LastModified = dr["LastModified"].SDR_GetDateTime();
    ec.ModifiedBy = dr["ModifiedBy"].SDR_GetString();

    return ec;
}

Thanks for any 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-06-07T06:30:53+00:00Added an answer on June 7, 2026 at 6:30 am

    Your combobox is binding to a property called “categories”. You don’t show any other code for this property. It will only update if you call propertychanged event for categories. Did you mean to bind to “ProjectCategories”?

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

Sidebar

Related Questions

The combobox binding below works if I specify the ancestor, but otherwise not. Why
I have an updating issue with Binding in my ComboBox. I have created a
I have a combobox (ItemsSource={Binding Path=AvailableDrives}). The AvailableDrives property is defined like this: public
Question: How do you set the binding for a ComboBox's Selected items to one
I have a property bound to ComboBox <ComboBox ItemsSource={Binding AvailableTypes} SelectedValue={Binding Kind, Mode=TwoWay}}/> and
I am binding a combobox selected index to an integer value (Mode) in my
I am trying to do the following: Data Binding in Combobox but with multi-binding..
Unless I add DisplayMemberPath on the combobox it does not work. I think it
I have been going crazy with binding a combobox to an enum typed property
The scenario is almost the same as http://arsalantamiz.blogspot.com/2008/09/binding-datagridview-combobox-column.html . but I can't get it

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.