int à System.Windows.GridLength - VB.NET
-
21-09-2019 - |
Question
Comment convertir int à System.Windows.GridLength dans VB, NET pour que je puisse régler la hauteur d'une ligne de grille dans Silverlight (xaml).
Dans le fichier XAML:
<RowDefinition Height="0" x:Name="rowerror" />
En VB.NET:
rowerror.Height = CType(30, System.Windows.GridLength)
Ce que je l'ai écrit en VB.NET. Je sais que je me trompe, mais comment faire si l'int System.Windows.GridLength de telle sorte que la hauteur du « RowError » que ce soit 30?
La solution
rowerror.Height = new GridLength(30)
Autres conseils
Le MSDN Documentation fournit un exemple de cela en utilisant un GridLengthConverter ..
Dim myGridLengthConverter As System.Windows.GridLengthConverter = New System.Windows.GridLengthConverter()
...
rowerror.Height = CType(myGridLengthConverter.ConvertFromString("30"), GridLength)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow