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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:42:33+00:00 2026-05-20T16:42:33+00:00

I have an ObservableCollection called Collection1 that I want to bind to the ItemsSource

  • 0

I have an ObservableCollection called Collection1 that I want to bind to the ItemsSource of a ListBox through a converter.

When I specify a converter, the binding does not work — it uses the converter for initialization only, and never again.

When I do not specify a converter, the binding works, but the user control does not display correctly because it does not understand the .

I learned that the CollectionChanged event handler was not being set when the converter was specified, but was set when the converter was not specified. I do not know why this is the case.

To summarize:

This does not work:

<ListBox Name="theListBox" 
         Margin="8,28,8,8"
         ItemsSource="{Binding Collection1, Converter={StaticResource myConverter}}"
         ItemContainerStyle="{DynamicResource ContainerStyle}" /> 

Collection1.CollectionChanged is null.

This does work:

<ListBox Name="theListBox" 
         Margin="8,28,8,8"
         ItemsSource="{Binding Collection1}"
         ItemContainerStyle="{DynamicResource ContainerStyle}" /> 

Collection1.CollectionChanged is not null.

If anyone could help I’d appreciate it. Thanks!


Here was my solution to this problem, based on the other comments below.

Instead of binding through a converter, I created an ObservableCollection property in the class for binding and then manually subscribed to the Collection1.CollectionChanged event in the code.

public partial class MyScreen : UserControl
{
    public ObservableCollection<Class2> BindingCollection { get; set; }  // <-- Bind to this

    public MyScreen()
    {
        this.InitializeComponent();

        BindingCollection = new ObservableCollection<Class2>();

        Collection1.CollectionChanged += new NotifyCollectionChangedEventHandler(Collection1_CollectionChanged);
        MediViewData.Instance.ActivePatientCareReport.PropertyChanged += new PropertyChangedEventHandler(ActivePatientCareReport_PropertyChanged);

    }

    void Collection1_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    {
        BindingCollection.Clear();

        foreach (var c1 in Collection1)
        {
            var c2 = ConvertClass1ToClass2(c1);
            if (c2 != null) BindingCollection.Add(c2);
        }
    }
}

The XAML looks something like:

<ListBox x:Name="MyListBox" 
         Margin="8,28,8,8"
         ItemContainerStyle="{DynamicResource ContainerStyle}" 
         ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=BindingCollection}" />

That seems to work just fine.

  • 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-20T16:42:34+00:00Added an answer on May 20, 2026 at 4:42 pm

    ItemsControl.ItemsSource has logic to connect to the CollectionChanged event and update its Items collection accordingly. Unless you’re returning the same ObservableCollection instance from the converter, the CollectionChanged notifications have no way to propagate automatically from the Binding through the converter.

    A precise fix would depend on what’s happening in the converter.

    UPDATE

    Instead of converting the collection from one generic type to another, trying using the original ObservableCollection and instead change the converter to convert individual items and apply it to each by using it in the ItemTemplate of the control.

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

Sidebar

Related Questions

I have an ObservableCollection of addresses that I am binding to a ListBox. Then
If i have a ListView (called MainList) and want to bind to elements in
I have a combobox which has ItemsSource set to an ObservableCollection property called DATA
I have a converter that accepts an ObservableCollection as a parameter, and I'd like
I have a ListBox called NotesList. I have an ObservableCollection called noteList, and I
I have an instance of ObservableCollection bound to a WPF listbox with two separate
I have ItemsControl which I bind to ObservableCollection On my view model I just
I have some records inside an ObservableCollection. void proxy_AddPayNowOrderCompleted(object sender, AddPayNowOrderCompletedEventArgs e) { listBox1.ItemsSource
I have a class with an ObservableCollection called List and I am trying to
I have the following code in my XAML: <ItemsControl ItemsSource={Binding Dimensions}> <ItemsControl.ItemTemplate> <DataTemplate> <Grid>

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.