views:

101

answers:

2

How can I convert int to System.Windows.GridLength in VB, NET so that I can set the height of a grid row in Silverlight (xaml).

In xaml file:

<RowDefinition Height="0" x:Name="rowerror"  />

In VB.NET:

rowerror.Height = CType(30, System.Windows.GridLength)

This as I wrote in VB.NET. I know I'm wrong, but how do you do if the int to System.Windows.GridLength so that the height of the "rowerror" whether that be 30?

+1  A: 
rowerror.Height = new GridLength(30)
Joey
Thank you for your prompt response!
sv88erik
+1  A: 

The MSDN Documentation provides an example of this using a GridLengthConverter..

Dim myGridLengthConverter As System.Windows.GridLengthConverter = New System.Windows.GridLengthConverter()

...

rowerror.Height = CType(myGridLengthConverter.ConvertFromString("30"), GridLength)
Quintin Robinson
Thank you for your prompt response!
sv88erik