Note that there are some explanatory texts on larger screens.

plurals
  1. POWpfToolkit AutoCompleteBox ContextMenu not working
    primarykey
    data
    text
    <p>In one of my WPF project, I have integrated WPF Toolkit's <code>AutoCompleteBox</code> control. I need a custom <code>Context Menu</code> for this control and I have added one using the <code>ContextMenu</code> property. Unfortunately its not showing the custom created one but showing the default one (i.e. Cut, Copy, Paste with Cut &amp; Copy as disabled). </p> <p>To recreate the issue, I have created a sample project and the window contains 2 controls inside a <code>Grid</code>.</p> <pre><code>&lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition&gt;&lt;/RowDefinition&gt; &lt;RowDefinition&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;toolkit:AutoCompleteBox&gt; &lt;toolkit:AutoCompleteBox.ContextMenu&gt; &lt;ContextMenu&gt; &lt;MenuItem Header="Menu Item 1"&gt;&lt;/MenuItem&gt; &lt;MenuItem Header="Menu Item 2"&gt;&lt;/MenuItem&gt; &lt;/ContextMenu&gt; &lt;/toolkit:AutoCompleteBox.ContextMenu&gt; &lt;/toolkit:AutoCompleteBox&gt; &lt;TextBox Grid.Row="1" &gt; &lt;TextBox.ContextMenu&gt; &lt;ContextMenu&gt; &lt;MenuItem Header="Menu Item 1"&gt;&lt;/MenuItem&gt; &lt;MenuItem Header="Menu Item 2"&gt;&lt;/MenuItem&gt; &lt;/ContextMenu&gt; &lt;/TextBox.ContextMenu&gt; &lt;/TextBox&gt; &lt;/Grid&gt; </code></pre> <p>The two controls have the same <code>ContextMenu</code> and if I run the solution, I can see that the custom created <code>ContextMenu</code> is working for <code>TextBox</code> and not for <code>AutoCompleteBox</code>. </p> <p>Also, I set the same Context Menu to Grid (parent control) and set <code>ContextMenu="{x:Null}"</code> to TextBox &amp; <code>AutoCompleteBox</code>. Now the <code>ContextMenu</code> is inherited for <code>TextBox</code> but not for <code>AutoCompleteBox</code>. </p> <p>So my question is, how can I create a custom <code>ContextMenu</code> for AutoCompleteBox? If it is not by design(<code>AutoCompleteBox</code>), how can I add a <code>ContextMenu</code> to a custom AutoCompleteBox control which is inherited from <code>AutoCompleteBox</code>. Please advice.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload