I am working on Windows Phone 7.1 application.
I have a UserControl which has a bunch Silverlight child controls. The font sizes for most of these child controls can be same as that of the host of the said UserControl (which will anyway get inherited from the host).
However for one of the child controls, I want to set the FontSize to half the FontSize of the UserControl. And I want it to update if the FontSize of the host changes.
But now during the UserControl design time, since there is no host, I am unable make this work. Doing something like 0.5*FontSize results in some default value of FontSize and it does not get updated when the FontSize changes.
What should I be doing to make it work?
You can bind your FontSize property to the FontSize property of your UserControl and use a converter to do the ratio.
Here’s a sample with a textblock inside a page:
And the converter (declared as a resource in the App.xaml file: