private static WorkspaceView GetWorkspaceView(Control ctrl, Type workspaceViewType)
{
while (true)
{
var parent = ctrl.Parent;
if (parent == null)
return null;
if (parent.GetType() == workspaceViewType)
return (WorkspaceView) parent;
ctrl = parent;
}
}