xaml - How to stop style overwriting in wpf? -


i create wpf usercontorl , create style listview in usercontorl theme.

my listview style :

<style targettype="listview" x:key="reminderlistview">     <setter property="background" value="transparent"/>     <setter property="borderthickness" value="0"/>     <setter property="itemtemplate">         <setter.value>             <datatemplate>                 <checkbox style="{staticresource remindercheckbox}" ischecked="{binding isselected, mode=twoway}" content="{binding title, mode=onetime}"/>             </datatemplate>         </setter.value>     </setter> </style> 

my listview style work correctly in usercontorl.

my used xaml in usercontrol:

<listview name="snoozelistview" grid.column="1" style="{staticresource reminderlistview}"  itemssource="{binding reminderitems}" > 

i use usercontrol in other wpf project have listviewitem style.

listviewitem style :

<style targettype="{x:type listviewitem}">     <setter property="foreground" value="{staticresource foregroundbrush}"/>     <setter property="background" value="transparent" />     <setter property="padding" value="2,0,2,0"/>     <setter property="template">         <setter.value>             <controltemplate targettype="{x:type listviewitem}">                 <stackpanel snapstodevicepixels="true" margin="2,0,2,0">                     <grid x:name="grid" background="transparent">                         <rectangle x:name="selectedrect" ishittestvisible="false" fill="{staticresource selectedbackgroundbrush}" opacity="0"/>                         <gridviewrowpresenter height="auto" margin="2"/>                     </grid>                 </stackpanel>             </controltemplate>         </setter.value>     </setter> </style> 

now listviewitem style overwriting listview itemtemplate style defined in user control theme.

how can stop overwriting.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -