Change font size in text box automatically

I have Textboxes in Gridwith numbers in it. If I resized the window, I also want to resize FontSize.

This code works with actual height Textbox:

<TextBox FontSize="{Binding Path=ActualHeight, RelativeSource={RelativeSource Self},
         Converter={StaticResource HeightToFontSizeConverter}}" Text="12345"/>

But now it is FontSizechanging in only one direction.

Is it possible to connect the two paths? Or another option?

Thanks.

+3
source share
2 answers

If you want a scalable TextBox or any other control to wrap it in a ViewBox. It defines a content decorator that can stretch and scale one child to fill the available space.

how

<Viewbox>
  <Button>Button</Button>
</Viewbox>

NTN

+2

, FontSize TextBox. , ! ActualHeight - .

public double ActualHeight { get; }

.

?

0

Source: https://habr.com/ru/post/1717930/


All Articles