Inheritance from RadMenu

3 posts, 0 answers
  1. Matthias Bibo
    Matthias Bibo avatar
    72 posts
    Member since:
    Mar 2010

    Posted 02 Apr 2012 Link to this post

    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. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 06 Apr 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Matthias Bibo
    Matthias Bibo avatar
    72 posts
    Member since:
    Mar 2010

    Posted 11 Apr 2012 Link to this post

    Thanks,

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

    Regards,

    Matthias

Back to Top