EditBox text update on Project change

196
1
04-22-2021 11:21 AM
GeneLohrmeyer
New Contributor II

Hello,

I have an EditBox that displays the current project path when a project is first opened.  The issue is when I open another project, the text in the EditBox does not change to reflect the new path.

internal class ProjectPathEditBox : ArcGIS.Desktop.Framework.Contracts.EditBox
{
  public ProjectPathEditBox()
  {

  string stringURI = Project.Current.URI;
  Text = stringURI;
  }
}

 

How do I get the Text value to update when another project is opened?  Is using an EditBox the best way to do this?

 

Thanks.

Tags (2)
0 Kudos
1 Reply
PrashantKirpan
Occasional Contributor

Hi,

Register project open event in module and then update text box. Not tested but should work.

  private Module1()
        {
            ProjectOpenedEvent.Subscribe(OnProjectOpen);
        }

  private void OnProjectOpen(ProjectEventArgs args)
        {
        //Get current project path and update text box   
        //args.Project.HomeFolderPath  
        }
        

-Prashant

0 Kudos