observablecollection

WPF ListBox not binding to INotifyCollectionChanged or INotifyPropertyChanged Events

I have the following test code: private class SomeItem{ public string Title{ get{ return "something"; } } public bool Completed { get { return false; } set { } } } private class SomeCollection : IEnumerable<SomeItem>, INotifyCollectionChanged { private IList<SomeItem> _items = new List<SomeI...

What is the easiest way to save an Observable collectin of object to an XML file?

I've have an Observable collection containing customer objects: public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public string Street { get; set; } public string Location { get; set; } public string ZipCode { get; set; } } What is the easiest way to dump this ...

How can i cast into a ObservableCollection<object>

How can i cast from ObservableCollection<TabItem> into ObservableCollection<object> this doesnt work for me (ObservableCollection<object>)myTabItemObservableCollection ...

WPF Grid data binding

I have a grid with just 1 row. I would like the amount of columns to be determined by the data context of the grid. For instance, if I have a list of names exposed in an ObservableCollection property called 'Names' that return "Fred", "Joe", and "Anne", I would like three columns in the grid, each with a textbox bound to each name. ...

ObservableCollection FileSystemWatcher ListBox Updating Issue

I have an ObservableCollection that is using a FileSystemWatcher to automatically add other PNG images that have been added to the directories. The ListBox has the ItemsSource databound to the Photos object using the following XAML. <ListBox ItemsSource="{Binding Source={StaticResource Photos}}" IsSynchronizedWithCurrentItem="True"/> ...

C# WPF datagrid: Column count always equal to 0

I have created a WPF tooklit datagrid in C# and the ItemsSource is set in the XAML. The columns are automatically generated. I am trying to do a datagrid that uses an ObservableCollection, pretty much like what is on this website. At the bottom you will find a sample that you can download (here is the link) My problem is that I'm try...

How to bind TextBoxes to individual elements in a Collection

I have a class with an ObservableCollection called List and I am trying to bind to textboxes individually. I have been trying: <TextBox Text="{Binding Source=List[0], Path=Value}" /> <TextBox Text="{Binding Source=List[1], Path=Value}"/> The StringObject class is just: class StringObject { public string Value { get; set; } } Ca...

How to bind an observable collection to an array of user controls?

Hey Databinding in WPF is great, but the moment you try make things more complex it gets exceedingly difficult to implement things. I have a collection of objects, where each object has observable properties that are bound to a user control. I would like to (ideally) simply add a new object to my collection, and have a new user contro...

How to bind items of a TabControl to an observable collection in wpf?

What is the simplest example of binding the items of a TabControl to an ObservableCollection? Each tab's content will have unique data, and indeed this data will have observableCollections of its own bound to the items components. Currently I have a user control, which I would like to set as the content of each tab as soon as it is cre...

Cannot resolve symbol T

I have a problem with ObservableCollection Class. I cant resolve this. using System.Collections.ObjectModel; #region ViewModelProperty: CustomerList private ObservableCollection<T> _customerList = new ObservableCollection<T>(); public ObservableCollection<T> CustomerList { get { return _customerList;...

Tricky WPF styling issue - can you do it?

Hey guys I have an observable collection of items, where each item has a name and a "group name" (both strings). The tricky part is, in XAML, I need to style this collection such that all items with the same group name are listed next to each other, and the group name is shown at the top. I have designed user controls for the layout o...

Merging Two ObservableCollections

I have two Observable Collections that I need to merge into one collection. This arises because I have two methods, getTasks(staffID) which returns an ObservableCollection and getTasks(teamID) which selects the staff and pulls back the staff tasks. For the teams I will have multiple small observableCollections, I just want to merge the...

Silverlight TabControl bound to ObservableCollection<string> not updating when collection changed

Silverlight 3 app with a TabControl bound to an ObservableCollection using an IValueConverter. Initial the binding works (converter called) on app startup. Changes, Clear() or Add(), to the bound collection are not reflected in the TabControl... converter not called. note: the bound ListBox reflects the changes to the bound collection ...

Observable collection with current item?

In a dialog from my application, I have an observable collection (stored somewhere else) bound to a list of tabs. When I close and reopen the dialog, the currently selected tab gets lost and winds up to the be the first one. How do I set up my tabs so that the selected tab persists? I had the impression that the observable collection ha...

How to remove DataGrid's blank row when binding to a ObservableCollection<T>?

Hi guys I'm getting nuts here with this: ObservableCollection<Employee> list = new ObservableCollection<Employee>(); dgEmployees.ItemsSource = list; When you debug the list variable, it's empty (list.Count =0), but then I bind it to a DataGrid (WPFToolkit), it shows me a blank row. In immediate window, for dgEmployees.Items it's sho...

Items in ObservableCollection not updating the view

Hi, I'm stumped here. I have an observable collection that holds business objects. I have it bound to ItemsSource of a ListBox. I am updating the X and Y of my object and it is being displayed correctly in the UI during runtime as it is bound the the Item top and Left. But, here is where the problem is. I have also bound some data to be ...

Increasing WPF ObservableCollection performance

At present I have two WPF listboxes imitating the following functionality I am using 2 ObservableCollections to allow users to select whatever items they require (flexibility is the key here). The main issue is that I have thousands of items that are grouped in both listboxes. All in all the design works really well (with a few dozen ...

Adding new item to ObservableCollection from TextBox stays bound?!?!

I have a ListControl that is populated with an ObservableCollection. I've also got a "Add new item" text box on the usercontrol as well. When I enter text into the textbox and click "Add" the item goes through the appropriate logic and adds to my ObservableCollection, which my ListControl reflects immediately. So far, so good. HOWEVER. ...

C#: ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged)

Hello, does anyone know why this code doesn't work: public class CollectionViewModel : ViewModelBase { public ObservableCollection<EntityViewModel> ContentList { get { return _contentList; } set { _contentList = value; RaisePropertyChanged("ContentList"); //I wan...

ObservableCollection is not updating Multibinding in C# WPF

I have a TreeView that creates all its items from databound ObservableCollections. I have a hierarchy of GameNode objects, each object has two ObservableCollections. One collections has EntityAttrib objects and the other have GameNode objects. You could say that the GameNode object represents folders and EntityAttrib represents files. To...