c# - Selected item is null when listview looses focus -
i'm having problem listview in wpf. have:
<listview style="{dynamicresource virtualisedmetrolistview}" selecteditem="{binding selectedcode}" ....... > <i:interaction.triggers> <i:eventtrigger eventname="selectionchanged"> <toolkit:eventtocommand command="{binding selectionchangedcommand}" passeventargstocommand="true"></toolkit:eventtocommand> </i:eventtrigger> </i:interaction.triggers> <listview.resources> <solidcolorbrush x:key="{x:static systemcolors.highlightbrushkey}" color="transparent" /> <solidcolorbrush x:key="{x:static systemcolors.highlighttextbrushkey}" color="black" /> </listview.resources> <listview.cachemode> <bitmapcache/> </listview.cachemode> <listview.itemcontainerstyle> <style targettype="{x:type listviewitem}"> <style.triggers> <trigger property="iskeyboardfocuswithin" value="true"> <setter property="isselected" value="true"></setter> </trigger> </style.triggers> </style> </listview.itemcontainerstyle> </listview>
i have ribbon few buttons such as:
<fluent:ribbontabitem header="try me" visibility="visible" name="cxttab" > <fluent:ribbongroupbox header="general"> <button contenttemplate="{staticresource addnewtemplate}"/> </fluent:ribbongroupbox> </fluent:ribbontabitem>
now, i'm using mvvm light, , have listview selecteditem binded, when click on button in ribbon selecteditem null , cannot delete item.
any idea how can mantain selecteditem when click in other elements (in case ribbon)?
thanks in advance.
delete this
<trigger property="iskeyboardfocuswithin" value="true"> <setter property="isselected" value="true"></setter> </trigger>
Comments
Post a Comment