Hi, how can i set up a context menu for a row of DataGridControl, for i want to pop up a detail window to edit the selected item, and pop up a confirm for delete the item, and so on.
that's how the system works, but it seems the delete method of the viewmodel not trigged.
thanks !
<xcdg:DataGridControl Grid.Row="1"
AllowDrag="False"
AutoCreateColumns="False"
ItemsSource="{Binding Items}"
MaxGroupLevels="0"
ReadOnly="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedItem="{Binding Current}"
SelectionMode="Single">
<xcdg:DataGridControl.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding DeleteCommand}"
CommandParameter="{Binding Current}"
Header="删除所选" />
</ContextMenu>
</xcdg:DataGridControl.ContextMenu>
<!-- Columns, View here-->
</xcdg:DataGridControl>
as i set command binding to navigate the code logic to a Method like this: Delete(XXViewModel item), but it seems doesn't work. {
//in constructor:
this.DeleteCommand = new DelegateCommand(Delete, CanDelete)
}
public override void Delete(PatientViewModel item)
{
(this.Controller as IPatientsController).Delete(item);
}
protected override bool CanDelete(PatientViewModel item)
{
return item != null;
}
and the controler.Delete() just pops up a window for confirm, then another Provider execute the delete action from db when a user clicked "yes" button, then event is send back, the collection delete the item in it's RAM, if returned value carried by the event is something like "OK".that's how the system works, but it seems the delete method of the viewmodel not trigged.
thanks !