![](/img/trans.png)
[英]How to get List-views to automatically adjust height when the window is re-sized in WPF
[英]Automatically adjust the height of WebControl
我有一个设置了一些属性的Web控件,下面是代码。
在.CS文件中:
webBrowser1.NavigateToString("<html><head></head><body bgcolor=#d5e1f3><p style=font-family:arial><font size=3><center>" + content + "</center></font></p></body></html>");
在XAML中:
<Grid MinHeight="80"
Grid.Row="3"
Background="Red"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
<phone:WebBrowser Name="webBrowser1"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
MinHeight="80"
Foreground="Black" Width="Auto" Height="Auto"></phone:WebBrowser>
</Grid>
如果文本是一行,那么它不会垂直居中。如何解决此问题?
自动调整大小不适用于WebBrowser
控件。
但是您可以通过在内部添加脚本来创建变通方法,该脚本会将外部文档高度发送到C#应用程序。 然后,您可以使用该值手动更改控件的高度。 尽管我不确定这两个大小是否完全相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.