How to programatically update the dynamic layer name in TOC

573
3
Jump to solution
03-04-2014 12:24 PM
RickeyTom
New Contributor II
This is probably been asked before, but using the search criteria of TOC update label (and others), did not
reveal the answer for me.

When creating a dynamic layer, and adding it to the map, the initial name is "Dynamic Layer".

After initialization or loading of data, I get the real name so I rename that layer programmatically.

However, the name is not updated in the TOC. It is not a repainting issue since I can force a repaint and the new
name does not appear.

When I look at the layer properties, the Layer Name is correct, but not the label on the TOC. When apply is clicked,
the TOC label is updated correctly.

[ATTACH=CONFIG]31937[/ATTACH]

How can I programmatically update the layer name in the TOC
0 Kudos
1 Solution

Accepted Solutions
NeilClemmons
Regular Contributor III
Are you calling IMxDocument.UpdateContents after changing the layer name?

View solution in original post

0 Kudos
3 Replies
NeilClemmons
Regular Contributor III
Are you calling IMxDocument.UpdateContents after changing the layer name?
0 Kudos
RickeyTom
New Contributor II
That worked.

Thanks a lot.
0 Kudos
LeoDonahue
Occasional Contributor III
Please mark Mr. Clemmons' response as the answer.
0 Kudos