WPF UIElements中的动态TextSize

Jam*_*mes 4 c# wpf font-size uielement

正如所建议的那样,我允许所有WPF UIElement都具有动态大小,因此可以轻松调整大小,但是,TextBlock我必须指定大小Font.这意味着当元素的大小增加或减少时,字体大小保持不变.有没有办法让Font尺寸变得动态?

Sim*_*mon 14

尝试将控件内的文本放入Viewbox:

<Button>
    <Viewbox>
        <TextBlock>Text To Resize</TextBlock>
    </Viewbox>
</Button>
Run Code Online (Sandbox Code Playgroud)