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
1105
Double click on edge of column header and autosize
posted

Today in our ultragrid we allow both column sizing and summary values.

In the case of summary values, we've recognized that the method used to calculate the recommended width of the column does not include the width of a summary.

As a result, we have added our own "Resize Column" function off a RCM of the column header.  Our logic calls the CalcualteAutoResizeWidth() method, then goes the extra step of considering the width of any summary for that column.

It was only recently pointed out to me by a q/a analyst that double clicking between column headers causes a column to be autosized.  Unfortunately that does not run our custom code that considers the summary sizes.

I've been trying (unsuccessfully) to come up with a solution for this.  Here's what I've tried so far:

1) Using the BeforeColPosChanged event to cancel the resize.  The problem is that event has no way of distinguishing between a column size changing due to drag/resize, or a double-click autosize.

2) Using the DoubleClickHeader event to cancel / ignore the autoresize.  Unfortunately on double click between headers, the sort is performed before the DoubleClickHeader event is fired.

3) Using the AfterColPosChanged to always consider the newly created size and increase it for the size of a summary.  This fails though because again I don't know whether it was an autosize or a manual drag of the column size that resulted in the event being thrown.

4) Using the MouseDoubleClick event to cancel / ignore the autoresize.  The problem here is that I must perform an ElementFromPoint.  I expected to get a different UI element when I double click between column headers (the icon changes) but I don't, I still get  HeaderUIElement.

Ultimately I need for that autosize to consider the size of a potential summary, but also not prevent the user from manually dragging the size of the column to be smaller than the size of the summary if they so choose.

Any assistance would be greatly appreciated.

Chris Rowland

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Chris,

    Chris said:
    the method used to calculate the recommended width of the column does not include the width of a summary

    I consider this a bug and I'm going to forward this thread over to Infragistics Developer Support so they can get it corrected.

    Chris said:
    1) Using the BeforeColPosChanged event to cancel the resize.  The problem is that event has no way of distinguishing between a column size changing due to drag/resize, or a double-click autosize.

    This is very easy to get around. All you have to do is set a flag when you are setting the Width property on the column in your code. When the flag is set, you know that you are the one setting it and you are therefore the one triggering BeforeColPosChanged and you don't need to cancel it. When the flag is not set, you set it, then use your function to calculate the width of the column and set it, then reset the flag.

     

     

Children
No Data