开发者

Scale text in a grid/viewbox upon pinching

开发者 https://www.devze.com 2023-01-05 14:50 出处:网络
For a day now I\'m struggling to solving this issue, regarding scaling a textblock and a textbox upon pinching the scatterViewItem for resizing it.

For a day now I'm struggling to solving this issue, regarding scaling a textblock and a textbox upon pinching the scatterViewItem for resizing it. I've tried putting each of the elements in their viewbox, but also having the whole grid in a viewbox. The issue is that it(the textbloxk, that is) doesn't scale upon pinching or stretching rather, (dynamic开发者_如何学JAVAally so to speak) - at runtime, or not even upon contact_up.


What actually solves it is simply setting an event handler that fires upon size_changed of the SVI, inside simply paste the code:

{label name}.FontSize *= (double)e.NewSize.Height / (double)e.PreviousSize.Height;

Thanks!


I am assuming you mean that the TextBlock in the window does not scale when resizing the window...? Have you tried putting a ViewBox in a Grid that contains the item you want to resize? If you have the item in a ViewBox, and set the Height and Width of the ViewBox to Auto, is should resize with the window...I hope this helps a little.

0

精彩评论

暂无评论...
验证码 换一张
取 消