I have a wpf application that populates an Infragistics XamDataGrid by the usual method of binding an observable collection to the grid. As each data item is populated into the collection, one at a time, the grid updates. I also have a cancel button that I would like to immediately stop the population if the user clicks it. However, it takes a few seconds or more to respond to the cancel.
The problem (I think) is that the message loop is full of the grid population events and my cancel is way in the back and must wait its turn. I was wondering if there is a way to insert a message in the front of the queue and thus make the cancel more responsive (hacky or not - if hacky, please explain what ill effects I can expect).
I am not experiencing bad performance; in fact the UI is quite responsive. The problem is purely that the cancel event has to wait its turn in the message queue and I would rather it have priority over the population messages.
edit: clarifications