WPF more then one DataTrigger -
would know why xaml below not working. looks can not have more 1 datatrigger element. storyboards within datatrigger, can tell being executed on button click. end reason on button click, 1 grid should slide up, , other slide down, achieving sort of accordian animation.
<stackpanel grid.row="7" grid.column="0" grid.columnspan="2" margin="0,10,0,0"> <!--add new banner grid--> <!--<grid dockpanel.dock="top" background="#ffe0ffd2" height="50">--> <grid x:name="grdaddbunner"> <grid.style> <style targettype="grid"> <setter property="height" value="50"></setter> <setter property="background" value="#ffe0ffd2"></setter> <style.triggers> <datatrigger binding="{binding elementname=btneditbunner, path=ispressed}" value="true"> <datatrigger.enteractions> <beginstoryboard> <storyboard> <doubleanimation storyboard.targetproperty="height" from="150" to="0" duration="0:0:0.5"></doubleanimation> </storyboard> </beginstoryboard> </datatrigger.enteractions> </datatrigger> <datatrigger binding="{binding elementname=btnaddbunner, path=ispressed}" value="true"> <datatrigger.enteractions> <beginstoryboard> <storyboard> <doubleanimation storyboard.targetproperty="height" from="0" to="150" duration="0:0:0.5"></doubleanimation> </storyboard> </beginstoryboard> </datatrigger.enteractions> </datatrigger> </style.triggers> </style> </grid.style> <grid> <grid.rowdefinitions> <rowdefinition height="30"></rowdefinition> <rowdefinition height="30"></rowdefinition> <rowdefinition height="30"></rowdefinition> <rowdefinition height="30"></rowdefinition> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> </grid.columndefinitions> <label grid.row="0" grid.column="0" grid.columnspan="3" content="add new banner" horizontalalignment="center" foreground="darkgreen" fontweight="bold"></label> <label grid.row="1" grid.column="0" horizontalalignment="right" content="fund"></label> <telerik:radcombobox grid.row="1" grid.column="1" telerik:stylemanager.theme="windows8" margin="3" itemssource="{binding lstfund}"></telerik:radcombobox> <label grid.row="2" grid.column="0" horizontalalignment="right" content="banner"></label> <textbox grid.row="2" grid.column="1" grid.columnspan="2" telerik:stylemanager.theme="windows8" margin="3" text="{binding addbannername}"></textbox> <button grid.row="3" grid.column="1" content="save" command="{binding addbannercmd}" height="25" width="80" horizontalalignment="left"></button> <button grid.row="3" grid.column="2" content="calcel" height="25" width="80" horizontalalignment="right"></button> </grid> </grid> <!--edit existing banner grid--> <!--<grid dockpanel.dock="top" background="#fffff7d2" height="50">--> <grid x:name="grdeditbanner"> <grid.style> <style targettype="grid"> <setter property="height" value="50"></setter> <setter property="background" value="#fffff7d2"></setter> <style.triggers> <datatrigger binding="{binding elementname=btnaddbunner, path=ispressed}" value="true"> <datatrigger.enteractions> <beginstoryboard> <storyboard> <doubleanimation storyboard.targetproperty="height" from="150" to="0" duration="0:0:0.5"></doubleanimation> </storyboard> </beginstoryboard> </datatrigger.enteractions> </datatrigger> <datatrigger binding="{binding elementname=btneditbunner, path=ispressed}" value="true"> <datatrigger.enteractions> <beginstoryboard> <storyboard> <doubleanimation storyboard.targetproperty="height" from="0" to="150" duration="0:0:0.5"></doubleanimation> </storyboard> </beginstoryboard> </datatrigger.enteractions> </datatrigger> </style.triggers> </style> </grid.style> <grid> <grid.rowdefinitions> <rowdefinition height="30"></rowdefinition> <rowdefinition height="30"></rowdefinition> <rowdefinition height="30"></rowdefinition> <rowdefinition height="30"></rowdefinition> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition></columndefinition> <columndefinition></columndefinition> <columndefinition></columndefinition> </grid.columndefinitions> <label grid.row="0" grid.column="0" grid.columnspan="3" content="edit existing banner" horizontalalignment="center" foreground="#ff5b6400" fontweight="bold"></label> <label grid.row="1" grid.column="0" horizontalalignment="right" content="fund"></label> <telerik:radcombobox grid.row="1" grid.column="1" telerik:stylemanager.theme="windows8" margin="3" itemssource="{binding lstfund}" selecteditem="{binding selectedbannerfund}"></telerik:radcombobox> <label grid.row="2" grid.column="0" horizontalalignment="right" content="banner"></label> <textbox grid.row="2" grid.column="1" grid.columnspan="2" telerik:stylemanager.theme="windows8" margin="3" text="{binding selectedbannername}"></textbox> <button grid.row="3" grid.column="1" content="save" command="{binding updatebannercmd}" height="25" width="80" horizontalalignment="left"></button> <button grid.row="3" grid.column="2" content="calcel" height="25" width="80" horizontalalignment="right"></button> </grid> </grid> </stackpanel>
the "ispressed" lets know when button "active" changes again when release button.
have tried moving command binding on button , set properties on viewmodel grids can use set styles on themselves?
Comments
Post a Comment