public void Attach(Gtk.Orientation orientation_new) { Gtk.Box.BoxChild child = null; Box box; switch (Orientation) { case Gtk.Orientation.Vertical: box = main_hbox; break; case Gtk.Orientation.Horizontal: { box = framework_vbox; break; } default: throw new InvalidOperationException(); } bool contained = false; foreach (var ch in box.AllChildren) { if (ch == this) { contained = true; break; } } if (contained == true) { box.Remove(this); } Orientation = (Gtk.Orientation)orientation_new; switch (Orientation) { case Gtk.Orientation.Vertical: main_hbox.Add(this); main_hbox.ReorderChild(this, 0); child = ((Gtk.Box.BoxChild)(main_hbox[this])); break; case Gtk.Orientation.Horizontal: framework_vbox.Add(this); framework_vbox.ReorderChild(this, 1); child = ((Gtk.Box.BoxChild)(framework_vbox[this])); break; default: throw new InvalidOperationException(); } child.Expand = false; child.Fill = false; ShowAll(); InitCompleted = true; }