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
230
AllowColSizing property issue
posted

Hi!

I bind a DataTable that has a recursive reference to a WinGrid. The result is that I get a grid with several bands which have  all the same columns, Name, StartVal, EndVal, etc.
My goal is to have all the columns' right and left borders in a line like this (sorry I'm not allowed to upload pictures by our security system):

Band 1   - |           Name          |  StartVal  |  EndVal  |
Band 2     +  |         Name        |  StartVal  |  EndVal  |  

... and when I resize a column the columns of all the other bands should also be resized. In my oppinion this can be achieved by the  AllowColSizing property, right? And as I understand documentation correctly I do not have to set the AllowColSizing property to Synchronize because that should be the default value. But if I do not set that property the columns'  looks like this:

Band 1   - |           Name          |  StartVal  |  EndVal  |
Band 2     +  |         Name                               |  StartVal  |  EndVal  |  

... and also the sizing is not synchronic. When I set the property to Synchronize I achiev what I want but the first column's width is set to 1889 and I am not able to change that width anymore. How can I solve that issue? Why I am not able anymore to change that column's with when I set the AllowColSizing property?

Thank you for your help!

Dan

 

  • 469350
    Verified Answer
    Offline posted

    Hi Dan,

    roeschda said:
    as I understand documentation correctly I do not have to set the AllowColSizing property to Synchronize because that should be the default value.

    That's correct. But it's possible this is being changed at design-time, or pehaps you are loading a layout or a Preset into the grid that is changing this from the default. 

    roeschda said:
    When I set the property to Synchronize I achiev what I want but the first column's width is set to 1889 and I am not able to change that width anymore. How can I solve that issue? Why I am not able anymore to change that column's with when I set the AllowColSizing property?

    The reason that the first column gets so big is because each level of the grid is indented a little bit more. When you have a recursive data source like this, then the grid is going to end up creating 100 levels by default and each one gets indented. Since the right edge of the first column in band 100 has to line up with the right edge of the first column in band 0, the column has to be very very wide. 

    There are a number of ways you can handle this. One thing you could do is set the Indentation property on each band to 0. Then there would be no indent. 

    Another thing to do is set MaxBandDepth to something more reasonable. Your data is probably not likely to go 100 levels deep, and even if it did, no user is going to want to drill down that far. I recommend a MaxBandDepth setting of between 5 and 8 for best performance.