![](/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.