TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dominik
NA
103
0
Silverlight Treeview with pages
Mar 28 2012 9:06 AM
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
}
Reply
Answers (
0
)
Silverlight application life-cycle
Select multiple textboxes or multiple textblocks at a time for copying