Binding in ItemHeaderTemplates

4 posts, 0 answers
  1. Adam12
    Adam12 avatar
    7 posts
    Member since:
    Jun 2012

    Posted 20 Jul 2011 Link to this post

    It appears as though the ItemHeader items don't get their DataContext properties set.  Consequently it doesn't appear to be possible to bind to the ViewModel from within an ItemHeaderTemplate.

    Is this right? Is there any way to work around it?

    Thanks
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 21 Jul 2011 Link to this post

    Hello Adam,

    I am not quite sure that I correctly understand the case. Are you setting the ListHeaderTemplate and ListHeader properties and not getting the desired behavior? In fact, we do not have a ItemHeaderTemplate property in RadDataBoundListBox.

    Looking forward to receiving further details on your scenario.

    Kind regards,
    Deyan
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. DevCraft banner
  4. Adam12
    Adam12 avatar
    7 posts
    Member since:
    Jun 2012

    Posted 21 Jul 2011 Link to this post

    Sorry I meant ListHeaderTemplate.  Also I didn't realize you had to set ItemHeaderContent explicitly.  I assumed that it would just pick up the DataContext from the listbox.

    Binding the ItemHeaderContent works a treat, thanks.
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 22 Jul 2011 Link to this post

    Hi Adam12,

    Thanks for writing back.

    Indeed, you will have to set the DataContext or the ItemHeaderContent explicitly since visual containers are reused in RadDataBoundListBox and thus their DataContext is reset according to the business object behing the corresponding visual container. This is part of our UI virtualization mechanism.

    I am happy that you have managed to resolve the case. We will consider the thread closed.

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

    Greetings,
    Deyan
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top