Vote count:
0
So I have a complex context menu. It doesn't have just menuitems. It has radio buttons as well, and a stackpanel on the bottom which has an integerupdown box.
<Button.ContextMenu>
<ContextMenu>
<RadioButton Tag="30" Content="30 seconds" GroupName="adLength" Checked="adLength_Checked" IsChecked="True"/>
<RadioButton Tag="60" Content="1 minutes" GroupName="adLength" Checked="adLength_Checked"/>
<RadioButton Tag="90" Content="1 min 30 sec" GroupName="adLength" Checked="adLength_Checked"/>
<RadioButton Tag="120" Content="2 minutes" GroupName="adLength" Checked="adLength_Checked"/>
<RadioButton Tag="150" Content="2 min 30 sec" GroupName="adLength" Checked="adLength_Checked"/>
<RadioButton Tag="180" Content="3 minutes" GroupName="adLength" Checked="adLength_Checked"/>
<Separator/>
<MenuItem x:Name="advert_Auto" Header="Run Automatically" IsCheckable="true" StaysOpenOnClick="True"/>
<StackPanel Orientation="Horizontal">
<TextBlock>every</TextBlock>
<xctk:IntegerUpDown x:Name="advert_Time" Value="30" Minimum="15" Width="50" Margin="5,0" />
<TextBlock>min</TextBlock>
</StackPanel>
</ContextMenu>
</Button.ContextMenu>
The <MenuItem> object has the option for staysopenonclick; when someone clicks on that item, the context menu stays open. The <RadioButton> objects don't have that option, but they stay open anyways.
The issue I am having is with the last item, the <StackPanel>. When the user clicks on the text area of the IntegerUpDown, the context menu closes. It makes it pretty impossible to use the item as is. Is there a better way to do what I am trying to do in a context menu? Is there a way to keep the context menu open until the user clicks outside of the menu?
asked 36 secs ago
WPF ContextMenu Complex Item staysopenonclick?
Aucun commentaire:
Enregistrer un commentaire