xaml - Windows Phone Context Menu -
i want add together context menu listbox. when hold listbox item, nil happens. thanks..
this code definition of listbox. added context menu listbox.
<listbox grid.row="1" name="chlist" itemssource="{binding ch.texts}" selectionchanged="textchanged" style="{staticresource listoftext}"> <listbox.itemtemplate> <datatemplate> <toolkit:contextmenuservice.contextmenu> <toolkit:contextmenu name="contextmenu"> <toolkit:menuitem name="edit" header="edit" click="edit_click"/> <toolkit:menuitem name="delete" header="delete" click="delete_click"/> </toolkit:contextmenu> </toolkit:contextmenuservice.contextmenu> </datatemplate> </listbox.itemtemplate> </listbox>
in styles.xaml
<style x:key="listoftext" targettype="listboxitem"> <setter property="template"> <setter.value> <controltemplate targettype="listboxitem"> <border x:name="rootelement" padding="{staticresource phoneborderthickness}"> <grid> <grid.columndefinitions> <columndefinition width="10" /> <columndefinition width="*" /> </grid.columndefinitions> <border grid.column="0" background="{staticresource phoneaccentbrush}" opacity="{binding isread,converter={staticresource opacityconverter}}" /> <grid minheight="60" grid.column="1"> <grid.rowdefinitions> <rowdefinition height="auto" /> <rowdefinition height="auto" /> </grid.rowdefinitions> <textblock grid.row="0" text="{binding title}" textwrapping="wrap" style="{staticresource phonetexttitle3style}" /> <grid grid.row="1"> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition width="*" /> </grid.columndefinitions> <textblock grid.column="0" text="{binding pbdate, converter={staticresource dateconverter}}" verticalalignment="center" textwrapping="wrap" style="{staticresource phonetextsmallstyle}" /> <image grid.column="1" height="{staticresource phonefontsizenormal}" horizontalalignment="left" visibility="{binding isstared,converter={staticresource visibilityconverter}}" source="/toolkit.content/favs.png" /> </grid> </grid> </grid> </border> </controltemplate> </setter.value> </setter> </style>
styles.xaml in mysolution... can't solve problem..
thanks...
you setting item datatemplate
contextmenuservice.contextmenu
, there no actual content. need have content displayed there. also, have items in list?
move contextmenuservice.contextmenu
in 1 main template - splitting (for unknown reason). remove datatemplate
declaration in listbox
command , utilize pre-defined style.
windows-phone-7 xaml contextmenu
No comments:
Post a Comment