Hello, I am a teacher and I am creating my first Xamarin app. I am using Prism for my MVVM framework and one of your grids. I have a screen listing all the sections I teach (bound to an observable collection in my view model). When the I select a section and click on a button I want to navigate to a page with a list of students in that section.
The trouble is that I don’t know what row was selected when I am in my view model. I don’t want to go into the code behind as shown in the documentation. I thought there would be a property in the grid (selected items?) that I could bind to my view model so that when I click the button I would know what section had been selected.
What would be the best way to achieve this with the Infragistics grid?
I would sugtest taking a different, more simplified approach. You should utilize the EventToCommand behavior that is built into Prism.
The docs for the feature can be found here: http://prismlibrary.github.io/docs/xamarin-forms/EventToCommandBehavior.html
You can see a sample here: https://github.com/PrismLibrary/Prism-Samples-Forms/tree/master/ContosoCookbook
The line of code you would be interested in is here: https://github.com/PrismLibrary/Prism-Samples-Forms/blob/master/ContosoCookbook/ContosoCookbook/ContosoCookbook/Views/MainPage.xaml#L25
Good luck
Thanks, I tried that but I still get the same error. I will submit a support ticket.
Hello Jim,
Looking at the code that you have provided, everything looks ok with the exception of the way that you are currently applying your behavior. Rather than applying it in the way that you currently are, I would recommend usage of the following code:
<igDataGrid:XamDataGrid> <igDataGrid:XamDataGrid.Behaviors> <local:MyBehavior/> </igDataGrid:XamDataGrid.Behaviors> </igDataGrid:XamDataGrid>
This should allow you to apply your behavior correctly.
Please let me know if you have any other questions or concerns on this matter.
Dumb mistake. Did NOT have the namespace in xmlns declaration.
Thanks for your help. My plan now is to use the attached behavior to publish an event with the value of the selected session. The view model will receive the event and store the latest selected session. My xaml do not what to see me attached behavior.