Silverlight Treeview with pages
I made a treeview with pages. Hope it helps anybody...
XAML:
A treeview and a Datapager
<sdk:TreeView Name="treeView1" SelectedItemChanged="treeView1_SelectedItemChanged" ></sdk:TreeView>
<sdk:DataPager x:Name="dataPager1" Source="{Binding}" AutoEllipsis="True" NumericButtonCount="3" IsTotalItemCountFixed="True" PageIndexChanged="dataPager1_PageIndexChanged" />
C#:
//ini
private Int16 _ElementsPerPage { get; set; } //The items per page
private ObservableCollection<YourType> _Coll{ get; set; }
//onload
_ElementsPerPage = 250; //set the items you want per page
dataPager1.PageSize = _ElementsPerPage;
PagedCollectionView PC1 = new PagedCollectionView(_Coll);
dataPager1.Source = PC1;
//the event handler of the datapager
private void dataPager1_PageIndexChanged(object sender, EventArgs e)
{
ObservableCollection<YourType> tcol =
new ObservableCollection<YourType>(_Coll.Skip(_ElementsPerPage * dataPager1.PageIndex).Take(_ElementsPerPage));
treeView1.DataContext = tcol; //bind to treeview
}