wpf - How to bind my own Style dependency property (DP) to Button's style DP? -


i've found usercontrol implementation of virtual keyboard. there many buttons. want usercontrol expose dp "keysstyleproperty", how bind inner button's style?

if set 'layoutroot' datacontext of user control itself, can bind inner buttons style dependency property. more details, see article wrote:

http://www.scottlogic.com/blog/2012/02/06/a-simple-pattern-for-creating-re-useable-usercontrols-in-wpf-silverlight.html

for example, xaml:

<usercontrol x:class="usercontrol.virtualkeyboard"     ...>   <stackpanel orientation="horizontal"               x:name="layoutroot">     <button style="{binding keysstyleproperty}"/>   </stackpanel> </usercontrol> 

and bind layoutroot follows:

public virtualkeboard() {   initializecomponent();    //this.datacontext = this;   layoutroot.datacontext = this; } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -