I turned on display checkboxes in the new treelist checkbox feature. How do I hide them for parent nodes and display the checkboxes for child nodes?
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello Wendy,
Sorry, we have not been able to find an immediate answer or resolution. Please bear with us. We will inform you as soon as possible.
Thank you, Alex.
Hello Wendy,
You can hide check boxes for parent nodes by handling the CustomDrawNodeCheckBox event. In this event, you need to manually paint tree lines instead of check boxes for specific nodes. See the code below:
private void treeList1_CustomDrawNodeCheckBox(object sender, DevExpress.XtraTreeList.CustomDrawNodeCheckBoxEventArgs e) {
if (e.Node.HasChildren) {
DevExpress.XtraTreeList.ViewInfo.IndentInfo ii = treeList1.ViewInfo.RowsInfo[e.Node].IndentInfo;
int x2 = e.Bounds.Left + ii.LevelWidth/2;
int y2 = e.Bounds.Top + e.Bounds.Height/2;
int h2 = e.Bounds.Height / 2 + 1;
Rectangle r1 = new Rectangle(e.Bounds.Left, y2, e.Bounds.Width, 1);
Rectangle r2 = new Rectangle(x2, y2, 1, h2);
e.Graphics.FillRectangle(treeList1.ViewInfo.RC.TreeLineBrush, r1);
if (e.Node.Expanded) {
e.Graphics.FillRectangle(treeList1.ViewInfo.RC.TreeLineBrush, r2);
}
e.Handled = true;
}
}
Thank you, Alex.