Resync designer view with model/view state RRS feed

  • Question

  • Hi,

    In most cases, changes made to the model or view state pretty much immediately reflect in the designer UI, assuming there is a corresponding UI representation for the model item or view state.  What I'm doing is using the view state to establish links (in a Flowchart designer) between activity designers.  Normally this works fine.  But occasionally, an exception is thrown saying that a connection cannot be made between two points.


    In the event of this exception, I can wrap the statement that throws the exception (in my case, EditingScope.Complete) and retry the logic, this time not specifying the connection points and letting the designer's routing algorithm comes up with its own path.


    The problem I'm experience is when I wrap the call (EditingScope.Complete) in a try/catch block that throws the exception and re-do the connection logic, this time not specifying the view state (but still specifying the Next property of a FlowStep, or True/False property of a FlowDecision, etc using the ModelItem.SetValue method), visually a connection is not made between the activities.  But if I manually close the designer and reload it or use the bread crumb navigation to move away from the current designer and then return, the connections visually appear.

    I want to be able to programmatically refresh the UI based on the updated model / view state.  I tried a number of things:


    • Calling UpdateLayout on the current root designer.  Not surprisingly, this didn't help :)
    • Calling WorkflowDesigner.Load() after flushing the content.  This failed, as I would need to create a whole new instance of the workflow designer which I don't really want to do
    • Called DesignerView.MakeRootDesigner, specifying a different model item.  This worked, but then I need to return to current root designer and remember the scroll positioning, etc, of the current root designer, before navigating to a new one.  Also, there might not be another designer that I can logically make the root designer, even temporarily, so this approach may not always work.
    • Tried moving both the source and target designers that are connected by the invisible connection, but the connection is still not rendered
    • Tried to re-do the connection logic via a low priority (application idle) dispatcher call, but this didn't update the UI either

    I realize the root of my problem is not that the designer doesn't refresh, but that some connections I try to establish are considered illegal.  In the case where a connection cannot be made based on the points collection I provide, the flowchart designer tries to re-route and fails, throwing the exception. In this case, I let MS take over.  I can't predict when it will fail (it's pretty rare) but when it does I try to handle it in the try/catch fashion.

    Any suggestions?


    • Edited by Notre Saturday, September 11, 2010 12:13 AM Unsuccessfully tried a few more things
    Friday, September 10, 2010 11:11 PM


  • Good news on this one; I discovered the problem with the connection I was trying to make that was throwing an exception. 

    My problem was that I was trying to set the Next property on one model item but I was setting the wrong ConnectorLocator view state information for that model item (the connection path information I specified should've been for another model item).

    I still don't know how to get the UI to update should such an exception be thrown, but now the exception is no longer thrown.


    • Marked as answer by Notre Tuesday, September 14, 2010 10:29 PM
    Tuesday, September 14, 2010 10:27 PM