I decided that it would be easier to control everything if I built my treeview by hand, one node at a time. I wanted to suppress checkbox display on all levels of the tree but the lowest level. However, even though I set ShowCheckBox = false for all levels, it does not suppress the checkboxes at the highest level of the tree. Otherwise, the tree renders perfectly. I tried setting tShowCheckBox to false for the lowest level, and that worked. Is this a bug, and if so, is there a workaround? Can anyone suggest how to make this work?
Here is the code:
The binding sources, if you need to see them, look like:
Here is the code:
private void BuildTreeFromBindingSourceData()
{
this.monitorRadTreeView.Nodes.Clear();
int companyBindingSourcePosition;
int plantCompanyBindingSourcePosition;
int equipmentPlantBindingSourcePosition;
RadTreeNode companyNode;
RadTreeNode plantNode;
RadTreeNode equipmentNode;
if (companyBindingSource.Count > 0)
{
companyBindingSourcePosition = 0;
while (companyBindingSourcePosition <
companyBindingSource.Count
)
{
companyBindingSource.Position
=
companyBindingSourcePosition
;
companyNode
=
new
RadTreeNode();
companyNode.Text = ((MonitorInterfaceDBDataSet.CompanyRow) ((DataRowView)companyBindingSource.Current).Row).Name;
companyNode.Tag = ((MonitorInterfaceDBDataSet.CompanyRow)((DataRowView)companyBindingSource.Current).Row).ID;
companyNode.ShowCheckBox
=
false
;
if (plantCompanyBindingSource.Count > 0)
{
plantCompanyBindingSourcePosition = 0;
while (plantCompanyBindingSourcePosition <
plantCompanyBindingSource.Count
)
{
plantCompanyBindingSource.Position
=
plantCompanyBindingSourcePosition
;
plantNode
=
new
RadTreeNode();
plantNode.Text = ((MonitorInterfaceDBDataSet.PlantRow)((DataRowView)plantCompanyBindingSource.Current).Row).Name;
plantNode.Tag = ((MonitorInterfaceDBDataSet.PlantRow)((DataRowView)plantCompanyBindingSource.Current).Row).ID;
plantNode.ShowCheckBox
=
false
;
if (equipmentPlantBindingSource.Count > 0)
{
equipmentPlantBindingSourcePosition = 0;
while (equipmentPlantBindingSourcePosition < equipmentPlantBindingSource.Count)
{
equipmentPlantBindingSource.Position = equipmentPlantBindingSourcePosition;
equipmentNode = new RadTreeNode();
equipmentNode.Text = ((MonitorInterfaceDBDataSet.EquipmentRow)((DataRowView)equipmentPlantBindingSource.Current).Row).Name;
equipmentNode.Tag = ((MonitorInterfaceDBDataSet.EquipmentRow)((DataRowView)equipmentPlantBindingSource.Current).Row).ID;
equipmentNode.ShowCheckBox = true;
plantNode.Nodes.Add(equipmentNode);
equipmentPlantBindingSourcePosition++;
}
}
companyNode.Nodes.Add(plantNode);
plantCompanyBindingSourcePosition++;
}
}
this.monitorRadTreeView.Nodes.Add(companyNode);
companyBindingSourcePosition++;
}
}
}
The binding sources, if you need to see them, look like:
companyBindingSource = new BindingSource();
companyBindingSource.DataSource = monitorInterfaceDBDataSet;
companyBindingSource.DataMember = "Company";
plantCompanyBindingSource = new BindingSource();
plantCompanyBindingSource.DataSource = companyBindingSource;
plantCompanyBindingSource.DataMember = "FK_Plant_Company";
equipmentPlantBindingSource = new BindingSource();
equipmentPlantBindingSource.DataSource = plantCompanyBindingSource;
equipmentPlantBindingSource.DataMember = "FK_Equipment_Plant";