This is a migrated thread and some comments may be shown as answers.

Using listbox along with button for each row

3 Answers 39 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Laurensius
Top achievements
Rank 1
Laurensius asked on 03 Feb 2014, 12:33 PM
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

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 05 Feb 2014, 07:51 AM
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.
0
Laurensius
Top achievements
Rank 1
answered on 07 Feb 2014, 01:29 AM
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....
0
Deyan
Telerik team
answered on 10 Feb 2014, 12:32 PM
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.
Tags
DataBoundListBox
Asked by
Laurensius
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Laurensius
Top achievements
Rank 1
Share this question
or