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

Inheritance from RadMenu

2 Answers 55 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Matthias Bibo
Top achievements
Rank 1
Matthias Bibo asked on 02 Apr 2012, 12:05 PM

Hello,

we have inherited our own controlset  from the Telerik Rad-controls, so that we can extend them on demand with custom functionality.

Everything works perfect, but we have a small  issue with the context menu.

It works on runtime, but on designtime it destroys our xaml previews, so that we have no previews anymore.

The function GetContextMenu() seems to lead to a null exception in the xaml.

So, my question is, what are we doing wrong, and what is the correct way to inherit from RadContextMenu.

Regards,

BDL

namespace Bdl.DialogCrm.Silverlight.Core.BDLControls
{
    using System.Linq;
    using Bdl.DialogCrm.Silverlight.Core.ViewManagement;
    using Telerik.Windows.Controls;
   
    public class BDLContextMenue : RadContextMenu
    { 
        public BDLContextMenue()
        {
        }
   
        public static new BDLContextMenue GetContextMenu(System.Windows.FrameworkElement element)
        {
            if (RadContextMenu.GetContextMenu(element) is BDLContextMenue)
            {
                return (BDLContextMenue)RadContextMenu.GetContextMenu(element);
            }
            else 
            {
                return null;
            }
        }
   
        public bool HasMenuItem(BDLMenuItem item)
        {
            if (this.Items.Any(x => ((x is BDLMenuItem) && ((x as BDLMenuItem) == item))))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

2 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 06 Apr 2012, 12:32 PM
Hi Matthias,

The problem is that there was no Set method implemented. Please find attached the project with added Set method. This should resolve the issue.

Kind regards,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Matthias Bibo
Top achievements
Rank 1
answered on 11 Apr 2012, 08:29 AM

Thanks,

for the help, now it works perfect and we have our XAML preview back.

Regards,

Matthias

Tags
Menu
Asked by
Matthias Bibo
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Matthias Bibo
Top achievements
Rank 1
Share this question
or