|
Imports System.Windows
Imports System.Windows.Controls
Imports System.Runtime.CompilerServices
Public Module StaticMethods
Public Function EqualsOperatorNothingSafe(left As Object, right As Object) As Boolean
If IsNothing(left) And IsNothing(right) Then Return True
If IsNothing(left) Xor IsNothing(right) Then Return False
Return left = right
End Function
<Extension()>
Friend Sub CopyFrom(toCollection As RowDefinitionCollection, fromCollection As GridLength())
toCollection.Clear()
For Each dfn As GridLength In fromCollection
Dim actualDfn As RowDefinition = New RowDefinition()
actualDfn.Height = dfn
toCollection.Add(actualDfn)
Next
End Sub
<Extension()>
Friend Sub CopyFrom(toCollection As ColumnDefinitionCollection, fromCollection As GridLength())
toCollection.Clear()
For Each dfn As GridLength In fromCollection
Dim actualDfn As ColumnDefinition = New ColumnDefinition()
actualDfn.Width = dfn
toCollection.Add(actualDfn)
Next
End Sub
Public Function GetGridLengths(rows As RowDefinitionCollection) As GridLength()
Dim result As List(Of GridLength)
result = New List(Of GridLength)
For Each row As RowDefinition In rows
result.Add(row.Height)
Next
Return result.ToArray()
End Function
Public Function GetGridLengths(rows As ColumnDefinitionCollection) As GridLength()
Dim result As List(Of GridLength)
result = New List(Of GridLength)
For Each row As ColumnDefinition In rows
result.Add(row.Width)
Next
Return result.ToArray()
End Function
End Module
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.