Telerik RadContextMenu & MEF

4 posts, 0 answers
  1. Razvan
    Razvan avatar
    3 posts
    Member since:
    Apr 2011

    Posted 26 Apr 2011 Link to this post

    I'm trying to develop a plugin system using MEF and i`m exporting controls from the plugin XAP to the main application. From the plugin, all resources used are in a resource dictionary also exported with MEF. When the plugin is imported the resource dictionary is added to the main's app resources (App.Current.Resources). All goes well, the controls function correctly when imported in the main app, but when trying to open any context menu the application crashes with the following stack trace:
    Error:
    Value does not fall within the expected range.
    STACK TRACE:
       at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
       at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
       at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)
       at System.Windows.UIElement.TransformToVisual(UIElement visual)
       at Telerik.Windows.Controls.RadContextMenu.OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at Telerik.Windows.Controls.RadContextMenu.set_IsOpen(Boolean value)
       at Telerik.Windows.Controls.RadContextMenu.TriggerEventFired()
       at Telerik.Windows.Controls.RadContextMenu.OnEventTriggered(Object sender, EventArgs e)
       at Telerik.Windows.Controls.RadContextMenu.OnElementWithContextMenuMouseClick(Object sender, MouseButtonEventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
    The context menu is added like:
               <Editor_Views:ArrowEx X1="{Binding Start.PosX}"
                                           X2="{Binding End.PosX}"
                                           Y1="{Binding Start.PosY}"
                                           Y2="{Binding End.PosY}"
                                           LinkType="{Binding Model.LinkType,Mode=OneWay}"
                                           StartNodeWidth="{Binding Start.Width}"
                                           StartNodeHeight="{Binding Start.Height}"
                                           EndNodeWidth="{Binding End.Width}"
                                           EndNodeHeight="{Binding End.Height}"
                                           EndArrow="Arrow"
                                           BendAmount="0"
                                           StartArrow="NoArrow"
                                           ArrowSize="10">
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu Visibility="{Binding CurrentState, Converter={StaticResource StateToVisibilityConverter}}">
                        <telerik:RadMenuItem Header="Delete"
                                             Command="{Binding DeleteCommand}">
                            <telerik:RadMenuItem.Icon>
                                <Image Source="/Editor;component/Assets/Icons/delete.png"
                                       Width="16"
                                       Height="16" />
                            </telerik:RadMenuItem.Icon>
                        </telerik:RadMenuItem>
                    </telerik:RadContextMenu>
                </telerik:RadContextMenu.ContextMenu>
            </Editor_Views:ArrowEx>
    In the main app the control is added to an ItemsControl which resides in a child window. The main app has no knowledge whatsoever about what control comes from the plugin. All the logic is done in the plugin.
    Saw the following post and i wonder if it's the same case http://www.telerik.com/community/forums/preview-thread/silverlight/menu/contextmenu-as-static-resource.aspx .
    If anyone has encountered this before or has any suggestions? Thank you.
  2. Razvan
    Razvan avatar
    3 posts
    Member since:
    Apr 2011

    Posted 28 Apr 2011 Link to this post

    Seems that the issue is easier to reproduce than i expected. Here  you can download the project that reproduces the issue. I need an answer soon as this is very important. Thank you.
  3. DevCraft banner
  4. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 28 Apr 2011 Link to this post

    Hello Razvan,

    This problem is resolved with our latest official release.
    Please use 2011 Q1 SP1 assemblies.

    Sorry for the caused inconvenience.

    All the best,
    Hristo
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Razvan
    Razvan avatar
    3 posts
    Member since:
    Apr 2011

    Posted 29 Apr 2011 Link to this post

    Thank you. Downloaded the new assemblies and everything works as expected.
Back to Top