我怎样才能转换的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)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top