I usually do database and web development but at the moment I'm learning desktop development with Mono and Gtk# using using the MonoDevelop IDE. I'm also using the Stetic GUI Designer inside MonoDevelop to create the GUI.
What are the best practices when using a GUI designer to encapsulate extra logic that is related to a widget used in the GUI designer?
For example I may use a TreeView widget but I'll also need to have logic specific to how the cells render, deleting selections of rows, etc. My first thought would be to simply extend the Treeview like so:
public class MyTreeView : TreeView {}
But I don't think I can do that and still use the GUI Designer (correct me if I'm wrong).
What I'm doing now is making a class that has the TreeView as a member of it:
public class MyTreeView
{
private widget;
private MyTreeView(TreeView treeView)
{
this.widget = treeView;
}
}
Am I on the right track or is there some special and fancy pattern or C# language feature that I don't know of that I should be using instead?