![]() ![]() _personlist.Add( New Person( "Elaine Jones", "Not Available", "Work Colleagues")) _personlist.Add( New Person( "Fran Pickman", "East Centre", "Family")) _personlist.Add( New Person( "Serge Baliansky", "North Office", "VB City")) _personlist.Add( New Person( "Joe Brown", "On Site", "Work Colleagues")) _personlist.Add( New Person( "Ged Mead", "Busy", "VB City")) Public ReadOnly Property PersonList() As IEnumerable( Of Person) The end result is the same - a List (Of Person) that can be used as the data source for the TreeView. This replaces the Shared method to generate some dummy data that I was using in previous versions. In tis version, I introduce a Persons class. Public Event Propert圜hanged( ByVal sender As Object, ByVal e As 圜hangedEventArgs) Implements 圜hanged.Propert圜hanged If Not Propert圜hangedEvent Is Nothing Then Public Sub OnPropert圜hanged( ByVal e As Propert圜hangedEventArgs) OnPropert圜hanged( New Propert圜hangedEventArgs( "Category")) OnPropert圜hanged( New Propert圜hangedEventArgs( "Status")) OnPropert圜hanged( New Propert圜hangedEventArgs( "FullName")) Sub New( ByVal personname As String, ByVal personstatus As String, ByVal personcategory As String) Each of these two line sets will be grouped according to their Category property value. The plan is to have FullName on one line of a TreeView node with Status immediately below it on a second line. Here is the finished result we are looking for:Īs with the earlier blogs, I'm using a Person class which has three properties - FullName, Status and Category. I've tweaked the original a little and converted the C# code to Visual Basic. I'm indebted to Bea Costa for laying the groundwork on this in a blog she wrote back in the days when WPF was still at the Orcas Beta stage. I will post up a second version later that does include this. In this blog I'm going to leave out the ValueConverter/Visibility feature, as it tends to get in the way of the core layout steps. Although it worked to an extent, I wasn't really happy with the final result and you know how that can niggle at you - especially if you have gone public with it! So I've done some more research and now have a version that looks right. The blog that dealt with TreeViewItem visibility is here and the one that expanded the idea to include grouping is here. Those blogs included other features, such as changing the visibility of individual nodes based on the data content of each field. In previous blogs I was looking at ways of grouping TreeViewItems. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |