Hide Context menu

4 posts, 0 answers
  1. stealthsid
    stealthsid avatar
    21 posts
    Member since:
    Oct 2006

    Posted 05 Jun 2008 Link to this post

    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.
  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 06 Jun 2008 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. stealthsid
    stealthsid avatar
    21 posts
    Member since:
    Oct 2006

    Posted 06 Jun 2008 Link to this post

    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.

  5. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 09 Jun 2008 Link to this post

    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
Back to Top