Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4133
Fastest Way To Tell If Row Has Been Painted
posted

I would like to find the fastest way to tell if a grid row has been painted.  I am currently calling the GetUIElement on the row in the InitializeRow event and my profiler tool is saying that is taking a very long time.  I tried the GetType method and it is much faster, but I am looking for a best practice.  I do not want to force the row to be painted.  I just want to see if it has ever been painted.

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    GetUIElement does a linear walk through all of the grid's UIElements, hence the less-than-optimal performance.

    I attached a sample that uses the IUIElementCreationFilter interface to track the creation of RowUIElements.

    Note that I assume we are considering "painted" and "has a UIElement" to be logically equivalent for the purposes of this problem; a control's UIElements can be generated independently of a paint operation so I just want to clarify that point.

    HasRowElement.zip
Children