This is a migrated thread and some comments may be shown as answers.

Hide Context menu

3 Answers 88 Views
Dock
This is a migrated thread and some comments may be shown as answers.
stealthsid
Top achievements
Rank 1
stealthsid asked on 05 Jun 2008, 07:41 PM
I can prevent the context menu from showing for a docked DockPanel by wiring to the DockContextMenu.DropDownOpening event and setting e.Cancel to true.

The problem is that DropDownOpening is only called when the panel is docked. When it's floating I can't figure out how to disable the context menu.

3 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 06 Jun 2008, 01:18 PM
Hi Sedney,

Thank you for writing.

I did tests with DockPanel and its DockContextMenu and the DropDownOpening event fires for the Dock and Floating states.

It appears the issue has something to do with the specifics of your scenario. Please send us a sample application to help us reproduce the issue locally.

I'm looking forward to your response.

Kind regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
stealthsid
Top achievements
Rank 1
answered on 06 Jun 2008, 04:00 PM

Below is the method that creates the panel at runtime.

public
DeckWorkspace CreateNewDockPanelWorkspace(string workspaceName, FloatInfo floatInfo)

{

DeckWorkspace workspace = new DeckWorkspace();

workspace.Name = workspaceName;

workspace.Dock = DockStyle.Fill;

workspace.ControlRemoved += new ControlEventHandler(workspace_ControlRemoved);

SuspendLayout();

SuspendAllChildren(dockingManager1);

DockPanel panel = new DockPanel();

panel.Text = "";

panel.Controls.Add(workspace);

dockingManager1.PrimarySite.DockingManager.SetDock(panel, DockPosition.Default);

panel.HideButtonVisible = false;

panel.DropDownButtonVisible = false;

panel.DockContextMenu.DropDownOpening += new System.ComponentModel.CancelEventHandler(DockContextMenu_DropDownOpening);

panel.BackColor = Color.Transparent;

panel.DockState = DockState.Floating;

panel.DockingSite.HostForm.Size = floatInfo.Size;

panel.DockingSite.HostForm.Top = floatInfo.Top;

panel.DockingSite.HostForm.Left = floatInfo.Left;

panel.Closed += new EventHandler(panel_Closed);

panel.Layout += new LayoutEventHandler(panel_Layout);

ResetTabStrip(panel);

ResumeAllChildren(dockingManager1);

ResumeLayout();

return workspace;

}

void DockContextMenu_DropDownOpening(object sender, System.ComponentModel.CancelEventArgs e)

{

e.Cancel = true;

}




Sidenote/tangent/bug (not really a problem for me, just passing it along) If the tabstrip is not set to visible, changing the panel's text does not actually take effect. So if we're hiding the tabstrip and want to change the title of the panel we have to make the strip visible then invisible again (using 2007 Q3) to get the title to refresh. I may have even mentioned this one before not sure... oh well... thanks for the help.

0
Julian Benkov
Telerik team
answered on 09 Jun 2008, 10:41 AM
Hello Sedney,

Thank you for the reported issue. I found a problem when DockPanel DockState is changed to Floating and then set its Text. The fix will be available for next our release.

Your Telerik point have been updated.

Best wishes,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Dock
Asked by
stealthsid
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
stealthsid
Top achievements
Rank 1
Share this question
or