Note that there are some explanatory texts on larger screens.

plurals
  1. POContextMenu StaysOpen is not working
    primarykey
    data
    text
    <p>I am showing a <code>UserControl</code> inside <code>ContextMenu</code>. Futhermore in that <code>UserControl</code> I am showing a <code>Popup</code> which contains some buttons and datagrid. All the data in <code>Popup</code> loads during runtime.</p> <p>The problem is <code>ContextMenu</code> ignores the property <code>StaysOpen</code> even though it is set to <code>true</code>.</p> <p>The <code>Popup</code> does stay open when I set <code>StaysOpen</code> to <code>true</code> in code behind but <code>ContextMenu</code> doesn't.</p> <p>I tried it with following code:</p> <pre><code>&lt;UserControl x:Class="UserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; &lt;Grid&gt; &lt;Popup Name="popupState" PlacementTarget="{Binding ElementName=txtSearch}" PopupAnimation="Slide" Placement="Bottom" Focusable="True" AllowsTransparency="True" VerticalAlignment="Top"&gt; &lt;Button HorizontalAlignment="Right" Margin="5" Background="GhostWhite" Name="btnSelectAll" Click="btnSelectAll_Click" Width="30" Height="30"&gt; &lt;my:DataGrid VerticalAlignment="Stretch" MaxHeight="300" VerticalScrollBarVisibility="Auto" RowHeaderWidth="0" Margin="5,5,5,1" Background="White" HorizontalAlignment="Stretch" Name="DGTeamCommunicator" HorizontalContentAlignment="Left" HorizontalGridLinesBrush="#D6D7D6" GridLinesVisibility="None"&gt; &lt;my:DataGridTemplateColumn Width="Auto" MinWidth="30"&gt; &lt;my:DataGridTemplateColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal" ContextMenuService.IsEnabled="True" ContextMenuService.HasDropShadow="True"&gt; &lt;Button Name="btnCall" Click="btnCall_Click" ContextMenuService.IsEnabled="True"&gt; &lt;/Button&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/my:DataGridTemplateColumn.CellTemplate&gt; &lt;/my:DataGridTemplateColumn&gt; &lt;/my:DataGrid&gt; &lt;/Popup&gt; </code></pre> <p> </p> <p>My requirement is to Prevent the <code>Popup</code> as well as <code>ContextMenu</code> from closing when the buttons in <code>Popup</code> is clicked.</p> <p>Kindly provide me a solution for this.</p>
    singulars
    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