Hello,
I have specific VM, that I must set as page datacontext in OnNavigatedTo event. In xaml I have hubsection with listview. In listview I have command for ItemTap. I want define command that binds to page datacontext, but I don't known how. All my attempts ended with now response on list item tap. Can you help me please?
Best Regards
Miroslav Mareš
5 Answers, 1 is accepted
You can take advantage of RadListView.Commands collection and define a ListViewUserCommand with ItemTap id and bind its Command property to an ICommand from your model.
I hope this helps.
Regards,
Ivaylo Gergov
Telerik
![](/forums/images/avatarimages/default.gif)
Hello,
you don't understand me. I have in xaml this:
<telerikDataControls:RadListView.Commands>
<telerikListViewCommands:ListViewUserCommand Id="ItemTap" Command="{Binding Expenses.EditVehicleExpenseCommand}" EnableDefaultCommand="False"/>
</telerikDataControls:RadListView.Commands>
But in this way command does not have DataContext from ListView. I cannot define context as static source, while I assign viewmodel in event OnNavigatedTo, it's dynamic and not static. So I don't known, how should I defined it.
Best Regards
Miroslav Mareš
Thank you for clarifying the scenario. I have prepared sample project utilizing custom commands demonstrating how this can be achieved.
Let us know if this helps.
Regards,
Tsvyatko
Telerik
![](/forums/images/avatarimages/default.gif)
Hello,
thank you for example. This solution occurred to me too, but... seems to me too complicated :-/
Best Regards
Miroslav Mareš
![](/forums/images/avatarimages/default.gif)
Hello,
your solution is more universal, than I thought before. It's good for me, thank you.
Best Regards
Miroslav Mareš