Friday 15 May 2015

wpf - Windows Phone 8.1, How to bind style to view? -



wpf - Windows Phone 8.1, How to bind style to view? -

i wrote style button. unfortunately, encountered problem: font size of button depends on value, can compute only in view (specifically, that's displayinformation stuff).

ideally, following:

<style x:key="mystyle" basedon="{staticresource somestyle}" targettype="button"> <setter property="fontsize" value="{binding elementname=rootcontrol, path=someproperty" /> </style>

then, provide necessary properties in view class. doesn't work (does nothing, no messages, no errors).

how can solve problem?

assigning binding setter value not supported in windows runtime. (it might supported in wpf , silverlight 5, however).

if google around, there workarounds, they're kind of hacky. see this, uses attached properties , binding helper class.

wpf binding resources styles windows-phone-8.1

No comments:

Post a Comment