ListBox with Header and data

9 posts, 0 answers
  1. Tomasz
    Tomasz avatar
    20 posts
    Member since:
    Apr 2012

    Posted 13 Aug 2013 Link to this post

    Hi,

    I would like to put in my app a DataBoundListBox which would have a header and subitems. The data which it should be powerby by in my db looks like this:
    To (nvarchar), From (nvarchar), Date (datetime)
    I want to have a query which takes the data from the table and select top 3 people from the "From" column and sorts it by month. So in result the ListBox sould look something like this:

    July
    Person2
    Person1
    Person3

    August
    Person1
    Person3
    Person2

    and so on.

    Any suggestion on how aproach this?
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 14 Aug 2013 Link to this post

    Hello Tomasz,

    Thanks for writing.

    I think the best control for your scenario is RadJumpList:

    http://www.telerik.com/products/windows-phone/overview/all-controls/jumplist.aspx

    It supports grouping, i.e. displaying items in groups with specific group headers and sub items.

    I hope this helps.

    Regards,
    Deyan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Tomasz
    Tomasz avatar
    20 posts
    Member since:
    Apr 2012

    Posted 19 Aug 2013 Link to this post

    Hi,

    great, thanks!
    On more additional question about styling the header? I have a DateTime property but on my UI i just want to show the year and month so the headers would be like:
    2013-07
    2013-08

    I've tried doing styling like this:
    <telerikData:RadJumpList.GroupHeaderTemplate>
        <DataTemplate>
            <Border
                Background="#CC000000">
                <TextBlock
                    FontSize="36"
                    Text="{Binding StringFormat='yyyy-MM'}"/>
            </Border>
        </DataTemplate>
    </telerikData:RadJumpList.GroupHeaderTemplate>

    but it doesn't really work :/

    any suggestions?
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 20 Aug 2013 Link to this post

    Hi Tomasz,

    Thanks for writing.

    Could you please share some further information on what exactly happens when you implement that template?

    Regards,
    Deyan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Tomasz
    Tomasz avatar
    20 posts
    Member since:
    Apr 2012

    Posted 20 Aug 2013 Link to this post

    Still the header displays such text:
    2013-08-20 02:00:00
    where it should just show:
    2013-08
  7. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 20 Aug 2013 Link to this post

    Hi Tomasz,

    Thanks for writing back.

    I think the way you are using the StringFormat property is not entirely correct. Take a look at this article on MSDN:

    http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.stringformat.aspx

    Does it work as expected when you apply a format like {0:yyyy-MM}?

    Regards,
    Deyan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Tomasz
    Tomasz avatar
    20 posts
    Member since:
    Apr 2012

    Posted 20 Aug 2013 Link to this post

    Doesn't work at all...
  9. Tomasz
    Tomasz avatar
    20 posts
    Member since:
    Apr 2012

    Posted 20 Aug 2013 Link to this post

    Ok, after some testing I just wrote a standard converter in C# that does the job
  10. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 20 Aug 2013 Link to this post

    Hi Tomasz,

    Yes, using a Converter is what I was going to suggest you if the StringFormat approach didn't work.

    Regards,
    Deyan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner