Imports System.Windows.Controls
Imports System.Windows
Imports System.Windows.Data

Namespace Extensions

    Public Class GridViewColumnBuilder

        Private Shared column As GridViewColumn

        Public Shared Function CreatePageRankColumn() As GridViewColumn
            Dim prColumn As New GridViewColumn
            prColumn.Width = 60
            prColumn.Header = "PR"
            Dim dt As New DataTemplate()
            Dim value As New FrameworkElementFactory(GetType(TextBlock))

            value.SetBinding(TextBlock.TextProperty, New Binding("PageRank"))
            value.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Center)
            dt.VisualTree = value

            prColumn.CellTemplate = dt

            Return prColumn
        End Function

    End Class
End Namespace