PC Review


Reply
Thread Tools Rate Thread

Collection issue to refresh control : suite

 
 
--== Alain ==--
Guest
Posts: n/a
 
      23rd Feb 2007
Hi,

I'm still in trouble with my collection which should refresh my control.
Here is my code extract.

custom Control class code :
....
private ColumnEventHandler HandlerColumnCollectionChanged;
....
/// in constructor
public CARListView()
{
this.HandlerColumnCollectionChanged = new
ColumnEventHandler(OnColumnCollectionChanged);

this.Columns.ColumnAmountChanged += this.HandlerColumnCollectionChanged;
}
....
[Category("Behavior")]
[Browsable(true)]
[Description("Column Collection")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Editor(typeof(ColumnCollectionEditor),
typeof(System.Drawing.Design.UITypeEditor))]
public ColumnCollection Columns
{
get
{
if (this.m_columns == null)
{
this.m_columns = new ColumnCollection(this);
}
return this.m_columns;
}
}
....
public void OnColumnCollectionChanged(object Sender, ColumnEventArgs e)
{
this.Invalidate();
}


in my ColumnCollection class, i have the following code :
public event ColumnEventHandler ColumnAmountChanged;
public int Add(Column column)
{
if (column == null)
{
throw new System.ArgumentNullException("Column is null");
}

int index = this.List.Add(column);
this.RecalcWidthOfAllColumns();
this.OnColumnAmountChanged(new ColumnEventArgs(column, index,
ColumnEventType.ColumnAdded, null));

return index;
}
....
protected virtual void OnColumnAmountChanged(ColumnEventArgs e)
{
if (ColumnAmountChanged != null)
{
ColumnAmountChanged(this, e);
}
}
....

So everytime that a column is added, it should raise the event
ColumnAmountChanged. This event should be caught by
OnColumnCollectionChanged handler method, but it is not true.

So where could be the problem ?

thanks a lot,

Al.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
collection property and refresh control --== Alain ==-- Microsoft VB .NET 3 21st Feb 2007 09:21 PM
collection property and refresh the parent control --== Alain ==-- Microsoft Dot NET 1 21st Feb 2007 08:04 AM
Designer -> 'Collection' type property -> refresh control after adding new items 12jumper@wp.pl Microsoft C# .NET 1 10th Jan 2007 03:33 PM
Can't get collection to save when using collection of custom class as property of control in VS 2005 J.Edwards Microsoft Dot NET Compact Framework 0 10th Jan 2006 04:44 AM
Use Pocket PC to control your Media Player computer -- PPC Tablet Remote Control Suite 2.0 HL Microsoft Windows 2000 Multimedia 0 21st Dec 2004 02:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:50 PM.