wpf - Binding to ViewModel with ControlTemplate -
i'm using dockpanel
.
<dockpanel> <frame x:name="_mainframe"> <frame.template> <controltemplate targettype="{x:type frame}"> <dockpanel margin="7"> <stackpanel margin="7" orientation="horizontal" dockpanel.dock="top"> <button margin="5" content="avast! go back!" command="{x:static navigationcommands.browseback}" isenabled="false" /> <button margin="5" content="{binding buttonforwardtext}" command="{x:static navigationcommands.browseforward}" isenabled="false" width="52" /> </stackpanel> <border borderbrush="black" borderthickness="2" padding="7" cornerradius="4"> <stackpanel horizontalalignment="stretch" width="90" orientation="vertical" margin="0,0,10,0" dockpanel.dock="left"> <button horizontalalignment="stretch" content="new page!" command="{binding fwdtext, mode=oneway}" /> </stackpanel> </border> <border borderbrush="black" borderthickness="2" padding="7" cornerradius="4"> <contentpresenter /> </border> </dockpanel> </controltemplate> </frame.template> </frame> </dockpanel>
i have data context hooked up, when try bind text of button property in viewmodel (for testing purposes) whatever reason, not work. if bind viewmodel outside of dockpanel
, works fine.
anyone know proper way bind viewmodel inside controltemplate? i've tried templatebinding, still doesn't it.
Comments
Post a Comment