Hi,
I have a custom control in which i have a property based on
CollectionBase class.
like the following one :
//------- XGrid.cs file --------------//
[Category("Behavior"),
Browsable(true),
Description("Column Collection"),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ColumnsCollection Columns
{
get
{
if (this.m_Columns == null)
{
this.m_Columns = new ColumnsCollection(this);
}
return this.m_Columns;
}
}
protected internal virtual void OnColumnAdded(ColumnsCollectionEventArgs e)
{
this.Invalidate(); // <- this does not refresh the control on design
time :-(
if (ColumnAdded != null)
{
ColumnAdded(this, e);
}
}
//------- ColumnsCollection.cs file --------------//
this collection (named Columns) is as the following :
public class ColumnsCollection : CollectionBase
{
...
public ColumnsCollection(XGrid owner): base()
{
if (owner == null)
{
throw new ArgumentNullException("owner");
}
this.m_owner = owner;
}
public void Add(Column column)
{
if (column == null)
{
throw new System.ArgumentNullException("Column is null");
}
int index = this.List.Add(column);
this.RecalculateTotalWidth();
this.OnColumnAdded(new ColumnEventArgs(column, this.IndexOf(column),
ColumnEventType.ColumnAdded, null));
}
...
protected virtual void OnColumnAdded(ColumnEventArgs e)
{
this.m_owner.OnColumnAdded(e);
}
...
}
unfortunatelly, my control is not refresh automatically when i add a new
column to the Columns Property.
i have the same issue with removing column.
any idea ?
thanks a lot,
RAF
Husam Al-A''araj - 13 Oct 2007 20:57 GMT
hello,
This may help
http://www.vbdotnetheaven.com/UploadFile/scottlysle/CCAutoRefresh11012006154238P
M/CCAutoRefresh.aspx
regards,
Husam Al-A'araj
www.aaraj.net
> Hi,
>
[quoted text clipped - 73 lines]
>
> RAF
R.A.F. - 14 Oct 2007 08:22 GMT
Hi,
Unfortunatelly it does not help me.
Basically my problem is when i change this COlumns property, my control
does not update/refresh to show those changes... but if i change another
property, it refresh perfectly the control and shows changes performed
by Columns property :-(
so something must be wrong with this Columns property refreshing....but
what ?
RAF
> hello,
> This may help
[quoted text clipped - 81 lines]
>>
>> RAF
R.A.F. - 15 Oct 2007 09:02 GMT
ok, i finally found how to refresh my control when a collection property
is updated and i do not see it as really LOGICAL. :-(
basically, i needed to create a special property editor for this
collection property and into the overridden function EditValue, i placed
control.refresh();
this force my control to redraw when i add or remove a column from this
collection property.
Why a simple invalidate() into the add or remove functions (from my
collection class) does not work ? this is a mystery for me.
Any idea ?
RAF
> Hi,
>
[quoted text clipped - 97 lines]
>>>
>>> RAF