Need Help with Dynamic Code

2 posts, 0 answers
  1. Warren
    Warren avatar
    9 posts
    Member since:
    Mar 2011

    Posted 21 Apr 2011 Link to this post

    Let me start by saying that I code in VB and not C#. I am still learning C# and actually write some classes in C# but the majority of my code is in VB, so any examples would be better supplied in VB. I am also new to developing with Silverlight and WP7.  With that being said here is my dilemma:


    I am trying to use the jump list 100% within code. This is because I am dynamically creating PivotItems depending on different criteria and these new PivotItems have the RadJumpList on them. I am able to create the list and display a basic list (no group descriptors) with no problem.


    My issue is with using descriptors (Group or Sort).
    I have information I want to display for like this example:

    (Servers are unique but services could be the same across servers - hence the need for grouping)

    Server 1

    Service 1

    Service 2

    Server 2

    Service 3

    Service 4

    Server 3

    Service 5

    Service 6


    The list of servers & services are brought in by a WCF object List(Of T) :

    'irreverent fields removed for simplicity
    Dim svcList As List(Of aService) =  e.Result
    End Function
    Public Structure aService
        Public Server As String
        Public Service As String
    End Structure

    The WCF source content can be visualized like this:
    Dim svcList As New List(Of aService)
    svcList.Add(New aService With {.Service = "service 1", .Server = "Server 1"})
    svcList.Add(New aService With {.Service = "service 2", .Server = "Server 1"})
    svcList.Add(New aService With {.Service = "service 3", .Server = "Server 2"})
    svcList.Add(New aService With {.Service = "service 4", .Server = "Server 2"})
    svcList.Add(New aService With {.Service = "service 5", .Server = "Server 3"})
    svcList.Add(New aService With {.Service = "service 6", .Server = "Server 3"})

    I can create the basic ItemsSource like this (in my testing ):
    Dim radJumpList As New RadJumpList
    Dim sList As New List(Of String)
    For Each svc As aService In svcList
    radJumpList.ItemsSource = sList
    Side question: Is there a better way to process the list directly with .ItemsSource instead of iteration with For Each Next?

    This is the extent of how far I have been trying to get things working. I cannot figure out how to use the GenericGroupDescriptor or GenericSortDescriptor to properly group Servers/Services & sort properly. (Actually have not even got to sort yet as I can't group properly yet). I would like to sort the entier list by Server then Services for each server.

    I think I need to do something like this but it errors and I cannot figure out the proper way.

    Dim groupByServer As New GenericGroupDescriptor(Of aService, String)(Function(s) s.Server)

    I'm looks for help on how to get past this road block.  Thanks.
  2. Deyan
    Deyan avatar
    2026 posts

    Posted 28 Apr 2011 Link to this post

    Hello Warren,

    Thanks for contacting us and sorry for the delay with our answer.

    We have a couple of examples containing code snippets that demonstrate how grouping with RadJumpList is accomplished.

    Please review our Online Help for RadJumpList:

    RadJumpList Overview

    You can expand the Features section where there are articles explaining how GroupDescriptors are used.

    As for the question concerning the processing of the servers' list I am not quite sure that I correctly understand it. You can process a list as an IEnumerable or by indexing it if the interface supports it.

    I hope this helps.

    Do not hesitate to get back to us in case you have further questions or need assistance.

    Kind regards,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
Back to Top