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

Exception when opening ContextMenu 2nd time

2 Answers 65 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 21 Feb 2013, 07:40 PM
I have a RichTextBox in the main page. I have a RadWindow, which also contains a RichTextBox, that is open over the top of the one in the main page. Both RichTextBoxes have custom context menus. The context menu for the RichTextBox in the main page works perfectly. The context menu for the RichTextBox in the RadWindow opens correctly the first time, but throws an exception the 2nd time.

Value does not fall within the expected range.

   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, Boolean b)
   at System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
   at System.Windows.Controls.Primitives.Popup.set_IsOpen(Boolean value)
   at Telerik.Windows.Controls.PopupPlacement.OpenPopup()
   at Telerik.Windows.Controls.PopupPlacement.OnIsOpenPropertyChanged(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.RefreshExpression(DependencyProperty dp)
   at System.Windows.Data.BindingExpression.SendDataToTarget()
   at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args)
   at System.Windows.PropertyPathListener.ReconnectPath()
   at System.Windows.Data.Binding.EnsureBreakPoint(BindingDebugState debugState, Action callback, Boolean canDelay)
   at System.Windows.Data.BindingExpression.OnSourcePropertyChanging(Action action)
   at System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(PropertyPathStep source)
   at System.Windows.PropertyAccessPathStep.RaisePropertyPathStepChanged(PropertyListener source)
   at System.Windows.DependencyPropertyListener.SourcePropertyChanged(DependencyObject sender, DependencyProperty dp)
   at System.Windows.Data.WeakDependencyPropertyChangedListener.SourcePropertyChanged(DependencyObject sender, DependencyProperty dp)
   at System.Windows.DPChangedEventHandler.Invoke(DependencyObject sender, DependencyProperty dp)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyProperty dp)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyProperty dp)
   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, Boolean isBindingInStyleSetter)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.RadContextMenu.set_IsOpenInternal(Boolean value)
   at Telerik.Windows.Controls.RadContextMenu.OpenPopup()
   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, Boolean isBindingInStyleSetter)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.RadContextMenu.set_IsOpen(Boolean value)
   at Telerik.Windows.Controls.RichTextBoxUI.ContextMenu.ShowMenu(Point location, RadRichTextBox radRichTextBox, WordInfo incorrectWordInfo)
   at Telerik.Windows.Controls.RichTextBoxUI.ContextMenu.Show(Point location, RadRichTextBox radRichTextBox, WordInfo incorrectWordInfo)
   at Telerik.Windows.Controls.RadRichTextBox.ShowContextMenuAtDocumentPosition(Point proposedLocation, DocumentPosition position)
   at Telerik.Windows.Documents.UI.DocumentPresenterBase.HandleMouseRightButtonUpOnPosition(Point clickPosition)
   at Telerik.Windows.Documents.UI.DocumentPresenterBase.Owner_MouseRightButtonUp(Object sender, MouseButtonEventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

2 Answers, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 22 Feb 2013, 12:36 PM
Hello John,
Sometimes similar issues can be observed due to the fact that one ContextMenu is shared between the different RadRichTextBox instances. You can try the workaround described in this forum thread. If this doesn't help, please try to isolate the problem in a sample project and send it to us for further investigation.

Kind regards,
Boby
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
John
Top achievements
Rank 1
answered on 11 Mar 2013, 04:55 PM
I was unable to create a sample project that duplicated the problem, even after several attempts, so this remains a mystery. I worked around the problem by using the native silverlight toolkit context menu.
Tags
RichTextBox
Asked by
John
Top achievements
Rank 1
Answers by
Boby
Telerik team
John
Top achievements
Rank 1
Share this question
or