Unplanned
Last Updated: 29 Mar 2016 12:19 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 05 Feb 2016 14:38
Category: Dock
Type: Bug Report
1
FIX. RadDock - "Close All" and "Close All But This" context menu items does not close all necessary windows
Please refer to the attached sample project and follow the steps illustrated on the gif file.

Workaround: you can control which items to be closed:

public RadForm1()
{
    InitializeComponent();
    ContextMenuService menuService = this.radDock1.GetService<ContextMenuService>();
    menuService.ContextMenuDisplaying += menuService_ContextMenuDisplaying;
}

RadDockLocalizationProvider localizationProvider = RadDockLocalizationProvider.CurrentProvider;

private void menuService_ContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
{
    foreach (RadItem item in e.MenuItems)
    {
        if (item.Text == localizationProvider.GetLocalizedString(RadDockStringId.ContextMenuCloseAll))
        {
            item.Click += item_ClickContextMenuCloseAll;
        }
        else if (item.Text == localizationProvider.GetLocalizedString(RadDockStringId.ContextMenuCloseAllButThis))
        {
            item.Click += item_ClickContextMenuCloseAllButThis;
        }
    }
}

private void item_ClickContextMenuCloseAllButThis(object sender, EventArgs e)
{
    foreach (DockWindow dw in this.radDock1.DockWindows)
    {
        if (dw == this.radDock1.ActiveWindow)
        {
            continue;
        }
        dw.CloseAction = DockWindowCloseAction.Hide;
        dw.Close();
    }
}

private void item_ClickContextMenuCloseAll(object sender, EventArgs e)
{
    foreach (DockWindow dw in this.radDock1.DockWindows)
    {
        dw.CloseAction = DockWindowCloseAction.Hide;
        dw.Close();
    }
}
0 comments