Reputation: 929
I am developing a windows runtime app for windows phone, i need to scale the text based on the screen dimension.
for handle the image scaling i have used the 3 folder(scale-100, scale-140 and scale-240)
In the app I have different style for different kind of text(title, subtitle...)
is there any way to apply different style based on the screen size?
Upvotes: 3
Views: 106
Reputation: 10015
Following solution is for Windows (Phone) RT, not for WP Silverlight.
The resource system of Windows RT is much more powerful than a lot of people know. You're not only able to use scaling for images, the same works for resource (.resw) files, even a combination of language/scaling is possible. Simply use the correct naming conventions: e.g. Resources.scale-140.resw
.
And then you're able to put about every single attached/dependency property in your resource file, leveraging the resource system based on x:Uid
.
<Grid x:Uid="MainGrid">
<TextBlock x:Uid="MyTextBlock" />
</Grid>
You can run a few of the different emulator sizes to test if everything works as desired.
Upvotes: 3