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
1815
RowConnectorStyle
posted

Posts on this subject go back a while now. so here is a new one

I was trying to find a way to set different a RowConnectorStyle for each Ultrawingrid band as I only want a connector between the immediate parent and sibling rows, not between parent rows but i cannot turn this property on/off at a band  level which is a real pity

With .Bands(1).Layout
               .RowConnectorStyle = RowConnectorStyle.Inset
                ' Set RowConnectorStyle and RowConnectorColor to change the appearance of row
                ' connectors. Row connectors are the lines that connect sibling rows and child
                ' rows to parent rows.
               .RowConnectorStyle = RowConnectorStyle.Dotted
                .RowConnectorColor = Color.DarkRed
End With

I am hope that this has been addressed since the last post on the subject about 10 years ago.Thank you in advance

  • 469350
    Offline posted

    Hi Stephen, 

    The Row Connectors are essentially a function of the RowScrollRegion. They aren't really associated with a particular band, since some row connectors connect one band to another. 

    Your code here will not work because Layout is a backward pointer. So: 

    grid.DisplayLayout

    is exactly the same as: 

    grid.DisplayLayout.Bands(0).Layout

    The Layout property on the band is a backward pointer to the parent DisplayLayout. So you are setting properties that apply to the entire grid. 

    There is no way to set properties of the row selectors on each band. And nothing have change in that regard as far as the control goes.

    But... if all you want to do is remove the connectors between parent rows, you might be able to achieve that using a DrawFilter. It's very easy to use a DrawFilter to prevent the SiblingRowConnectorUIElement from drawing on the screen. The only really tricky part is identifying which SiblingRowConnectorUIElements apply to the root band and which are on the child band. There's no 100% reliable way to do that, but you could probably make it work in almost all cases by simply checking the Rect of the SiblingRowConnectorUIElement. So, using the default settings of a grid in a very simple sample, I was able to get this to work by checking if the SiblingRowConnectorUIElement.Rect.X is less than 20 and if so, return true from the DrawElement phase of the DrawFilter, which tells the element not to paint. 

    I have attached a small sample project here for your reference.

    As I said, this approach might not be 100% reliable. If your application loads an isl file or sets properties or appearances that make it so that the SiblingRowConnectorUIElement for the root band happens to be greater than 20, then they will show up - which is probably not a huge problem, since it's no worse than what you have now. A worse problem would be if your properties or appearance settings working out in such a way that the child band SiblingRowConnectorUIElements were less than 20, in which case, they would fail to display - so that would probably be worse. But presumably, you can figure out a range that works for your application in most cases for your users. 

     WinGrid_NoRowConnectorsOnBand0_VB.zip