Refresh a Legend Properly

Discussion created by msavage2 on Jun 11, 2011
Latest reply on Jun 13, 2011 by msavage2

This is related to an ArcMap add-in I coded up this past week.

I'm trying to rename a layer in ArcMap and have the legend refresh properly. The renaming part is working fine, however I cannot get the legend in the layout to update properly.

I call CurrentContents.Refresh() to refresh the name in the table of contents, which works.

If I search through the map surrounds and call .Refresh() on the legend, then do an ActiveView.PartialRefresh() on it, the legend gets all out of whack. This is why I am trying to simply trigger the same event as when the user manually changes the name of a layer.

The API documentation seems to say that MxDocument.UpdateContents() will trigger the events needed to refresh the legend. However, this does not seem to be the case.
In addition to the above methods I have tried ActiveView.ContentsChanged() to no avail.

Any suggestions are welcome.