i'm trying figure out kind of control favorites bar in ie/firefox, etc. can visually store bookmarks on, move around, delete easily.
i've tried doing toolbar, , while can add buttons , make them work want, deleting , rearranging them problematic. tried listviews, getting them display correctly proving difficult. maybe large icon view, without icons.
i'm looking people can bookmark navigation pages go 1 looking @ before.
edit:
guess don't care rearranging much. i'm trying figure out how
- add them progmatically
- make them clickable, click event
- delete them when don't want them more
i've tried test:
<listview grid.row="1" name="listview1"> <wrappanel> <wrappanel.contextmenu> <contextmenu> <menuitem name="mnudelete" header="delete" /> </contextmenu> </wrappanel.contextmenu> <button name="addsite">+</button> <listviewitem content="test 1" /> <listviewitem content="test 2" /> </wrappanel> </listview>
but can't select either of listviewitems, let alone click on them. if right click on one, doesn't tell me 1 i've clicked on in context menu event handler.
it's frustrating because in winforms have had done already. can't wait until i've picked enough wpf starts clicking. feel i'm moving vb6 vb.net on again, more so.
so think got working way want, minus reordering.
can live now.
xaml:
<window x:class="mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="tracks" height="350" width="525"> <grid> <grid.rowdefinitions> <rowdefinition height="20" /> <rowdefinition height="26" /> <rowdefinition height="265*" /> </grid.rowdefinitions> <menu name="menu1" /> <frame grid.row="2" name="frame1" source="pagesearchresults.xaml" /> <stackpanel orientation="horizontal" grid.row="1"> <button name="addsite">+</button> <listview name="listview1" mousedoubleclick="listviewitem_mousedoubleclick"> <listview.itemspanel> <itemspaneltemplate> <stackpanel orientation="horizontal" /> </itemspaneltemplate> </listview.itemspanel> <listview.contextmenu> <contextmenu> <menuitem name="mnudelete" header="delete" /> </contextmenu> </listview.contextmenu> </listview> </stackpanel> </grid> </window>
vb:
class mainwindow dim bookmarks new arraylist private sub mnudelete_click(byval sender object, byval e routedeventargs) handles mnudelete.click if not listview1.selectedvalue nothing bookmarks.removeat(listview1.selectedvalue) end if listview1.items.removeat(listview1.selectedindex) end sub private sub addsite_click(byval sender system.object, byval e system.windows.routedeventargs) handles addsite.click dim integer = 0 dim itmx integer dim itm new listviewitem = bookmarks.add(frame1.content) itmx = listview1.items.add(new dictionaryentry(i, frame1.content.title)) listview1.displaymemberpath = "value" listview1.selectedvaluepath = "key" end sub private sub listviewitem_mousedoubleclick(byval sender system.object, byval e system.windows.input.mousebuttoneventargs) if not listview1.selectedvalue nothing frame1.content = bookmarks(listview1.selectedvalue) end if end sub end class
and gives adding , deleting bookmarks in wpf window frame , listview bookmark bar. i'm open suggestions improve or better ways it.
Comments
Post a Comment