Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is there an Event that fires when a control is fully constructed.

Posted on 2011-02-18
7
Medium Priority
?
315 Views
Last Modified: 2013-12-17
I have a custom control, derived from a ListView.
When the control is built, I want to do some work on the columns that are in the listview.
However, when I fire the method doing the work, at the end in the constructor, it can't find the columns yet.

Is there an event fired once the listview is completely built, that I could handle to do the work.

Thanks in advance :).
0
Comment
Question by:robleenheer
7 Comments
 
LVL 1

Accepted Solution

by:
diwakarverma earned 1000 total points
ID: 34926398
you can use HandleCreated event. It occurs when a handle is created for the control.

if you just wants to update the column property, you can use paint event but its performance.
0
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 34926483
Are you data binding the custom control?  There is an OnItemDataBound and an OnItemCreated and then there is a Render event.

So depending on what you are trying to do with the listview, you can tap into the events that make sense for you.
0
 

Author Comment

by:robleenheer
ID: 34930861
HandleCreated for the (derived) listview apears to be firing before the columns are created.

this.Columns == null

returns true


I'm looking for an event that fires after all columns are created...... if there is one.

It's a bit like the 'Load' event in a form, whch fires after all controls in teh form have been added.
I'm looking for a 'Load' equivalent in ListView that fires after all Columns have been added.

No databinding
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34930966
If you statically defined the columns (i.e. you added the columns using the properties window in the form designer), you should find that they're added inside the InitializeComponent() method in the .Designer.cs file for your user control, so they should be available any time after the call to InitializeComponent() in the constructor of your user control.
0
 

Author Comment

by:robleenheer
ID: 34930969
My previous comment is actually incorrect.
HandleCreated fires beautifully as I want it.

Thanks

0
 

Author Closing Comment

by:robleenheer
ID: 34930974
Thanks
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34930996
Just be aware that it's possible for the HandleCreated event to be raised before there are any columns.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question