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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:54:01+00:00 2026-05-25T23:54:01+00:00

ComboBox items do not reflect changes made from its source Here is what I

  • 0

ComboBox items do not reflect changes made from its source

Here is what I am trying to accomplish:
I have a WPF datagrid that binding to a database table, inside the datagrid there is a combobox(group ID) column bind to one of the columns from the database table; the combobox items are from another table(a list of group ID). The problem now is when the groupd ID list is changed from other table, the combo box items does not take effect.
Can anyone help? Have been stuct for a long time.

Here is XAML code:

<DataGridTemplateColumn Header="Group ID">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding GroupID, Mode=OneWay}"/>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <ComboBox Name="ComboBoxTeamGrpID" SelectedItem="{Binding GroupID, Mode=TwoWay}" ItemsSource="{StaticResource ResourceKey=GroupIDList}">
            </ComboBox>
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>

Here is the code for GroupIDList:

public class GroupIDList : List<string>
       {
           public GroupIDList()
        {
            try
            {

                string tmp = ConfigurationManager.AppSettings["DataSvcAddress"];
                Uri svcUri = new Uri(tmp);
                JP790DBEntities context = new JP790DBEntities(svcUri);

                var deviceQry = from o in context.Devices
                                where o.GroupID == true
                                select o;
                DataServiceCollection<Device> cList = new DataServiceCollection<Device>(deviceQry);

                for (int i = 0; i < cList.Count; i++)
                {
                    this.Add(cList[i].ExtensionID.Trim());
                }

                this.Add("None");

                //this.Add("1002");
                //this.Add("1111");
                //this.Add("2233");
                //this.Add("5544");
            }
            catch (Exception ex)
            {
                string str = ex.Message;
            }
        }
    }

Here is another problem related, can anyone help? thank you.

  • 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-25T23:54:01+00:00Added an answer on May 25, 2026 at 11:54 pm

    It is either because your GroupIdList is a List and not an ObservableCollection, or because you’re binding to a StaticResource, which WPF assumes is unchanged so is only loaded once.

    Change your List<string> to an ObservableCollection<string> which will automatically notify the UI when it’s collection gets changed, and if that still doesn’t work than change your ItemsSource from a StaticResource to a RelativeSource binding, such as

    ItemsSource="{Binding 
        RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
        Path=DataContext.GroupIdList}"
    

    Edit

    Your parent ViewModel which has your DataGrid’s ItemsSource collection should look something like below. Simply add another public property for GroupIdList and have it return your list. Then use the above RelativeSource binding to access it, assuming your DataGrid’s ItemsSource is bound in the form of <DataGrid ItemsSource="{Binding MyDataGridItemsSource}" ... />

    public class MyViewModel
    {
        private ObservableCollection<MyDataObject> _myDataGridItemsSource;
        public ObservableCollection<MyDataObject> MyDataGridItemsSource
        {
            get { return _myDataGridItemsSource; }
            set 
            {
                if (value != _myDataGridItemsSource)
                {
                    _myObjects = value;
                    ReportPropertyChanged("MyDataGridItemsSource");
                }
            }
        }
    
        private ObservableCollection<string> _groupIdList = new GroupIdList();
        public ObservableCollection<string> GroupIdList
        {
    
            get { return _groupIdList; }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ComboBox and its items source is an SQL table. I would
I have a combobox from which i need to programmatically disable items depending on
I'm trying to bind a XAML ComboBox so that its list items are the
I am trying to add some items to combobox, like its showed on msdn
I have a WPF 4 app with a ComboBox embedded in a DataGrid. The
This should be easy but it's not working. I have a WPF combobox bound
Vector comboBoxItems = new Vector(); DefaultComboBoxModel model; // ComboBox Items have gotten from Data
I'm trying to add items to a listbox,combobox, radiolist using reflection. The code I
I have set a list of items in a combobox, but when I debug
I want to have a select-only ComboBox that provides a list of items for

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.