0

I am going add to add a button to show Add layer dialogue to ArcGIS pro Add-in. All works fine but my problem is although I have set the initial location of open dialog but dialog open in last open folder.

namespace
{
    internal class AddData : Button
    {
        public string InitialLocation { get; set; }
        protected override void OnClick()
        {

            pathMaker databasepath = new pathMaker();


            OpenItemDialog addToMapDialog = new OpenItemDialog()
            {
                Title = "Add To Map",
                InitialLocation = **@"C:\Data"**,
                Filter = ItemFilters.composite_addToMap

            };
            addToMapDialog.MultiSelect = true;
            addToMapDialog.InitialLocation = @"C:\Data";


            bool? ok = addToMapDialog.ShowDialog();

            if (ok == true)
            {
                IEnumerable<Item> selectedItems = addToMapDialog.Items;
                foreach (Item selectedItem in selectedItems)
                    MapFactory.Instance.CreateMapFromItem(selectedItem);
            }

        }

    }
}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.