Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1235
ContextMenu DataContext (DataItem)
posted

Hello Infragistics-Team,

i want to build up a contextmenu for the xamdatatree (add new, delete, edit/rename) in WPF. If i work with the xaml XamDataTree.ContextMenu / ContextMenu and commands, the DataContext is my viewmodel (view), so i cant identify the dataitem that fired the contextmenu function. Its not the ActiveNode too, and even if, i wouldnt like it too much to bind it and look into it out of the executed command.

So i ended up define the command on the viewmodel (dataitem) itself, and build up the contextmenu on the view PreviewMouseRightButtonDown. I dont really like that and got a problem to enter edit mode because i would have to transport it all back to the view: viewmodel(dataitem)-list-viewmodel-view.

Even if i work with MenuItem-Click events i cant identify the source-dataitem.. (sender is menuitem with DataContext of my viewmodel again.. and some RoutedEventArgs..)


Btw is there really no built-in contextmenu for that? AllowEditing / IsMouseActionEditingEnabled fx..

If we can solve the first DataContext question, the other questions doesnt matter anymore.

Greetings
yannik

Parents Reply Children
No Data