Inserting new message at the beginning

4 posts, 0 answers
  1. esskar
    esskar avatar
    5 posts
    Member since:
    Mar 2013

    Posted 20 Nov 2013 Link to this post

    Hello,

    I am using the ConversationView to display messages from a long conversation.
    To increase preformance, I load only the first 20 messages into the view, and I add a button to the internal RadJumpList.ListHeaderTemplate to load earlier messages per user request.

    When I add those earlier messages (20 previous messages) I add them to the ItemSource by doing an ItemSource.Insert(0, newMessage).
    The problem is now, that the last inserted message is now visible on top, so inserting earlier messages at the beginning, pushes existing messages down, but the behaviour i want is that it should push newly inserted messages up (out of the visible area).

    I attached a image trying to show what i want to achieve. Notice, that the part above the red line is not visible to the user, but he can keep scrolling, if more messages are inserted.
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 22 Nov 2013 Link to this post

    Hi Sascha,

    Thank you for writing.

    From the screenshot it seems like before the button is pressed it consumes some space on the screen and after its pressed it goes away and this place is used to display earlier messages. This sounds like the expected behavior since the button is inside the header (which always stays before all messages).

    One option to provide a different behavior is to add a button to the page (but not as part of the Conversation View) so it is always visible and it always consumes the same amount of space on the screen. The other option to add more items is to use the PullToRefresh functionality by setting IsPullToRefreshEnabled to true. More information about PullToRefresh is available here.

    I hope this information helps.

    Regards,
    Todor
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. esskar
    esskar avatar
    5 posts
    Member since:
    Mar 2013

    Posted 20 Feb 2014 Link to this post

    I finally figured it out.

    I changed the ControlTemplate for the "telerikDataControls:RadConversationView" control

    <ControlTemplate x:Key="CustomRadConversationViewControlTemplate"<br>                         TargetType="telerikDataControls:RadConversationView">

    and set the VirtualizationStrategyDefinition for the "PART_ListBox" element to

    <telerikDataControls:RadJumpList.VirtualizationStrategyDefinition><br>    <telerik:StackVirtualizationStrategyDefinition ReorderMode="MoveItemsUp" /><br></telerikDataControls:RadJumpList.VirtualizationStrategyDefinition>

  5. Todor
    Admin
    Todor avatar
    778 posts

    Posted 25 Feb 2014 Link to this post

    Hi Sascha,

    Thank you for sharing your solution. We will consider this thread closed.

    Don't hesitate to get back to us if you have other questions.

    Regards,
    Todor
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
Back to Top
DevCraft banner