Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

Property change does not refresh custom control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
R.A.F. - 13 Oct 2007 19:35 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.