C# 自动设置文本块的宽度
如何将动态创建的文本块的高度和宽度设置为自动C# 自动设置文本块的宽度,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,如何将动态创建的文本块的高度和宽度设置为自动 TextBlock myTextBlock = new TextBlock() { Text = "Text Block", Width = 140, Height = 40, FontSize = 20 }; 将宽度(或高度)设置为Double.NaN相当于在XAML中将宽度设置为auto TextBlock myTextBlock = new TextBlock() { Text = "Text Block", Width = Double.N
TextBlock myTextBlock = new TextBlock() { Text = "Text Block", Width = 140, Height = 40, FontSize = 20 };
将宽度(或高度)设置为Double.NaN
相当于在XAML中将宽度设置为auto
TextBlock myTextBlock = new TextBlock() { Text = "Text Block", Width = Double.NaN, Height = Double.NaN, FontSize = 20 };
也看到