How to update data in ComboBox after changing ListBox/db?

MeisonSan 40 Reputation points
when you click on the button (change delete add) a window opens with a TextBox in which I specify name, age
so after I click ok, the data is correctly displayed in LisBox, which I can’t say about comboBox





when you click Open_Click, a window opens with LisBox, which also displays name, age data and here it is possible to change delete add (new entry)1(1)

on the main window there is a comboBox that displays name, age data,1

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,350 questions
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
768 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiale Xue - MSFT 34,506 Reputation points Microsoft Vendor

    Hi @Максимилиан Янулевич, Welcome to Q&A. You could try the following code to get what you wanted.

    One easy way:

    //after modifying the data
    DataContext =db.Users.Local.ToObservableCollection(); 

    For real-time modification of Name and Age, change the binding method to:

    <TextBlock Text="{Binding Name,Mode=TwoWay}" FontSize="16"/>
    <TextBlock Text="{Binding Age, Mode=TwoWay}" FontSize="13"/>

    You may need to refer to this document:Binding declarations overview (WPF .NET)

    Another way you should implement INotifyPropertyChanged interface for your binding source object.

    Best Regards,


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful