Click here to Skip to main content
12,075,066 members (66,309 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Silverlight
When I set the list to NEW, I get 'O' data. Currently getting no data.

Private Sub ContctDomainDataSource_LoadedData(ByVal sender As System.Object, ByVal e As System.Windows.Controls.LoadedDataEventArgs) Handles ContctDomainDataSource.LoadedData
        ActivityDisplay.IsActive = False
 
        Dim _lst As List(Of Contct)()
        ContctDataGrid.ItemsSource = _lst
        Dim iRowCount As Integer = _lst.Count()
 
        CountBox1.Text = _lst.Count
 
        If e.HasError Then
            System.Windows.MessageBox.Show(e.Error.ToString, "Load Error", System.Windows.MessageBoxButton.OK)
            e.MarkErrorAsHandled()
        End If
    End Sub
I found a post that shows that item count has been incorporated in the Domain Service. But I still haven't resolved displaying the count in a textbox.

Dim loadCustomer As EntityQuery(Of Customer_Profile2) = Domaincontext.GetCustomerProfileQuery() loadCustomer.IncludeTotalCount = True
Dim loadOp = Domaincontext.Load(Of Customer_Profile2)(loadCustomer).TotalEntityCount

http://blogs.msdn.com/b/deepm/archive/2010/03/18/count-t.aspx?CommentPosted=true#commentmessage
Posted 1-Nov-10 9:17am
Edited 8-Nov-10 2:20am
JF201554.3K
v4
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Looks like you are creating an empty list, then setting the items source on the grid to that empty list. Though, wouldn't you usually use the "new" keyword when creating an empty list? And why would you expect the count of an empty list to be anything but zero?
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Simply display the count of the datagrid's underlying collection - that should be what you are looking for.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

<pre lang="vb">If (DataGrid.ItemsSource IsNot Nothing) Then
            Dim count As Integer = DataGrid.ItemsSource.OfType(Of Object)().Count()
            lblCount_Gen.Content = "Count: " & count
        End If
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

I think you should cast the type of _lst.Count() to String.. Big Grin | :-D
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160208.1 | Last Updated 20 Feb 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100