Set the data context inside of a collectionview to the viewmodel / datacontext #22851
Replies: 1 comment
-
Well looking for an answer to this problem for hours and then finally... got it. Here is the solution in case someone has the same problem as i had:
so relativesource sets the source to the contentpage itself. greetings. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
I'm struggling to execute a command from a button inside of a collectionview.
I am using the devexpress components.
I bound data of my viewmodel to the collelctionview like this:
<dxcv:DXCollectionView ItemsSource="{Binding FairVisitData.FairVisitPhotos}">
The fairvisitdata class contains the property FairVisitPhotos which is of type List<KeyValuePair<string, Stream>>
I would like to access a command to remove one of the items in the list.
To achieve this, i need to bind the command from my viewmodel to the command property of a button inside of the collectionview.
<dxco:SimpleButton Command="{Binding RemovePhotoFairVisitPhotosCommand}" CommandParameter="{Binding Key}"/>
But the xaml binding failures are telling me, that the data context is set to the keyvaluepair:
How do i manually set the path of the binding to my current datacontext viewmodel?
Thanks for help
Beta Was this translation helpful? Give feedback.
All reactions