observablecollection

Should properties of ViewModels that implement INotifyPropertyChanged automatically update the data in DataGrid control when I update them?

Hi. I may be confused about the purpose behind INotifyPropertyChanged and Silverlight... I have XAML that I created in the designer: <UserControl.Resources> <CollectionViewSource x:Key="theViewSource" d:DesignSource="{d:DesignInstance my:transferObject, CreateList=True}" /> </UserControl.Resources> as well as this <...

Binding the Result from a webservice to an ObservableCollection which to be bound to a DataGrid

Hi All, I'm getting a List as a result from my webservice. I need to bind it to an ObservableCollection and then bind the ObservableCollection to a DataGrid This is my coding. ObservableCollection<SubTotals> ds = new ObservableCollection<SubTotals>(e.Result); but I'm getting an error. Can anyone ple help me out. Thank you. ...

Why is .NET ObservableCollection<T> implemented as a class and not an interface ?

Hi, In reading about the Observer design pattern, I noticed that it is implemented using interfaces. In Java, the java.util.observable implementation is also a class. Shouldn't the C# and Java versions use interfaces ? Scott ...

Databinding Issue With Custom ObservableCollection Properties

I'm making a small personal finance program that uses "envelopes" as the budgeting method. I'm mostly doing this as a means to learn WPF & MVVM. I've run into a problem where I can't databind to the custom properties I created in my custom ObservableCollection, seen here: public class ObservableEnvelopeCollection : ObservableCollection<...

problem with ItemEndEdit on ObservableCollection event firing twice

I have an issue with a datagrid inserting/updating rows twice. The datagrid is bound to an observable collection that has an ItemEndEdit event added to it: /// <summary> /// extends the ObservableCollection class to include adding an ItemEndEdit event /// </summary> public class ObservableProjectExpenseItems : ObservableCollection<Proje...

Entity Framework collections binding to a ListBox to reflect changes

Hello! I'm using the Entity Framework classes to make changes to my database like this: testEntities.Products.AddObject(product); I've got a ListBox bound to testEntities.Products and it shows them correctly, but when I add a new object and I save the changes (testEntities.SaveChanges()), the product appears into the database, but the ...

How can I make a deep copy of an ObservableCollection<T> in Silverlight 4?

I want to make a deep copy of an ObservableCollection in Silverlight 4 in order to detect changes in the items in the list. Since ICloneable isn't available in SL how can I do this? OR - is there a better way to check for changes in the items in the collection? ...

Updating an ObservableCollection in WPF causes screen flicker; How can I prevent it?

I have an ObservableCollection bound to a WPFToolkit DataGrid in an MVVM pattern. Every 30 seconds I have a background thread that is querying a service for some data. When it returns, it marshals it to the UI thread and updates the ObservableCollection by first calling Clear() on the collection and then calling Add() for each item. When...

How do I use DataGrid built-in commands to Add, Remove and Edit Strongly Typed DataRows?

Before I actually ask the question, I need to explain my current situation. I have a strongly typed (generated with VS2010) DataSet. Along with that, I have the corresponding typed DataTable and DataRow. My problem happens when I commit a row using the DataGrid's built-in commands. It calls the BeginEdit(), CancelEdit() (only when I c...

binding XCeed Grid

Is it ok to bind ListCollectionView to Xceed datagrid DataGridCollectionViewSource... I am able bind with observablecollection but not with listcollection View bith are dependency properties...Please help me ...

Silverlight: how to bind List<T> to data grid.

MVVM pattern is implemented in my Silverlight4 application. Originally, I worked with ObservableCollection of objects in my ViewModel: public class SquadViewModel : ViewModelBase<ISquadModel> { public SquadViewModel(...) : base(...) { SquadPlayers = new ObservableCollection<SquadPlayerViewModel>(); ... ...

WPF - ObservableCollection PropertyChanged event?

I have an object which has a property of type ObservableCollection<bool>. It is bound to a list of checkboxes on a form using TwoWay bindings. I would like to add a PropertyChanged notification to this so that if certain values are selected, some other ones get automatically deselected. Is there a way to do this? The ObservableCollect...

Listen to the PropertyChanged event of any item in an ObservableCollection<INotifyPropertyChanged>

I've created a wrapper collection for ObservableCollection that subscribes to each items PropertyChanged event and rethrows it as its own event ItemPropertyChanged. I did this using a similar method to what I described here. Is there a better way? Am I missing another .NET collection that already has this type of behavior? ...

WPF: InotifyPropertyChanged, IValueConverter, & background threads

let's say we are using IValueConverter to format a GridView cell background color depending on its value. now let's say that value is calculated on a separate thread, after adding the item to the collection. var args = GetInput(); if (ValidateArgs(args)) { if (args.Rate.HasValue) Thre...

ObservableCollection of winform controls

Hey, I think about create ObservableCollection of controls (Label and Textbox) and add it to TabPage. If text in this textbox will change by user, text parameter in my collection will change ? Please help :) ...

listview doesn't get updated after changing isSelected property

I use an ObservableCollection<customclass> with an isSelected property bound to a listview. The customclass items are added via asyncrhonous communication with a server. I register to an NotifyCollectionChanged event and there under certain conditions set the isSelected property to true. However, this doesn't update my view. Only after s...

How can I provide dynamic filtering on an entity collection?

Good day, I have a class ShipmentsCollection that inherits ObservableCollection which contains shipment objects (entities). This is displayed in a listbox on my ShipmentsView UserControl. My intent is to allow a user to type into a textbox above the list and filter the list with items that contain that string, as well as filter based ...

WPF: How do I start styling a DataGrid that was built using MVVM?

I have a list of names that I'd like to have bound to a datagrid for editing/sorting/etc. But, I don't like how the DataGrid is displayed at all. Columns are placed in Alphabetical order when I really want a custom order (and I wish I could hide the ID column, or make that column not editable). I'm not sure how to start doing any of this...

Binding Observable Collection to multiple wpf trees

Does anyone have suggestions on the best way to bind an observable collection to multiple wpf trees using different groupings? Both bindings are two-way, such that changes in one control should be reflected in both controls. ...

WPF - Correct way to commit changes when using ObservableCollection and linq-2-sql

If all of my wpf controls bind to ObservableCollections and I am using linq-2-sql to populate these collections, what is the correct way to commit changes whenever properties of these objects are updated? Currently I am calling DataClassesDataContext.SubmitChanges() manually, which is a bit tedious. Is there a way to do this automatical...