Using listbox along with button for each row

4 posts, 0 answers
  1. Laurensius
    Laurensius avatar
    17 posts
    Member since:
    Jan 2014

    Posted 03 Feb 2014 Link to this post

    So, i want to add button for each my listbox item, what i want to is using that button for showing RadMessageBox with button for increasing and decreasing rating.
    how can i specify which one i selected?
    i'm using mvvm databinding to bind all my item in listbox
  2. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 05 Feb 2014 Link to this post

    Hello Laurensius,

    Thanks for writing.

    I am not quite sure that I correctly understand your question. Normally you have the ability to define any content for your items by setting the ItemTemplate property in XAML. If you put a button in your template, you can easily subscribe for the Tap event and handle it. The sender argument in the handler will provide you with the instance of the button that has been tapped. You can also bind the button's Tag property in your template to the data context so that you can reference the data item which has been tapped.

    I hope this helps.

    Regards,
    Deyan
    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.
  3. DevCraft banner
  4. Laurensius
    Laurensius avatar
    17 posts
    Member since:
    Jan 2014

    Posted 06 Feb 2014 Link to this post

    Thank you for your reply and it works if i put the same button (image) for each row, what if i want to specify like for the very first row it will be button for delete and for the other item row it will be button for rating....
  5. Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 10 Feb 2014 Link to this post

    Hi Laurensius,

    You can then use an ItemTemplateSelector and provide different templates for the corresponding data source items. The ItemTemplateSelector is a class that inherits from the DataTemplateSelector class and overrides the SelectTemplate method. You can define the needed DataTemplate properties on this class, initialize them in XAML, set the template selector to the ItemTemplateSelector property of the DataBoundListBox.

    I hope this helps.

    Regards,
    Deyan
    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