I have a WPF list view that is bound to a list of objects. One of the items to be displayed is a calculated property (read-only, returns a string) that takes a small amount of time to calculate. When the window initially loads (or anytime the UI is updated with a Notify event) the UI will hang as this data binding occurs. What I was wondering was a good mechanism to deal with this (ideally I'd like to do something along the lines of greying out the screen with a spinner and text "Processing ..." or similar).
I thought I could do that by capturing the start of the databound event and firing off a story (or similar) and the stopping the story when the end of the databound event was fired, but I cannot find events of that nature.
Is there a recommended mechanism for dealing with long data binding or do the events I'm looking for exist, but I'm looking in the wrong location? Any help would be appreciated.
EDIT: I am able to get a spinning icon (Cursor.Wait) while the data is sourced and data bound (using parts of the solution below), but now need to know when the data binding is complete. The .Loaded event seems to fire once the control is put on the screen (which happens right away), but does not happen when the data is updated. There doesn't appear to be a OnDataBoundCompleted type event for a ListView, any ideas/thoughts on how to be notified when the Data Binding process is completed?
EDIT: Looking at TargetUpdated event now, but getting some odd results. If I put a message box in the event handler for TargetUpdated, then the UI is updated (ListView displays data) and then the message box is shown. If I cut out the message box and just have a variable setting (i.e. IsBusyCursor = Cursors.Arrow) it does that before the ListView displays data.
** SOLUTION: ** I ended up creating a new presentation object and setting Cursor = Wait then looping through the objects I previously bound to the ListView and creating presentation objects out of them (which caused the calculated property to be executed) then once the list of presentation objects were created bound those to the ListView and stet Cursor = Arrow. Disappointed there doesn't appear to be a DataBinding Completed type event (or whatever event is fired once the data binding is complete that updates the UI is available), but this solution appears to work.