MDI control box does not appear when MDI child forms are hidden istead of closed. This happens the second time you are trying to open a previously hidden form right after hiding another MDI child form.
Workaround:
First, you should add the RadMDIControlsItemExtended class to your real solution and then add the following code snippet in the constructor of the parent MDI form:
this.rbMain.RibbonBarElement.ButtonsContainer.Children.RemoveAt(2);
RadMDIControlsItemExtended MDIBox = new RadMDIControlsItemExtended();
this.rbMain.RibbonBarElement.ButtonsContainer.Children.Add(MDIBox);
MDIBox.LayoutPropertyChanged();
RadMDIControlsItemExtended.cs:
using System;
using System.Collections.Generic;
using System.Text;
using Telerik.WinControls.UI;
using System.Windows.Forms;
using Telerik.WinControls;
using System.Reflection;
namespace StandardMdiApplication
{
class RadMDIControlsItemExtended : RadMDIControlsItem
{
protected override void OnHostFormLayout()
{
base.OnHostFormLayout();
FieldInfo fi = typeof(RadMDIControlsItem).GetField("hostForm", BindingFlags.NonPublic | BindingFlags.Instance);
object o = fi.GetValue(this);
Form hostForm = (Form)o;
if (hostForm != null && hostForm.IsMdiContainer)
{
Form maximizedForm = null;
foreach (Form form in hostForm.MdiChildren)
{
if (form is ShapedForm)
{
foreach (Control mdiFormControls in form.Controls)
{
if (mdiFormControls is RadTitleBar)
{
mdiFormControls.Visible = form.WindowState != FormWindowState.Maximized;
}
}
}
if (form.WindowState == FormWindowState.Maximized && form.Visible && (maximizedForm == null || hostForm.ActiveMdiChild == form))
{
maximizedForm = form;
break;
}
}
if (maximizedForm == null)
{
this.Visibility = ElementVisibility.Collapsed;
this.InvalidateMeasure();
return;
}
FormBorderStyle borderStyle = (maximizedForm is RadFormControlBase) ? ((RadFormControlBase)maximizedForm).FormBorderStyle : maximizedForm.FormBorderStyle;
if (maximizedForm != null && maximizedForm.Visible && maximizedForm.ControlBox &&
borderStyle != FormBorderStyle.None &&
borderStyle != FormBorderStyle.SizableToolWindow &&
borderStyle != FormBorderStyle.FixedToolWindow)
{
this.Visibility = ElementVisibility.Visible;
this.InvalidateMeasure();
}
else
{
this.Visibility = ElementVisibility.Collapsed;
this.InvalidateMeasure();
}
}
}
}
}