Saturday 15 January 2011

WPF ContextMenu complex item stays open on click? -



WPF ContextMenu complex item stays open on click? -

so have complex context menu. doesn't have menuitems. has radio buttons well, , stackpanel on bottom has 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 alternative staysopenonclick; when clicks on item, context menu stays open. <radiobutton> objects don't have option, remain open anyways.

the issue having lastly item, <stackpanel>. when user clicks on text area of integerupdown, context menu closes. makes pretty impossible utilize item is. there improve way trying in context menu? there way maintain context menu open until user clicks outside of menu?

just stuff stackpanel in menuitem header , set staysopenonclick property true.

<menuitem staysopenonclick="true"> <menuitem.header> <stackpanel orientation="horizontal"> <textblock>every</textblock> <textbox text="30" width="50" margin="5,0" /> <textblock>min</textblock> </stackpanel> </menuitem.header> </menuitem>

wpf contextmenu

No comments:

Post a Comment