c# - Creating an Animation when DataGridCell's Bound Value is Updated -


all have following datagrid

<datagrid x:name="resourcedatagrid"            horizontalalignment="stretch"            verticalalignment="stretch"            autogeneratecolumns="false"            gridlinesvisibility="none"           rowheaderwidth="0"            canuseraddrows="true"            canuserdeleterows="true"            itemssource="{binding path=resources,                                  mode=twoway,                                 updatesourcetrigger=propertychanged,                                  isasync=true}">     <datagrid.columns>        <datagridtextcolumn header="keyindex" binding="{binding keyindex}" isreadonly="true"/>        <datagridtextcolumn header="filename" binding="{binding filename}" isreadonly="true"/>        <datagridtextcolumn header="resourcename" binding="{binding resourcename}" isreadonly="false"/>        <controls:collectiontextcolumn collection="resourcestringlist" visibility="collapsed"/>     </datagrid.columns> </datagrid> 

when row in data set removed want re-number keyindex column. when renumbering takes place want elegantly flash updated cells letting user know these values updated.

i still relatively new wpf , mvvm , unsure how 'listen' change in value. first thought don't need new dependencyproperty job, , merely hooking sourceupdated property using datatrigger not clear how this. have attempted define following

<style x:key="readonlycellupdatedstyle"         targettype="{x:type datagridcell}"         basedon="{staticresource {x:type datagridcell}}">     <style.triggers>         <datatrigger binding="contentupdated" value="true">             <datatrigger.enteractions>                 <beginstoryboard>                     <storyboard>                         <doubleanimation storyboard.targetproperty="opacity"                                          to="1"                                           duration="0:0:1" />                     </storyboard>                 </beginstoryboard>             </datatrigger.enteractions>             <datatrigger.exitactions>                 <beginstoryboard>                     <storyboard>                         <doubleanimation storyboard.targetproperty="opacity"                                          to="0.25"                                           duration="0:0:1" />                     </storyboard>                 </beginstoryboard>             </datatrigger.exitactions>         </datatrigger>     </style.triggers> </style> 

but binding contentupdated property each item in viewmodel far ideal. what correct way want?

thanks time.

sourceupdated how i've done in past, need make sure you've set notifyonsourceupdated true on binding. like:

<datagridtemplatecolumn>     <datagridtemplatecolumn.template>         <datatemplate>             <textblock text="{binding keyindex, notifyonsourceupdated=true, mode=oneway}">                 <textblock.style>                     <style targettype="textblock">                         <style.triggers>                             <eventtrigger routedevent="binding.sourceupdated">                                 ...                             </eventtrigger>                         </style.triggers>                     </style>                 </textblock.style>             </textblock>         </datatemplate>     </datagridtemplatecolumn.template> </datagridtemplatecolumn> 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -