Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Fri Sep 05, 2008 8:52 am Post subject: HOWTO: Override the multi-state checkbox functionality in FolderView |
|
|
FolderView shows multi-state checkboxes where the check-state of a node depends not only on whether the node itself is checked or unchecked but also on whether the node' children are checked or unchecked. The default multi-state functionality in FolderView can be overridden to show any desired check-state for any combination of checked/unchecked children and the node itself. This is done using the QueryNodeCheckState event as follows :
[C#]
private void fldrView_QueryNodeCheckState(object sender, LogicNP.FolderViewControl.FolderViewEventArgs e)
{
// Query the combined check-state of all children,
// If it is 'FOVSomeChecked', meaning some but not all children are checked,
// set the checkstate of the node to Checked.
// Default implementation shows a filled checkbox with no check mark indicating
// that some of the node's children are checked but the node itself is not checked
// This code overrides that
if(e.Node.GetChildrenCheckState()== ChildrenCheckState.SomeChecked)
e.Node.CheckState = NodeCheckStates.Checked;
}
[VB.Net]
Private Sub fldrView_QueryNodeCheckState(ByVal sender As Object, ByVal e As LogicNP.FolderViewControl.FolderViewEventArgs) Handles fldrView.QueryNodeCheckState
' Query the combined check-state of all children,
' If it is 'FOVSomeChecked', meaning some but not all children are checked,
' set the checkstate of the node to Checked.
' Default implementation shows a filled checkbox with no check mark indicating
' that some of the node's children are checked but the node itself is not checked
' This code overrides that
If (e.Node.GetChildrenCheckState() = ChildrenCheckState.SomeChecked) Then
e.Node.CheckState = NodeCheckStates.Checked
End If
End Sub |
|