I was having a look at the ObservableCollection code (thanks to the awsome .NET Reflector) and was surprised to find that the Add and Remove methods are not overriden. How then does ObservableCollection raise the PropertyChanged or CollectionChanged event to notify when something is added or removed?
...
Need help.
myCollection = new DB.PersonCollection();
dGrid.ItemsSource = myCollection;
User must sort DataGrid and then use sorted data to make report.
How to take exact copy of DataGrid-layer collection (with sorted items)
...
2 Questions really, and I'm not sure if I'm doing this right or not...
I want to send back an array of some sort for an Entity object I created. I'm not really sure how to mark it for sending (what attributes are needed or whatever), and I'm not really sure how to send it back (IList, List, Collection, ICollection).
Ideally I'd love to...
Hello.
I'm developing a Windows Phone application with C#.
I have an ObservableCollection defined as follows:
public class StartingPersons
{
public string ImagePath { get; set; }
public string Name { get; set; }
public static ObservableCollection<StartingPersons> GetPersons()
{
...
}
}
I want to search i...
I've got a list of items that I'm placing in an ObservableCollection which I am then databinding to a datagrid UI created in XAML. One of the columns displayed is the index of the item in the list. Currently, I am creating a property and binding to it. However, this creates a lot of work when I need to update/add/remove items from the li...
Hi,
suppose the following classes:
public class Model
{
public ObservableCollection<A> Items { get; set; }
}
public class A
{
ObservableCollection<B> Data { get; set; }
//... some more properties
}
public class B
{
//..properties
}
The model is bound to a RibbonMenu and should also be used in a context menu. The co...
Ok, I recently implemented a background worker to perform saves and loading of data.
However getting this to work on a save command has proved difficult.
Basically my Save command generates an event that notifies a collection view model that an Item has been added and that It should add it to its own observeablecollection. At this poi...
My scenario: I have a background thread that polls for changes and periodically updates a WPF DataGrid's ObservableCollection (MVVM-style). The user can click on a row in the DataGrid and bring up the "details" of that row in an adjacent UserControl on the same main view.
When the background thread has updates, it cycles through the ob...
Hello,
I'm having some difficulties with null and a ComboBox in WPF/C#; If a add a null item it is not shown/listed in the ComboBox.
Here is de XAML declaration of my ComboBox
<ComboBox ItemsSource="{Binding Path=MyList}"
SelectedItem="{Binding Path=Type}" />
MyList is declared as
public ObservableCollection<Type> MyList...
I have a collection ObservableCollection<Foo>, and I want to bind this to a property in a custom controller of type ObservableCollection<object>. However, the bound value never reaches the PropertyCallback, and is hence never set.
Is there a clever way to achieve this binding? I could create an IValueConverter that converts from Observ...
With a DataGrid object in WPF, we can bind its rows to an observable collection such that as rows are added or removed to/from the collection, the UI updates to display the changes. I am looking to do something similar with a Grid control as part of a User Control I am trying to create. Is this possible?
...
Hi,
i have simple master detail in wpf with listbox filled in with Order object and Xamdatagrid with OrderDetail.
Listbox`s Itemsource is bound to the ObservableCollection defined in ViewModel. Xamdatagrid is also bound to the observablecollection defined in datagrid. If user click Order in the listbox i want to fill xamdatagrid with Ord...
Hi All,
I have implemented the Drap n Drop functionality using the two listboxes (lstSource, lstDest) where user can drap & drop item between two lists.
I have two ObservalableCollections (sourceCollection & destCollection) which are binded to the relevant lists.
In the initial load method, DomainContext gets all the tasks from db and ...
I have a very large comma-seperated text-file. I need to display this in a WPF Datagrid, which method would result in the highest performance of loading all the data to the grid? I'm only aware of two methods:
Using a Datatable, and adding each line as row (looks like overkill)
Using an ObservableCollection, creates object for each lin...
Adding objects with the IEditableCollectionView addNew() method is pretty decent. However I'm not sure how well it works with my generic code I have.
I have a ObservableCollection of my base class. Depending on what the user wants to see it can be filled with DerivedA or DerivedB ( or mutliple other derived type classes ). It never has ...
I'm playing with ICollectionView right now, and am encountering a problem where I think I understand the "why", but not the "how do I fix it". :)
I have a ComboBox that's databound to an ICollectionView, and it is initially set with the following code:
NameView = CollectionViewSource.GetDefaultView( names); // names is an IEnumerable<...
Need: Need to bind data to WPF controls for a user to update a database.
Approach: I am trying to implement a solution similar to this but am having an issue because I will be using a DataSet and not LINQ to SQL Class (hitting an Oracle db for my data). If this is a correct approach how can I do this?
I'm also thinking instead of addi...
Hi,
I have 2 listboxs which ItemsSource is an ObservableCollection, but that throw an exception of "not valid value", for resolve that I made a wrapper class that have a property of type MyUserControl and I changed also the collection for an ObservableCollection changing also the ListBoxItemTemplate to a ContentPresenter with Content bi...
Hi.
I need to remove items from list few seconds after i added them. I have now an ObservableCollection to which I add some messages. I need them to be deleted let's say 5 seconds after they were added. I tried to create a function responsible for adding the items and setting a timer:
public void AddInfoItem(string info)
{
...
I have used an ObservableCollection with WPF for binding and this works well. What I really want at the moment is a Dictionary like one, that has a key that I can use, so effectively like "ObservableCollection".
Can you suggest the code that could be used to provide such an ObservableCollection? The goal is to have a Dictionary like s...