Flexible TreeView 5.1.9 Help
Column controls. Create custom control

In case you are not satisfied with provided column controls it is easy to create a custom column control manually.

Flexible TreeView provides couple of ways to implement the custom column controls:

We recommend to use the first approach for most needs and switch to the second one when you really need to create something very unique as it will involve some coding.


Inheriting ButtonColumnControl

The ButtonColumnControl base column control class provides the basic functionality to display the button with an optional dropdown arrow and an icon and allows to handle button clicks.

Particularly, when deriving from ButtonColumnControl class the descendant class should override the HandleButtonClick method and do any desired action. The HandleButtonClick method is called each time the column control's button is clicked. By examining the pArgs passed parameter you can know the mouse state when clicked.

Below the sample ClickableColumnControl column control is shown which show the message when the column control's is clicked.

class ClickableColumnControl : ARMSoft.FlexibleTreeView.Column.Controls.ButtonColumnControl
{
  protected override void HandleButtonClick(MouseActionArgs pArgs, DrawContext pContext)
  {
    MessageBox.Show("The button was clicked!");
  }
}
 
// Create column for the column control.
TreeColumn column = new TreeColumn("Action");
tree.Columns.Add(column);
 
// Add column control to the column.
ClickableColumnControl columnControl = new ClickableColumnControl();
column.Controls.Add(columnControl);
Class ClickableColumnControl
    Inherits ARMSoft.FlexibleTreeView.Column.Controls.ButtonColumnControl
    Protected Overrides Sub HandleButtonClick(pArgs As MouseActionArgs, pContext As DrawContext)
        MessageBox.Show("The button was clicked!")
    End Sub
End Class

' Create column for the column control.
Dim column As New TreeColumn("Action")
tree.Columns.Add(column)

' Add column control to the column.
Dim columnControl As New ClickableColumnControl()
column.Controls.Add(columnControl)

By changing the Image and ShowDropDownArrow ButtonColumnControl properties you can change the column control behavior and appearance.

 

 


Copyright © 2006-2016 ARMSoft

www.FlexibleTreeView.com