Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6661461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:16:57+00:00 2026-05-26T02:16:57+00:00

I have a Silverlight DataGrid , a DataPager and a PagedCollectionView . After the

  • 0

I have a Silverlight DataGrid, a DataPager and a PagedCollectionView.
After the PagedCollection view is bound to the DataGrid, the first row of the DataGrid is selected.

This behaviour does not happen, if i am using an ObservableCollection. But due to the DataPager, I need to use the PagedCollectionView.

I am using Silverlight 5 RC, and the SL 4 Toolkit.

Example of Usage:

View:

<sdk:DataGrid x:Name="gridSomeItems" ItemsSource="{Binding SomeItems, Mode=TwoWay}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" CanUserSortColumns="True">
    <sdk:DataGrid.Columns>
        <sdk:DataGridTextColumn Header="Column1" Width="*" Binding="{Binding Column1}" />
    </sdk:DataGrid.Columns>
</sdk:DataGrid>
<sdk:DataPager Source="{Binding Path=ItemsSource, ElementName=gridSomeItems}"/>

ViewModel:

public class SomeViewModel : ViewModelBase
{
    public SomeViewModel(IDataAccess dataAccess)
    {
        _dataAccess = dataAccess;
        _dataAccess.GetSomeItemsCompleted += GetSomeItemsCompleted;
        _dataAccess.GetSomeItems();           
    }

    public PagedCollectionView SomeItems { get; set; }
    public SomeItem SelectedItem { get; set; }

    private void GetSomeItemsCompleted(GetSomeItemsCompletedEventArgs e)
    {
        SomeItems = new PagedCollectionView(e.Result.SomeItems);         
        RaisePropertyChanged("SomeItems");
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:16:58+00:00Added an answer on May 26, 2026 at 2:16 am

    The best workaround is to set a _isLoading flag. The following code would be the correct code for the ViewModel:

    public class SomeViewModel : ViewModelBase
    {
        private bool _isLoading;
    
        public SomeViewModel(IDataAccess dataAccess)
        {
            _dataAccess = dataAccess;
            _dataAccess.GetSomeItemsCompleted += GetSomeItemsCompleted;
            _isLoading = true;
            _dataAccess.GetSomeItems();           
        }
    
        public PagedCollectionView SomeItems { get; set; }
        public SomeItem SelectedItem { get; set; }
    
        private void GetSomeItemsCompleted(GetSomeItemsCompletedEventArgs e)
        {
            SomeItems = new PagedCollectionView(e.Result.SomeItems);         
            SomeItems.CurrentChanged += CurrentItemChanged;
            RaisePropertyChanged("SomeItems");
            SomeItems.MoveCurrentTo(null);
            _isLoading = false;     
        }
    
        private void CurrentItemChanged(object sender, System.EventArgs e)
        {
            if (!_isLoading)
            {
                SelectedItem = SomeItems.CurrentItem as SomeItem;
                // Do something more...
            }
        }   
    }
    

    Please have a look at the row SomeItems.MoveCurrentTo(null); – This command really sets the CurrentItem of the PagedCollectionView to null (not selected).

    It is still a workaround… Would be great if anybody came up with a better solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a silverlight datagrid which is bound to a PagedCollectionView displaying a collection
I have a Silverlight 4 application that uses a DataGrid. This DataGrid is bound
I have followed this tutorial which allowed me to create a Silverlight DataGrid that
Continuing my problem from yesterday, the Silverlight datagrid I have from this issue is
I have a Silverlight DataGrid and want to show the RowDetails of selected rows
I have a silverlight datagrid control bound to a Dictionary<string, string> with autogenerate columns
I have a silverlight datagrid with a single editable column. This column has a
I have 2 silverlight controls on a form; datagrid which is bound to list
I have a datagrid in Silverlight, with the following field bound to lastPrice :
I have bound a DataGrid in Silverlight via WCF RIA services and have custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.