Hi Jon,
The snippet my colleague Kalin sent is working in a standalone application where the RadWaterMarkTextBox control is positioned directly within a Grid.
However when you run the OutllokInspired template (with the code snippet he mentioned applied) and right-click the RadWatermarkTextBox you will see that the RadContextMenu appears only when you have clicked in the area outside the TextBox. As you know the TextBox itself provides its own context menu by default -- the MS Conetxt Menu which is not styled by our theming mechanismns and therefore appears White. So right-click on the TextBox inside the RadWaterMark control and the MS ContextMenu gets shown. So why is this happening:
As you know setting the ContextMenu property of any FrameworkElement to x:Null disabled displaying it. If you look carefully at the xaml structure of the OutlookInspired project you will see that the RadWatermarkTextBox control is inside DataTemplate with x:key MailViewMainSectorTemplate. When you set the ContextMenu property inside a datatemplate, you're not actually setting a local value; you're setting a "TemplatedParent template" value. If you look at the dependency properties precedence list you will see that your setting therefore has lower priority. To prove this you might inspect the value with DependencyPropertyHelper.GetValueSource() and you'll see the base value source is ParentTemplate instead of Local. So how to set a local value -- I suggest that you create new attached dependency property "IsContextMenuDisabled" of type Boolean and set the ContextMenu property of the control to Null explicitly wherever your attached property value is True. Now apply the attached property in xaml on the TextBox and set it to True.
I attached a small sample that demonstrates the attached dependency property approach. Let me know how it works for you.
As for the RibbonWindow ContextMenu -- I'm not sure that I understand your question. Do you try to apply our context menu on it as well? The one you see is the default Windows OS contextmenu that gets applied on every window generated by Windows Explorer (see attached image).
Regards,
Evgenia
Telerik
The snippet my colleague Kalin sent is working in a standalone application where the RadWaterMarkTextBox control is positioned directly within a Grid.
However when you run the OutllokInspired template (with the code snippet he mentioned applied) and right-click the RadWatermarkTextBox you will see that the RadContextMenu appears only when you have clicked in the area outside the TextBox. As you know the TextBox itself provides its own context menu by default -- the MS Conetxt Menu which is not styled by our theming mechanismns and therefore appears White. So right-click on the TextBox inside the RadWaterMark control and the MS ContextMenu gets shown. So why is this happening:
As you know setting the ContextMenu property of any FrameworkElement to x:Null disabled displaying it. If you look carefully at the xaml structure of the OutlookInspired project you will see that the RadWatermarkTextBox control is inside DataTemplate with x:key MailViewMainSectorTemplate. When you set the ContextMenu property inside a datatemplate, you're not actually setting a local value; you're setting a "TemplatedParent template" value. If you look at the dependency properties precedence list you will see that your setting therefore has lower priority. To prove this you might inspect the value with DependencyPropertyHelper.GetValueSource() and you'll see the base value source is ParentTemplate instead of Local. So how to set a local value -- I suggest that you create new attached dependency property "IsContextMenuDisabled" of type Boolean and set the ContextMenu property of the control to Null explicitly wherever your attached property value is True. Now apply the attached property in xaml on the TextBox and set it to True.
I attached a small sample that demonstrates the attached dependency property approach. Let me know how it works for you.
As for the RibbonWindow ContextMenu -- I'm not sure that I understand your question. Do you try to apply our context menu on it as well? The one you see is the default Windows OS contextmenu that gets applied on every window generated by Windows Explorer (see attached image).
Regards,
Evgenia
Telerik
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 Feedback Portal
and vote to affect the priority of the items