Questions tagged [inotifycollectionchanged]

is a .NET interface for providing collection subscribers notification on changes, mostly used in WPF UI binding.

From MSDN: You can enumerate over any collection that implements the IEnumerable interface. However, to set up dynamic bindings so that insertions or deletions in the collection update the UI automatically, the collection must implement the INotifyCollectionChanged interface. This interface exposes the CollectionChanged event that must be raised whenever the underlying collection changes.

WPF provides the ObservableCollection class, which is a built-in implementation of a data collection that exposes the INotifyCollectionChanged interface. For an example, see How to: Create and Bind to an ObservableCollection.

The individual data objects within the collection must satisfy the requirements described in the Binding Sources Overview.

120 questions
0
votes
2 answers

Custom IEnumerable as ItemsSource for ListBox

I have a class that defines a custom GetEnumerator() function(by implementing IEnumerable<>). I use it to iterate in a contiguous manner over several ObservableCollection that are in every TestStep. I have a private…
Michael
  • 1,437
  • 1
  • 16
  • 34
0
votes
1 answer

Delete items from LongListMultiSelector

I'm new to Windows Phone 8 development. I've been working with it for about a month now and have written my own news app consuming data from an API. I save article content offline into the app's local storage as .json files. Since I have already…
0
votes
1 answer

VB.NET Index '0' is out of range?

I made a ListBox in WPF with an ItemSource and with all those classes and events that make the UI refresh it. But there's a problem in my Remove method: Public Sub Remove(ItemIndex As Integer) MyList.RemoveAt(ItemIndex) RaiseEvent…
Jan Böhm
  • 79
  • 11
0
votes
1 answer

wpf dataGrid sum cell with entities

I display dataGrid in WPF and entity framework, column 2 has a price per unit column 3 has the quantity (column 4 has the discount), I want column 5 will be the summary. My question is how I can capture the third column and calculate the change to…
0
votes
1 answer

WPF Create user control dynamically on change of observablecollection OR Visualize nested ObservableCollections by using nested User controls

I am new to WPF, and I can't find a solution to my problem. I've got an Observable Collection in my ViewModel: ObservableCollection Within the Process class is another ObervableCollection: ObservableCollection I want to add a…
0
votes
1 answer

Why doesn't assignment to ObservableCollection destroy CollectionChanged subscribers list?

I have an ObservableCollection which I need to replace via a reload button. During trying this out I found out that the CollectionChanged event fires even though the variable "myCollection" was nullified in "ReLoadData" (see code example below) and…
0
votes
1 answer

UI not binding to INotifyCollectionChanged

I have some collection that implements INotifyCollectionChanged. public sealed class GroupCollection : INotifyCollectionChanged, IList { //... public event NotifyCollectionChangedEventHandler CollectionChanged; private void…
b1n0m
  • 283
  • 3
  • 10
0
votes
1 answer

What is the best way of refreshing dependency tree of calculated properties?

I've got some classes here that all more or less rely on each other. The relationships form kinda like a dependency tree: class A { List _bs = new List(); public int ValueOfA { get { return _bs.Sum(p => p.ValueOfB); …
0
votes
1 answer

How can I map two observable collections together?

I have an interesting problem. I have an existing module that exposes and maintains an observable collection of entities. I want to have an observable collection or some implementation of INotifyCollectionChanged that keeps in step with the adds and…
Jordan
  • 8,881
  • 8
  • 63
  • 130
0
votes
1 answer

Silverlight Data Binding to Collection within Collection

Hopefully someone can help me out with this. I am creating a Silverlight app which is used for editing images. A user has a project which contain layers which contain elements. (Elements are text and image elements). I have a class which represents…
0
votes
1 answer

Can't get change notification from Collection to UI control bound to a LINQ query

I'm trying to solve a simple problem using LINQ, which I'm just learning. I have a collection of strings, in this case representing serial ports, that will be displayed in a control, but must be ordered. The original collection is unsorted, and I…
Steve
  • 6,085
  • 2
  • 35
  • 62
-1
votes
1 answer

ObervableCollection, CollectionChanged and PropertyChanged

I've been trying to figure out how to solve my problem for days. I have a data structure similar to this (I use PropertyChanged.Fody library): public class Item1 : INotifyPropertyChanged { public event PropertyChangedEventHandler…
-1
votes
2 answers

Why there is list of changes in observable collection event args?

I'm trying to understand why there are two list properties NewItems and OldItems while you can only add or remove single item at a time? private void InternalCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) { var changes =…
-1
votes
1 answer

INotifycollectionchanged on ICollection object

I want to observe changes in Icollection object given that I can't changed type of the object to observablecollection.How can it be achieved? mycollectionobserver = Observable.FromEventPattern
-2
votes
1 answer

Edit DataGridViewCell without having an ObservableCollection as ItemsSource

it took me quite some time to figure out that a DataGridView wont allow editing Cells if the ItemsSource is not an ObservableCollection. Am I right in that assumption? I have a DataGridView having a Property of another DataGridView's SelectedItem…
1 2 3 4 5 6 7
8