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
After some research AllowDelete Property for each Record has been determine as a new Product Idea. I have sent your Product Idea directly to our product management team. Our product team chooses new Product Ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested ideas, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time. Your reference number for this Product Idea is PI12060055
If you would like to follow up on your Product Idea at a later point, you may contact Developer Support management via email. Please include the reference number of your Product Idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Until the product idea gets implemented you can use the apprrach I suggested you in my previous post.