.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
sivanagamahesh

Home >> Articles >> Silverlight >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Covert List to PagedCollectionView

Posted By:Subhransu Sekhar Jena       Posted Date: June 25, 2015    Points: 25    Category: Silverlight    URL: http://www.dotnetspark.com  

Covert List to PagedCollectionView in Silverlight.
 



../Img/2012/subhu_635708169194881912_filter_data_icon.jpg


In Silverlight or WPF we use Paged Collection view to filter data.

Paged Collection View is used to filter data on already filtered data.

If you want to convert List to PagedCollectionView Then follow the below code :


In VB:

Dim listFlower = New List(Of Flower)() From { _
 New Flower() With { _
  Key .Type = "Rose", _
  Key .Colour = "Red" _
 }, _
 New Flower() With { _
  Key .Type = "Lotus", _
  Key .Colour = "White" _
 }, _
 New Flower() With { _
  Key .Type = "Hibiscus", _
  Key .Colour = "Dark Red" _
 } _
}

Dim pageCollection = New PagedCollectionView(listFlower)
FlowerDataGrid.ItemsSource = pageCollection

In C#:

Dim listFlower = New List(Of Flower)() From { _
 New Flower() With { _
  Key .Type = "Rose", _
  Key .Colour = "Red" _
 }, _
 New Flower() With { _
  Key .Type = "Lotus", _
  Key .Colour = "White" _
 }, _
 New Flower() With { _
  Key .Type = "Hibiscus", _
  Key .Colour = "Dark Red" _
 } _
}

Dim pageCollection = New PagedCollectionView(listFlower)
FlowerDataGrid.ItemsSource = pageCollection


Silverlight Datagrid Multiple Filter using PagedCollectionView

If you want to filter the data multiple times inside datagrid then create two paged collection view.
eg
In C#-----PagedCollectionView pcvMain=new PagedCollectionView
                PagedCollectionView pcvTemp=new PagedCollectionView

Then Load the data using Load Operation.
Then assign the data to pcvMain
After this Set the BindinngControl(datagrid,Listbox).ItemSource=pcvMain
And Filter the data using pcvTemp.


For complete code send me an email


Happy Programming

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend