473,385 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to implement IBindingList

There is an sample class CustomerList to implement the interface IBindingList
in MSDN.

But it dosen't have codes for followings to show how to sort the collection.

Can you provide codes to to it?

Thanks
Keith

PropertyDescriptor IBindingList.SortProperty
{
get { throw new NotSupportedException(); }
}

void IBindingList.AddIndex(PropertyDescriptor property)
{
throw new NotSupportedException();
}

void IBindingList.ApplySort(PropertyDescriptor property, ListSortDirection
direction)
{
throw new NotSupportedException();
}

int IBindingList.Find(PropertyDescriptor property, object key)
{
throw new NotSupportedException();
}

void IBindingList.RemoveIndex(PropertyDescriptor property)
{
throw new NotSupportedException();
}

void IBindingList.RemoveSort()
{
throw new NotSupportedException();
}.

Nov 16 '05 #1
4 18017
keith,

It shouldn't be that hard. Basically, you would have to reorder the
list internally, and then fire the ListChanged event, passing
ListChangedType.Reset, to indicate that much of the list has changed.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"keith" <ke***@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
There is an sample class CustomerList to implement the interface
IBindingList
in MSDN.

But it dosen't have codes for followings to show how to sort the
collection.

Can you provide codes to to it?

Thanks
Keith

PropertyDescriptor IBindingList.SortProperty
{
get { throw new NotSupportedException(); }
}

void IBindingList.AddIndex(PropertyDescriptor property)
{
throw new NotSupportedException();
}

void IBindingList.ApplySort(PropertyDescriptor property, ListSortDirection
direction)
{
throw new NotSupportedException();
}

int IBindingList.Find(PropertyDescriptor property, object key)
{
throw new NotSupportedException();
}

void IBindingList.RemoveIndex(PropertyDescriptor property)
{
throw new NotSupportedException();
}

void IBindingList.RemoveSort()
{
throw new NotSupportedException();
}.

Nov 16 '05 #2
But problem is no sample codes. Just don't know how to start coding for
something like

PropertyDescriptor IBindingList.SortProperty
{
get { throw new NotSupportedException(); }
}

"Nicholas Paldino [.NET/C# MVP]" wrote:
keith,

It shouldn't be that hard. Basically, you would have to reorder the
list internally, and then fire the ListChanged event, passing
ListChangedType.Reset, to indicate that much of the list has changed.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"keith" <ke***@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
There is an sample class CustomerList to implement the interface
IBindingList
in MSDN.

But it dosen't have codes for followings to show how to sort the
collection.

Can you provide codes to to it?

Thanks
Keith

PropertyDescriptor IBindingList.SortProperty
{
get { throw new NotSupportedException(); }
}

void IBindingList.AddIndex(PropertyDescriptor property)
{
throw new NotSupportedException();
}

void IBindingList.ApplySort(PropertyDescriptor property, ListSortDirection
direction)
{
throw new NotSupportedException();
}

int IBindingList.Find(PropertyDescriptor property, object key)
{
throw new NotSupportedException();
}

void IBindingList.RemoveIndex(PropertyDescriptor property)
{
throw new NotSupportedException();
}

void IBindingList.RemoveSort()
{
throw new NotSupportedException();
}.


Nov 16 '05 #3
Keith,

That's dependent on how you store the list. Basically, the list has an
indexer on it. Based on how you store the elements internally, you have to
change it so that when an index of zero is passed to the indexer, you return
the first item in the list sorted on the properties passed through in the
sort. If one was passed, then you return the next item, and so on, and so
on.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"keith" <ke***@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
But problem is no sample codes. Just don't know how to start coding for
something like

PropertyDescriptor IBindingList.SortProperty
{
get { throw new NotSupportedException(); }
}

"Nicholas Paldino [.NET/C# MVP]" wrote:
keith,

It shouldn't be that hard. Basically, you would have to reorder the
list internally, and then fire the ListChanged event, passing
ListChangedType.Reset, to indicate that much of the list has changed.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"keith" <ke***@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
> There is an sample class CustomerList to implement the interface
> IBindingList
> in MSDN.
>
> But it dosen't have codes for followings to show how to sort the
> collection.
>
> Can you provide codes to to it?
>
> Thanks
> Keith
>
> PropertyDescriptor IBindingList.SortProperty
> {
> get { throw new NotSupportedException(); }
> }
>
> void IBindingList.AddIndex(PropertyDescriptor property)
> {
> throw new NotSupportedException();
> }
>
> void IBindingList.ApplySort(PropertyDescriptor property,
> ListSortDirection
> direction)
> {
> throw new NotSupportedException();
> }
>
> int IBindingList.Find(PropertyDescriptor property, object key)
> {
> throw new NotSupportedException();
> }
>
> void IBindingList.RemoveIndex(PropertyDescriptor property)
> {
> throw new NotSupportedException();
> }
>
> void IBindingList.RemoveSort()
> {
> throw new NotSupportedException();
> }.
>


Nov 16 '05 #4
I know it is not too hard. But there is no any sample for these parts in MSDN.

It is not easy to code something you don't what should look like?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Keith,

That's dependent on how you store the list. Basically, the list has an
indexer on it. Based on how you store the elements internally, you have to
change it so that when an index of zero is passed to the indexer, you return
the first item in the list sorted on the properties passed through in the
sort. If one was passed, then you return the next item, and so on, and so
on.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"keith" <ke***@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
But problem is no sample codes. Just don't know how to start coding for
something like

PropertyDescriptor IBindingList.SortProperty
{
get { throw new NotSupportedException(); }
}

"Nicholas Paldino [.NET/C# MVP]" wrote:
keith,

It shouldn't be that hard. Basically, you would have to reorder the
list internally, and then fire the ListChanged event, passing
ListChangedType.Reset, to indicate that much of the list has changed.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"keith" <ke***@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
> There is an sample class CustomerList to implement the interface
> IBindingList
> in MSDN.
>
> But it dosen't have codes for followings to show how to sort the
> collection.
>
> Can you provide codes to to it?
>
> Thanks
> Keith
>
> PropertyDescriptor IBindingList.SortProperty
> {
> get { throw new NotSupportedException(); }
> }
>
> void IBindingList.AddIndex(PropertyDescriptor property)
> {
> throw new NotSupportedException();
> }
>
> void IBindingList.ApplySort(PropertyDescriptor property,
> ListSortDirection
> direction)
> {
> throw new NotSupportedException();
> }
>
> int IBindingList.Find(PropertyDescriptor property, object key)
> {
> throw new NotSupportedException();
> }
>
> void IBindingList.RemoveIndex(PropertyDescriptor property)
> {
> throw new NotSupportedException();
> }
>
> void IBindingList.RemoveSort()
> {
> throw new NotSupportedException();
> }.
>


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Cary Linkfield | last post by:
I have created a custom class inheriting CollectionBase and implementing IBindingList. I am binding the list to a datagrid. I would like to have a property on the class that works like the...
0
by: David Elliott | last post by:
I have a Collection that inherits from CollectionBase and Implements IBindingList which I have bound to a DataGrid. So far everything works fine. However, I am missing one piece to the...
1
by: alex n | last post by:
hello. i'm trying to implement IBindingList to wrap DataTable (like DataView) with hierarchy capabilities and bind it to DataGrid. The problem is i don't know yet all the stuff i need to know....
1
by: John | last post by:
Hi, I need something just like an ArrayList where I can add and remove objects, but it needs to implement IBindingList so I can use it as the DataSource to a ListBox and have the ListBox always...
0
by: Jongmin | last post by:
I met a problem when implementing IBindingList interface. I made CustomerList class, copied from MSDN, to implement CollectionBase and IBindingList. My problem took place after setting...
3
by: Maxus | last post by:
Hi People, I'm implementing one of those typed collection thing that we all love so much :) anyhows.. Problem is this I want make it use generics. So I implement ICollection<T>, IList<T> and I...
2
by: Narshe | last post by:
I have a collection class that inherits from CollectionBase, and implements IBindingList, and I'm having problems with recursion or List not having an instance. This is a simple version of the...
5
by: Matthew Woods | last post by:
bool A = Is this the right place to ask this question? if (A) { Where can i find a good example of an ArrayList bound to a datagrid that automatically updates the grid when the public data...
1
by: Dante | last post by:
Hi Folks, I have a datagrid that could be bound to an IBindingList. Currently I don't get it how the mapping is made between the class and the grid. As far as I got I have a class with some...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.