Modal Radwindow Popup Right Click Bug/Issue

1 posts, 0 answers
  1. Matthew
    Matthew avatar
    4 posts
    Member since:
    May 2013

    Posted 30 May 2013 Link to this post

    A web application's Modal Radwindow Popup, when user right clicks anywhere on the radwindow or on the grayed-out background the context menu of the window behind the popup appears. I have a working fix for right now, but there must be a cleaner way to either make the popup truely modal or to disable the context menu of the parent page when the radwindow popup is up.

    Thanks for the help in advance.


    public void ShowPopup(string title, FrameworkElement content, double x,
    double y, double width, double height, string instanceName,
    bool isModal, EventHandler<WindowClosedEventArgs> closedEvent)
    {
                if (isModal) { currentPopup = instanceName; }
                PopupRadWindow popupWindow;
                if (popUpWindowDictionary.ContainsKey(instanceName))
                {
                    popupWindow = popUpWindowDictionary[instanceName];
                    if (popupWindow != null)
                    {
                        popupWindow.Close();
                        popUpWindowDictionary.Remove(instanceName);
                    }
                }
                Visibility userAccessButtonVisibility = Visibility.Collapsed;
                string moduleName = string.Empty;
                bool enblePermissionEdit = bool.Parse(ServiceProvider.Instance.InitParameters[ParameterNames.EnablePermissionEdit]);
                if (content is PopupModuleContent)
                {
                    PopupModuleContent pc = content as PopupModuleContent;
                    if (USER_ACCESS_VIEW_NAME != pc.ModuleName && enblePermissionEdit)
                    {
                        userAccessButtonVisibility = Visibility.Visible;
                        moduleName = pc.ModuleName;
                        AddParameter(ParameterNames.SilverlightModuleName, moduleName);
                    }
                }
                else if (USER_ACCESS_VIEW_NAME != GetModuleName(content) && enblePermissionEdit)
                {
                    userAccessButtonVisibility = Visibility.Visible;
                    moduleName = GetModuleName(content);
                    AddParameter(ParameterNames.SilverlightModuleName, moduleName);
                }
     
                if (RegionManager.Regions[RegionNames.MainRegion] != null
                    || RegionManager.Regions[RegionNames.MainRegion].ActiveViews.FirstOrDefault() != null)
                {
                    ViewBase vb = RegionManager.Regions[RegionNames.MainRegion].ActiveViews.FirstOrDefault() as ViewBase;
                    if (vb != null)
                        AddParameter(ParameterNames.CurrentPageName, vb.PageName);
                }
     
                popupWindow = new PopupRadWindow(userAccessButtonVisibility);
                 
                if (closedEvent != null)
                {
                    popupWindow.Closed += closedEvent;
                }
     
                if (content is PopupModuleContent)
                {
                    PopupModuleContent popupModuleContent = (PopupModuleContent)content;
                    if (popupModuleContent.ContentControl != null &&
                        popupModuleContent.ContentControl.Content is IPopupContent)
                    {
                        IPopupContent iPopupContent = (IPopupContent)popupModuleContent.ContentControl.Content;
                        iPopupContent.OKButtonClicked += delegate { popupWindow.DialogResult = true;popupWindow.Close(); };
                        iPopupContent.CancelButtonClicked += delegate { popupWindow.DialogResult = false; popupWindow.Close(); };
                    }
                }
     
                popupWindow.IsShowModal = isModal;
                popUpWindowDictionary.Add(instanceName, popupWindow);
                if (content is PopupModuleContent)
                {
                    popupWindow.ModuleName = moduleName;
                }
                popupWindow.Show(title, content, x, y, width, height);
    }
Back to Top