wpf - MutliSelect ListBox in Menu -
i creating undo button should work identical visual studios undo button. want user able mouse on item , every item above selected. on click items above passed in , actions performed. if user clicks button itself, undo top object. problem: not using context menu , no idea i'm doing wpf. right user can mouse on object mouse above selected (all code behind vb.net). appreciated!
code:
<menuitem header="undo" name="menuundo" isenabled="true"> <menuitem.icon> <image source="undo.png" width="24" height="24" /> </menuitem.icon> <stackpanel> <listbox name="listboxundo" horizontalalignment="stretch " verticalalignment="stretch" width="177" height="100 " margin="-33,-5,-65,-5" scrollviewer.verticalscrollbarvisibility="visible" isenabled="true" selectionmode ="multiple"> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <style.triggers> <trigger property="ismouseover" value="true"> <setter property="isselected" value="true"/> </trigger> </style.triggers> </style> </listbox.itemcontainerstyle> </listbox> </stackpanel> </menuitem>
well got work using scroll wheel works kind of better anyways! here code added:
private sub listboxundo_previewmousewheel(sender object, e mousewheeleventargs) handles listboxundo.previewmousewheel listboxundo.focus() try if e.delta < 1 'highlight next item listboxundo.selecteditems.add(listboxundo.items(listboxundo.selecteditems.count)) else 'remove last selected item listboxundo.selecteditems.remove(listboxundo.items(listboxundo.selecteditems.count - 1)) end if catch ex exception end try end sub
Comments
Post a Comment