Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1886
XamComboEditor (IsEditable) and Custom ContextMenu Problems
posted

Hello,  I have a XamComboEditor that I want to have display a custom Context menu when it is right clicked.  Create ContextMenu resource, set contextMenu Property - everything is fine... 

UNTIL you set the XamComboEditor IsEditable property = true!!!! 

with IsEditable = true, the custom menu only appears when the Drop Down arrow or the dropdown items are right clicked.  If you right click in the text area - it displays the basic editing context menu (Cut, Copy, Paste)

How do i get the custom menu to appear all the time on a right click when iseditable = true!!!!!

thanks

Rod 

 


<ContextMenu x:Key="PrmXContextMenu" >
   <MenuItem Header="Cut"  />
   <MenuItem Header="Copy"  />
   <MenuItem Header="Paste" />
   <Separator/>
   <MenuItem Header="Add Record"  />
   <MenuItem Header="Insert Record"  />
   <MenuItem Header="Delete Record"  />
   <MenuItem Header="Move Record"  >
      <MenuItem Header="Move Record Up" />
      <MenuItem Header="Move Record Down"  />
   </MenuItem >
</ContextMenu>
           

 <igEditors:XamComboEditor x:Name="ddDoWhat" Margin="5,0,3,3" ContextMenu="{StaticResource PrmXContextMenu}" IsEditable="True" >
   <igEditors:XamComboEditor.ItemsProvider>
      <igEditors:ComboBoxItemsProvider >
         <igEditors:ComboBoxItemsProvider.Items>
            <igEditors:ComboBoxDataItem DisplayText="Replace (1)" Value="1"/>
            <igEditors:ComboBoxDataItem DisplayText="Add (0)" Value="0"/>
         </igEditors:ComboBoxItemsProvider.Items>
      </igEditors:ComboBoxItemsProvider>
   </igEditors:XamComboEditor.ItemsProvider>
</igEditors:XamComboEditor>

Parents
  • 54937
    Offline posted

    While in edit mode the xamComboEditor uses a ComboBox. The ComboBox's default template contains a TextBox. When you right click on a TextBox, it will show its edit context menu if its ContentMenu property is not set. I think the only way to prevent this would be to retemplate the ComboBox within the xamComboEditor (i.e. define a Style for ComboBox and set that as the ComboBoxStyle property of the xamComboEditor). In that Style define a setter that binds the ContextMenu property to that of the containing xamComboEditor and a setter for the combobox's Template property. Within that template, bind the ContextMenu of the TextBox to that of the templateparent. I noticed that the WPF ComboBox suffers from the same issue. I'm going to submit an issue for this as well so we can see about incorporating this into our default templates.

Reply Children
No Data