Question Access of shared member, constant member...

gchq

Well-known member
Joined
Dec 14, 2007
Messages
168
Programming Experience
10+
Hi there

We will probably be moving from WinApps to WPF soon so I getting my head around a few elements. When using Grid.SetColumn and Grid.SetRow I get the following error - it works OK, but....

Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

This is the code

VB.NET:
 With WPGrid
            .Width = 500
            .HorizontalAlignment = Windows.HorizontalAlignment.Left
            .VerticalAlignment = Windows.VerticalAlignment.Top
            .ShowGridLines = True
        End With

        Dim Col1 As New ColumnDefinition
        With Col1
            .Width = New GridLength(120)
        End With
        Dim Col2 As New ColumnDefinition
        With Col2
            .Width = New GridLength(300)
        End With

        Dim Row1 As New RowDefinition
        With Row1
            .Height = New GridLength(35)
        End With
        Dim row2 As New RowDefinition
        With row2
            .Height = New GridLength(35)
        End With

        With WPGrid
            .ColumnDefinitions.Add(Col1)
            .ColumnDefinitions.Add(Col2)
            .RowDefinitions.Add(Row1)
            .RowDefinitions.Add(row2)
        End With



        Dim NameLB As New Label
        With NameLB
            .Content = "Page Name"
            .FontSize = 10
            .VerticalAlignment = Windows.VerticalAlignment.Center
            .HorizontalAlignment = Windows.HorizontalAlignment.Left
        End With
       

        WPGrid.SetColumn(NameLB, 0)
        WPGrid.SetRow(NameLB, 0)
        WPGrid.Children.Add(NameLB)

On another note I have noticed that DataGrid seems sooooooooo much slower than WinApps DataGridView - is this a known issue or is it me?

Thanks
 
Sussed it - replaced the Grid Name with Grid...

Still like to know if DataGrid is slower than DataGridView and if there is a way of resolving it though
 
Back
Top