.net - WPF: Remove highlight effect from ListViewItem -
i'm developing wpf application has log. log designed listview. listviewitems not changes appearance when mouse on or item selected. have solved style listview:
<style x:key="itemcontainerstyle1" targettype="listviewitem"> <setter property="horizontalcontentalignment" value="left"/> <style.triggers> <trigger property="ismouseover" value="true"> <setter property="background" value="transparent" /> <setter property="borderthickness" value="0" /> <setter property="focusable" value="false" /> </trigger> </style.triggers> </style>
this style fixed problems raised new issue. when background set "transparent" able see hover/glossy effect shown @ picture below, when mouse on list view item.
i have tried solve problem attempt, no luck.
<style targettype="{x:type listviewitem}"> <style.resources> <solidcolorbrush x:key="{x:static systemcolors.highlightbrushkey}" color="#00000000"/> <solidcolorbrush x:key="{x:static systemcolors.controlbrushkey}" color="#00000000"/> </style.resources> </style>
anyone have idea how remove annoying hover effect?
thanks in advance
i don't know if solution did follows (by setting template
property of listviewitem
s):
<listview.itemcontainerstyle> <style targettype="{x:type listviewitem}"> <setter property="background" value="transparent" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type listviewitem}"> <border borderbrush="transparent" borderthickness="0" background="{templatebinding background}"> <gridviewrowpresenter horizontalalignment="stretch" verticalalignment="{templatebinding verticalcontentalignment}" width="auto" margin="0" content="{templatebinding content}"/> </border> </controltemplate> </setter.value> </setter> </style> </listview.itemcontainerstyle>
edit:
or grant winney suggests (i did not test myself):
<listview.itemcontainerstyle> <style targettype="{x:type listviewitem}"> <setter property="background" value="transparent" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type listviewitem}"> <contentpresenter /> </controltemplate> </setter.value> </setter> </style> </listview.itemcontainerstyle>
Comments
Post a Comment