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
665
Binding AllowDelete property
posted

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?

Regards
Boris

 

 

 

Parents
  • 138253
    Offline posted

    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.

    XamDataGridInteraction.zip
Reply Children