We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Subclass TreeViewAdv

Hi.

I would like to create a subclass control, using TreeViewAdv as parent. I try "Add->User Control->Inherited User Control" and select the "Essential Studio\7.1.0.30\Assemblies\3.5\Syncfusion.Tools.Windows.dll" file. I get a list of controls, but TreeViewAdv is not one of them. Any ideas?

1 Reply

BA Balavasanth Syncfusion Team August 12, 2009 02:02 PM UTC


Hi Ole-Johan,

Thanks for your interests in Syncfusion products.

First I will try explaining you the basic difference between the User Control and the InheritedUserControls. Though the Inherited Controls and User Controls conceptually both can be grouped under Custom Controls category, but there is a difference between Inherited User Controls and User Controls in a practical implementation

Inherited User controls are those existing controls that you would inherit to add custom functionalities. E.g. Wizard, MonthCalendarAdv which typically inherits the System.Windows.Forms.UserControl(in the source) but you could see the implementation of this control as something like

public class CustomizationPanel : System.Windows.Forms.UserControl
{
..
..

}

the control which has the parent as System.Windows.Forms.UserControl are populated when you add the Tools.Windows assembly in the Inherited user control dialog. That is the reason the TreeView is not shown as it is not inherited from a user control. Usually these are used for common validations, GUI features etc.

Solution for your requirement:

If your requirement is to extent our controls with some common application logic. Make the modifiers public, protected, add some revalidations. You can make use of a UserControl or a custom class and inherit our control. I will explain a small scenario where I tried to extend the TreeViewAdv in the TreeViewAdvExt(a new control), use that object as a new control and try populating it. Kindly make use of the code snippet for more idea.

//Extended a new control keeping the TreeViewAdv as base.

public partial class TreeViewAdvExt : TreeViewAdv
{
public TreeViewAdvExt()
{
InitializeComponent();
}


//implemented a new method to override the Vertical scrolling.

public void SetVScroll(bool value)
{
base.VScroll = value;
}
}


In my application.

//Created an instance of the new control.
treeviewadv1 = new TreeViewAdvExt();

//set its vertical scrolling to False.

treeviewadv1.SetVScroll(false);

Please find the below sample which explains the above.

http://files.syncfusion.com/support/Tools.Windows/7.1.0.30/Forum-88734/main.htm

We hope we are clear enough to your question. Please let us know still if you have any queries.

Regards,
Bala.




Loader.
Live Chat Icon For mobile
Up arrow icon