>>>Frank,
>>>
>>>>I stepped through the code and it is showing me that no deletion occurs because the code looks for a business object, but my form is bound to a table. (See my first message as to how the form's datacontext is set.)
>>>>
>>>>Any ideas on how to handle this scenario?
>>>
>>>Did you set the BindingSource property on the mmButtonDelete control on that window? If you are using class MM .NET entities, there needs to be an IgnoreNavigation = true inserted into the call path of the DeleteEntity to prevent the display of the Save Changes dialog (mmBusinessUIHelper.DeleteEntity) This only occurs with business objects that are using the datatable or dataviews.
>>>
>>>Best Regards,
>>
>>Kevin,
>>
>>no, I did not set the BindingSource property on the mmButtonDelete.
>>
>>Can you give me an example of how I do that, please?
>>
>>Once I set that binding source then things will delete properly, or do I need to add in more code to handle the delete myself?
>>
>>If so could you please provide an example?
>
>The information you need is in the WPF section of the MM .NET Dev Guide under the topic "Using Specialized Buttons". After following the instructions in this section to associated a business object with the button, then there is one other step you need to take. Override the DeleteEntity method in your WPF window and add code that does the following:
>
>1. Set the IgnoreNavigation property = true.
>2. Call the default DeleteEntity method
>3. Set the IgnoreNavigation property = false.
>
>Best Regards,
Thanks, that helps a little bit more, however I am still getting prompted if to save changes.
Here is what I did:
I bound the Delete button to "CourierAirWayBill" (interesting that I didn't have an ellipsis button to display the selection dialog as described in the help file).
I added this code in:
public override bool DeleteEntity(mmBusinessObject businessObject, mmBusinessEntity entity)
{
this.IgnoreNavigation = true;
bool result = base.DeleteEntity(businessObject, entity);
this.IgnoreNavigation = false;
return result;
}
If I run my screen, search for some records, select one and then click Delete, I get prompted if to delete, I say yes and the row disappears from my grid which displays the results of my initial search.
If then run a search again, or move onto a different row in the grid, I get prompted: "Do you want to save changes?"
Is there somewhere else that the IgnoreNavigation needs to be set too?