This question is locked. New answers and comments are not allowed.
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:
The context menu is added like:
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.
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)
<
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
>
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.