observablecollection

WPF DataGrid - Combining TimeSeries w/MultiBinding, lose change-notification. Why?

Hi all, I have a class that has two ObservableCollection< TimeValue >'s, where TimeValue is a custom DateTime/Value pairing with change-notification (via INotifyPropertyChanged). I call these Targets and Actuals. When I bind these to a chart, everything works perfectly, and I get two LineSeries. If I bind one of them to a DataGrid, wit...

Can't wrap my head around wpf databinding

My scenario: A wpf form has a textbox and a wpf toolkig datagrid. When a text is entered in the textbox, my service returns an IEnumerable<TranslationItem> items. I want my datagrid to show the result of this service. I tried googling around, but I can't get heads or tails to it. I'm only starting to learn WPF and most of the used ter...

ObservableCollection and Item PropertyChanged

Hi, I've seen lots of talk about this question but maybe I'm just too much of a newbie to get it. If I have an observable collection that is a collection of "PersonNames" as in the msdn example (http: //msdn.microsoft.com/en-us/library/ms748365.aspx), I get updates to my View if a PersonName is added or removed, etc. I want to get an up...

How to bind a view with multiple ObservableCollection

I have a ModelView with multiple ObservableCollection. Is this the right approach and also when ever view calls the view modle, all the ObservableCollection needs to be re-populated with data and then binding takes place again for all the CollectionViewSource. Also how do I call CollectionViewSource.GetDefaultView outside the construct...

Should my ViewModel have an ObservableCollection of Views or ViewModels?

I'm trying to understand the basic MVVM design approach when using ItemsControl by binding it via DataTemplates to ObservableCollections on the ViewModel. I've seen examples that bind to ObservableCollections of strings, Views, and ViewModels. Binding to strings seems to be only for demos, it is the binding to "ViewModels that contain ...

WPF DataBinding - entirely confused

Gosh! I hate this. Why it is so complicated? What I'm trying to do: I have a form with several UserControls each with a DataGrid. Each grid bind with ObservableCollection through .ItemSource property, everytime when program catches an event, it makes changes in one of the implied collections. But a picture of a grid doesn't update. ...

Why does implementing ObservableCollection crash my silverlight application?

Hi, I have a combobox whose ItemsSource property is bound to an ObservableCollection property and its SelectedIndex property is bound to an integer property respectively. <ComboBox Name="cmbDealt" ItemsSource="{Binding Path=DealList, Mode=TwoWay}" SelectedIndex="{Binding Mode=TwoWay, Path=DealIndex}"></ComboBox> <CheckBox IsChecked="{...

Sorting an observable collection with linq

I have an observable collection and I sort it using linq. Everything is great, but the problem I have is how do I sort the actual observable collection? Instead I just end up with some IEnumerable thing and I end up clearing the collection and adding the stuff back in. This can't be good for performance. Does anyone know of a better ...

ObservableCollection PropertyChanged event

OK so I want to subclass ObservableCollection to add a property to it. Unfortunately the PropertyChanged event is protected. Basically I want to subclass it to have a SelectedItem that I can bind to for lists in my MVVM WPF app. Here's the skeleton of my class: public class SelectableList<T> : ObservableCollection<T> { public T Sel...

ObservableCollection Databinding performance

I would like to know why according to this article and observable collection binds significantly faster(20 ms vs 1685ms, that's 800X faster) than a List<> collection in WPF. I looked at the internals of ObservableCollection and it uses a List as it's storage collection object(I used reflector and saw this in the constructor) public Coll...

Driving a PropertyChange from an ObservableCollection in Silverlight 3.0

Hi, I have a class called ChangeWatcher that is used to publish events to subscribers every time an object issues a PropertyChange event. This class is used to allow my application to execute a procedure everytime an object is updated. It is working OK but when I drive the PropertyChange of an ObservableCollection and I add a new item ...

Linq and ObservableCollection

Hello everybody, I have a problem with Linq and ObservableCollections in my WPF application. Context of the problem: I've created a very simple SQL database with two tables: User and BankAccounts. The User Table has an one-to-many relationship with the BankAccounts Table. Next I've created Linq-to-SQL dataclasses, which worked fine ==...

Observable Collection Property Changed on Item in the Collection

I have an ObservableCollection. I've bound it to a ListBox control and I've added SortDescriptions to the Items collection on the ListBox to make the list sort how I want. I want to resort the list at ANY point when any property changed on a child element. All my child elements implement INotifyPropertyChanged. ...

Nested Generics

I have asked this before but I didn't get the question right so the answer was missed. If I have a method that returns an ObservableColletion<T> how would I then use this in another generic method. Would method2<ObservableCollection<T>>(){} be the way to go. I am trying to make a generic resultEventArgs that will pass the results ...

What is data contract (property class) and observable collection

What is data contract (property class) and observable collection when, where and why to use these in context to silverlight please do explain in Details with Examples ++ Thanks and Regards Meetu Choudhary ...

Listbox scrollbar doesn't follow selected item (with ICollectionView)

I'm trying to implement the MVVM pattern in WPF. I've followed Jeremy Alles's Very simple MVVM demo application. I have a ListBox that has a binding to an ObservableCollection: <ListBox Name="myListBox" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Persons}"> <ListBox.ItemTemplate> <DataTemplate> ...

How can I debug the binding of my ViewModels to my View?

I have this ItemsControl in my View: <ItemsControl ItemsSource="{Binding ItemPageItemViewModels}" ItemTemplate="{StaticResource ItemPageItemViewModelsTemplate}"/> And above it I have this DataTemplate which renders all the items: <DataTemplate x:Key="ItemPageItemViewModelsTemplate"> <TextBlock Text="{Binding Title}"/> </...

Why ObservableCollection is not updated on items change?

I noticed that ObservableCollection in WPF reflects changes in GUI only by adding or removing an item in the list, but not by editing it. That means that I have to write my custom class MyObservableCollection instead. What is the reason for this behaviour? Thanks ...

Problem when inserting an entity in the database through a service

I have a Silverlight application and I'm using a WCF service to access my database information. For this I'm using EntityFramework. I have a class Items (mapped on my DB table Items) which has an ObservableCollection of Keywords (class mapped on my DB table Keywords) objects. From the interface I create an Items object with all the pro...

Cannot access Object fields using fieldinfo

Hi, I have an method that takes in an observable collection (returned from a webservice) of objects and analyzes them according to their attributes. Here is the code snippet from the method private double analyze(ObservableCollection mobjColl) { FieldInfo fi = null; foreach (MyApp.MyObj oi in mobjColl) ...