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:
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
Post a Comment