【问题标题】:Adjust Grid Size according to the content根据内容调整网格大小
【发布时间】:2014-12-10 15:48:44
【问题描述】:

如何定义网格大小,使其可以根据 wpf 中的 TextBlock 内容增加和减少?

【问题讨论】:

标签: c# wpf grid-layout


【解决方案1】:

嘿,下面的代码 sn-p 将 SizeToContent 设置为 WidthAndHeight。

    <Window x:Class="WindowSample.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF Window Sample"
    Width="300" Height="200" Left="500" Top="500"
    SizeToContent="WidthAndHeight" >

【讨论】:

    猜你喜欢
    • 2018-10-10
    • 2015-10-03
    • 2014-04-29
    • 2011-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-21
    相关资源
    最近更新 更多