Hi there
I’m using WPF Infragistic 2011 V2 XamDatagrid. The application is based on MVVM. I need to prevent some records from being deleted based on a Boolean property (IsReadOnly) in my model.
I have tried to bind AllowDelete property either to a bool in my model or a to property in a VM:
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False" AllowDelete="{Binding ....." />
</igDP:XamDataGrid.FieldLayoutSettings>
But in both cases I'm getting runtime error "Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path= "
How can I stop a user from deleting data rows selectively without using code behind?
RegardsBoris
Hello Boris,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I handled the RecordsDeleting event, but I used Interactions, so there is no code behind. In the handler you can decide whether to cancel the event or not. Please let me know if this helps you or you need further questions on this matter.
Looking forward for your reply.
Thank you Stefan.
The sample you have sent works. The only problem is that until now my VM has been free from any dependencies on any UI frameworks. Ideally I'd like to keep that way. I understand that Interactions are not the same as code behind but frankly speaking the border line is very thin. Does it mean that Is it not possible to achieve the same functionality using binding to VM properties/commands?
Regards
Boris