Build User Controls for all the views that you want. You can pretty much encapsulate most of the work inside each view. If you need an outside manipulation. You can expose a property or a method. If you need the user control to notify the parent/container, you create an event delegate. You might want use a panel on the main form to hold the views.
Ex user controls.
1. Calendar
2. Email
3. Contacts
and so on...
Create a user control for the side bar that contains the buttons to toggle the view. This way you can encapsulate how the side bar should behave. Create an event delegate for the button corresponding to the view.
Ex.
Define an event delegate CalendarButton_Click(I usually just use the argument that comes with the default Button_ClickEvent) that you want to bubble up.
Inside the default btnCalendarButton_Click add RaiseEvent CalendarButton_Click(sender, e);
Now your mainform can catch the event of the sidebar buttons. You will see your custom events for the sidebar under the Misc Category (click on the Lightning Icon).
The actual event should look something like this;
CalendarButton_Click
{
if (cal == null)
{
cal = new CalendarView(); // in this case cal is a class level object
panel.Controls.Add(cal);
}
cal.Visible = true;
email.Visible = false;
contact.Visible = false;
}
My personal approach is to;
1. Use a property or method to communicate with the child control
2. Use an event delegate to make the child control communicate with the parent