bindinglist

Reverse sort a BindingList<T>

I have a custom class that inherits from BindingList(T) that I am binding to a DataGrid. However, the DataGrid is being populated from the top down and I want it populated from the bottom up. So the bottom item is index 0 rather then the top item. How can I change my BindingList(T) so that the DataGrid reads it in reverse? ...

Public fields/properties of a class derived from BindingList<T> wont serialize

I'm trying to serialize a class that derives from BindingList(Floor), where Floor is a simple class that only contains a property Floor.Height Here's a simplified version of my class [Serializable] [XmlRoot(ElementName = "CustomBindingList")] public class CustomBindingList:BindingList<Floor> { [XmlAttribute("publicField")] publ...

What causes a ListChangedType.ItemMoved ListChange Event in a BindingList<T>?

I have a BindingList(T) that I am displaying in a DataGrid. I'm watching for ListChanged events and performing different actions when the ListChanged event is evoked. I'm checking the ListChangeType argument of the event to check how the list was changed, and then responding accordingly. However, I noticed that there is a ListChanged ev...

Getting the index of deleted item from bindinglist

Hi, I am able to get the index of items added to the BindingList. When I try to get the index if the deleted item I get the error Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Here is my code Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.Eve...

some of my class<T>'s members don't turn up on datagridview bound to BindingList<T>

Hi, I have a class public class ANote{ public string NoteId = ""; public string Note = ""; public string NoteCollector = ""; public DateTime NoteCollectionDate = DateTime.MinValue; public string NoteCollectionDay { get { return NoteCollectionDate.toString("MM/dd/yyyy") ; } } public string NoteCollectionTime { get { return return NoteCo...

Thread safety advice when using DataGridView and BindingList in C#

I'm writing a class for logging events. My LogClass is implemented as a singleton, and any class in the system can write a log entry. The entries are stored in a List and when a buffer is filled they get dumped to the disk. I'm using a DataGridView to display the contents of the LogClass during execution, therefore I used the BindingLis...

Editing business objects in Winforms DataGridView

Is possible to edit properties of business object (one property, one column) binded as BindingList to Winforms DataGridView? Or do I have to use DataSet or DataTable? I'm not able to get a cell to edit mode. ...

XtraGrid doesn't display properly newly added line

Hi Folks, I'm using XtraGrid of DevExpress 2.9.5 to display a blotter of dynamic set of lines. The blotter is integrated into another application, this is why it has to be based on UserControl class and also implement a couple of custom interfaces. public partial class BlotterForm : UserControl, ISMMdiEmbeddable, ISMAssociatedMFCWindo...

How can I fire event before item is added to collection in C#?

I would like to do some processing before an item is added to a BindingList. I see there is an ListChanged event but this is fired after the item is added. The AddingNew event is only fired when the AddNew method (not the Add method) is called. Has anyone done something like this before? UPDATE: I have created the following classes ...

.NET DataBinding, Confirmation before removing items from the list

Hi, i have a BindingList as a datasource and a grid control, if the user deletes a row in the grid, i want him to get a confirmation (a messagebox for example), the grid control i'm using (and i guess most of them), call the RemoveAt(int index), method of Collection which has a void return value, even if i'll inherit from bindingList, o...

Opinion wanted: Intercepting changes to lists/collections

Although BindingList<T> and ObservableCollection<T> provide mechanisms to detect list changes, they don't support mechanisms to detect/intercept changes before they happen. I'm writing a couple of interfaces to support this, but I want to canvas your opinion. Option 1: Lists raise events for each type of action Here, consumers might w...

New item field on top of DataGridView

DataGridView in .Net has built-in support for adding new items at the bottom. Last row is treated in a special way. The IBindingSource interface supports this through AddNew/EndNew/CancelNew methods. Is it possible to change this to allow adding items in the top row of the grid instead? I know I can do sourceList.Insert(0, item) progra...

Binding a BindingList to a collection

I have a library that returns a collection like this: public IEnumerable Alerts { .. } and I want to turn this collection into a BindingList for use in the GUI. What is the best way to keep a BindingList synchronised with an IEnumerable collection? edit: For this problem, assume I have no control of the library and the actual implem...

Can I cast a LINQ query result to BindingList<T>?

Hi, From what I've learned, you can't cast to BindingList, but rather you can wrap your result from the Linq query with a NEW BindingList. However, this doesn't work for me, because my Original Binding list has some events attached to it and i would like to maintain the same events in my LINQ result set. For example: I have my main B...

Editing list properties using DataGridview

Ok, I have my custom class: public class FileItem : INotifyPropertyChanged { int id=0; string value=""; public int Id { get { return id; } set { id = value; Changed("Id"); } } public string Value { get { return value; } set { ...

BindingList projection wrapper

Is there a simple way to create a BindingList wrapper (with projection), which would update as the original list updates? For example, let's say I have a mutable list of numbers, and I want to represent them as hex strings in a ComboBox. Using this wrapper I could do something like this: BindingList<int> numbers = data.GetNumbers(); co...

"Wrapping" a BindingList<T> propertry with a List<T> property for serialization.

I'm writing an app that allows users search and browse catalogs of widgets. My WidgetCatalog class is serialized and deserialized to and from XML files using DataContractSerializer. My app is working now but I think I can make the code a lot more efficient if I started taking advantage of data binding rather then doing everything manuall...

C# What is the best way to copy a BindingList ?

What is the best way to copy a BindingList? Just use ForEach()? Or are there better ways? ...

C# bindinglist made of bindinglists

Hi, Is there a simple way to have a bindinglist composed of serveral bindinglists ? ie that is the "view" of the lists. That is to say : I have 3 lists (list1,list2,list3). I want a list that is alway the union of the 3 listx (we can suppose that no object is contained in 2 different lists). Certainly, I can succeed in using the ListC...

Implementing BindingList<T>

I am trying to learn more about BindingList because I believe that it will help me with a project that I am working on. Currently, I have an object class (ScannedImage) that is a subtype of a class (HashedImage) that subtypes a native .Net object (Image). There is no reason why I couldn't move the two subtypes together. I am simply su...