I am trying to add custom ContextMenu to RadWatermarkTextBox using RadContextMenu.ContextMenu attached property and disabling the default context menu. The custom context menu is working fine with the following XAML
but the problem is, if I select some text and opens the context menu, the selection of RadWatermarkTextBox becomes clear as soon as context menu is open. Which doesn't look very good. And with default context menu this is not the behavior.
I have tried following code in ContextMenu Opening event but no luck
Please any suggestion for fix of this issue.
<
telerik:RadWatermarkTextBox
Text
=
"This is a test Text"
Width
=
"875"
Height
=
"70"
ContextMenu
=
"{x:Null}"
>
<
telerik:RadContextMenu.ContextMenu
>
<
telerik:RadContextMenu
>
<
telerik:RadMenuItem
Header
=
"Copy"
/>
<
telerik:RadMenuItem
Header
=
"Paste"
/>
<
telerik:RadMenuItem
Header
=
"Cut"
/>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>
<
telerik:RadMenuItem
Header
=
"Select All"
/>
</
telerik:RadContextMenu
>
</
telerik:RadContextMenu.ContextMenu
>
</
telerik:RadWatermarkTextBox
>
but the problem is, if I select some text and opens the context menu, the selection of RadWatermarkTextBox becomes clear as soon as context menu is open. Which doesn't look very good. And with default context menu this is not the behavior.
I have tried following code in ContextMenu Opening event but no luck
var tb = radContextMenu.GetClickedElement<RadWatermarkTextBox>();
if
(tb !=
null
)
{
tb.Focus();
}
Please any suggestion for fix of this issue.