Domanda

Come posso convertire int a System.Windows.GridLength in VB, .NET in modo da poter impostare l'altezza di una riga della griglia in Silverlight (XAML).

In file XAML:

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

In VB.NET:

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

Questa, come ho scritto in VB.NET. So che ho sbagliato, ma come fare se l'int a System.Windows.GridLength modo che l'altezza del "RowError" sia che si tratti di 30?

È stato utile?

Soluzione

rowerror.Height = new GridLength(30)

Altri suggerimenti

Il MSDN documentazione fornisce un esempio di questo utilizzando un GridLengthConverter ..

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

...

rowerror.Height = CType(myGridLengthConverter.ConvertFromString("30"), GridLength)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top