诠释到System.Windows.GridLength - VB.NET
-
21-09-2019 - |
题
我怎样才能转换的int System.Windows.GridLength在VB,NET,这样我可以设置一个网格行的高度在Silverlight(XAML)。
<强>在XAML文件:强>
<RowDefinition Height="0" x:Name="rowerror" />
<强>在VB.NET:强>
rowerror.Height = CType(30, System.Windows.GridLength)
这正如我在VB.NET写。我知道我错了,但你怎么做,如果int值System.Windows.GridLength使“rowerror”的高度,不管是30?
解决方案
rowerror.Height = new GridLength(30)
其他提示
在 MSDN文档提供的示例此使用 GridLengthConverter ..
Dim myGridLengthConverter As System.Windows.GridLengthConverter = New System.Windows.GridLengthConverter()
...
rowerror.Height = CType(myGridLengthConverter.ConvertFromString("30"), GridLength)
不隶属于 StackOverflow