observablecollection

Can you turn off selection syncing in WPF's CollectionViewSource?

Hi everyone, I have several CollectionViewSource instances all used on the same ObservableCollection. I also have several controls that need to show filtered versions of the collection (hence the CollectionViewSources). The problem I'm having is that CollectionViewSource forces them to all have the same item selected. Is there some way ...

Sliding effect when adding new items to a WPF ListBox

I have a WPF ListBox control which displays items of an RSS feed. I occasionally check the source of the RSS feed for new items. Once I detect a new item I add it to the observable collection which immediately adds the new item to the ListBox display. Is there a way to 'slide in' the new item from the top, pushing down the existing item...

How can I improve Silverlight binding performance?

Scenario: I have many (potentially dozens) of ObservableCollection's being bound to ListBoxes at load time. These bindings are declared in their respective Xaml files. When the app first runs, it queries a database and then populates these ObservableCollections (by adding a new entity to their respective collection). I suspect that the...

Binding WPF Canvas Children to an ObservableCollection

In my WPF application I have a Canvas in which I do some drawing. Earlier I handled the drawing in the code behind, but now I've factored everything out to a ViewModel. This gives me some challenges.. I have a few InkPresenter objects holding Strokes. Earier I added them as children to the Canvas in the code behind - like this: // Bu...

How can I get child tree nodes to appear in a WPF TreeView when binding to an ObservableCollection?

What do I have to change in the following code to make the "A Child Section" node appear as a child of the First Section and Second Section: The following code gives me a XamlParseException. XAML: <Window x:Class="TestTr32322.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mic...

Manipulating ObservableCollection vs Replacing a List

I have a backend Dictionary that is used for synchronization (ie. to both a filestore and a webservice). Off the top of this I need to generate lists/enumerables for the WPF frontend to consume. What is the difference between either hooking an enumerable up to the dictionary, and calling PropertyChanged when it is updated to using an Ob...

Altering the ObservableCollection according to FileSystemWatcher change notification

Hi All, I'm trying to update my ObservableCollection as the FileSystemWatcher notifies changes. I know this is not possible because of cross thread operations. So i would like to get the name of the file created/deleted/renamed when the event is fired and update it in the UI thread once the event is completed, as we do in BackgroundWor...

What's the efficient way to search and filter ObservableCollection

I've a database consisting of about 1 million records. My application makes frequent incremental search on these records and filters the UI list. The scenario is more like the 'phone contact search'. Currently i'm following this: Load the data into List<myModel> in the DataSource Layer` Send it to MainViewModel Load List<myMod...

Is this the best way to convert List<T> from models to ObservableCollection<T> in views?

In MVVM development I am constantly converting List<T> from my models to ObservableCollection<T> for my views. I looked around in .NET for a way to succinctly do this e.g. such as .ToList<> or .ToArray<> or .ToDictionary<> but couldn't find anything similar for ObservableCollection. Therefore I made the following extention method Conve...

ObservableCollection DataGrid

I bound the ObservableCollection to the dataGrid itemssource. the collectionChangedEvent of the observable Collection is getting called only when we add, delete, remove. But not firing when we update the record. how to fire the event for Update too? ...

Custom collection using cache class

Hello, I am trying to improve performance by limiting my objects in memory by using a cache. This creates problem with my ObservableCollection. Well, i think the code speaks for itself. I have "transformed" my ObservableCollection-derivative to this: public class TrackCollection : INotifyPropertyChanged, IEnumerable { private read...

problem binding ListBox on ObservableCollection<T>

Hello, I have a strange "problem". Could someone explain me why : If I have in an ObservableCollection, twice (or more time) an item with the same value, then the selections of those values in the ListBox won't work properly ? In fact, what the ListBox is doing when I click on an item(Even in single item selection) : It selects the fi...

What is the difference between observable collections and innumberable ones?

What is an observable collection and how it is different than a innumerable collection? ...

Databinding to ObservableCollection in a different UserControl - how to preserve current selections?

Scope of question expanded on 2010-03-25 I ended up figuring out my problem, but here's a new problem that came up as a result of solving the original question, because I want to be able to award the bounty to someone!!! Once I figured out my problem, I soon found out that when the ObservableCollection updates, the databound ComboBox h...

how do i execute a foreach lambda expression on ObservableCollection<T>

how do i execute a foreach lambda expression on ObservableCollection there is not method of foreach with ObservableCollection although this method exists with List is there any extension method available? ...

FxCop hates my usage of MVVM

I've just started to work with FxCop to see how poorly my code does against its full set of rules. I'm starting off with the "Breaking" rules, and the first one I came across was CA2227, which basically says that you should make a collection property's setter readonly, so that you can't accidentally change the collection data. Since I'...

Silverlight Lineseries chart binding to observablecollection

I am working with a simple lineseries chart in Silverlight 3 with VB.net and am running into an issue binding the chart to an observablecollection. The chart is going to be used to display changes in BMI data over time for a weight loss application. I have created a simple class that contains the BMI value for the user and the date the B...

Get compiler generated delegate for an event

I need to know what handlers are subsribed to the CollectionChanged event of the ObservableCollection class. The only solution I found would be to use Delegate.GetInvocationList() on the delegate of the event. The problem is, I can't get Reflection to find the compiler generated delegate. AFAIK the delegate has the same name as the event...

Missing elements of collection

I have a collection ObservableCollection<string> outoverList And i have a function which call collection outoverList.Add("out:"+element.tagName); Function call collection a few times, but sometimes collection lost elements. We call a function -> function adds element -> collection has 9 elements(for example) -> in the next funct...

How to traverse the item in the collection in a List or Observable collection?

I have a collection that is binded to my Listview. I have provided options to user to "move up" "move down" the selected item in the list view. I have binded the selected item of the listview to my viewmodel, hence I get the item in the collection on which user want to do the operation. I have attached "move up" "move down" commands in...