Can I change Caption of DAML Defined Button?

310
3
Jump to solution
02-12-2020 07:52 AM
MKa
by
Occasional Contributor III

In my configuration project I have Set a limitied number of buttons for my users.  Now with 2.5 release I need to put the esri_editing_SaveEditsBtn in the tool bar too.  The only problem is that I want the caption to say "Save Edits" and not "Save".  I have the Save Project button their too, but want to the edits button to have the different caption.  Is there a way to simply do this or do i need to define a button with a new class and put Project.Current.SaveEditsAsync(); as the only function in that class?  Then make the new button ref in the daml with my updated caption?

//OLD, i want to changed the caption for this Button to say "Save Edits" to distinguish it from Save for Project

<button refID="esri_editing_SaveEditsBtn" size="large"  />

//I want to do something like this to override it?  Or do I have to do the code to accomplish this

<button id="esri_editing_SaveEditsBtn" caption="Save Edits" 
</button>

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor
 var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_SaveEditsBtn");
 plugin.Caption = "Save Edits";

View solution in original post

3 Replies
MKa
by
Occasional Contributor III

I went ahead and made my on button reference to code.  And here that is, but is this more simple than what I did here just to change the caption?

<button refID="MyButtons_SaveEditsAsync" size="large"  />

<button id="MyButtons_SaveEditsAsync" condition="esri_editing_CanSaveCondition" 
caption="SAVE EDITS CHANGE HERE" 
className="MyButtons.SaveEditsAsync" keytip="Z4" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/EditingSaveEdits_B_32.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/EditingSaveEdits_B_32.png">
          <tooltip heading="Save Edits">
            Save all edits made since the last save. After saving you cannot undo previous editing operations.<disabledText />
          </tooltip>
        </button>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Framework.Contracts;

namespace MyButtons
{
    internal class SaveEditsAsync : Button
    {
        protected async override void OnClick()
        {
            await Project.Current.SaveEditsAsync();
        }
    }
}

Here is where I found the conditional for the OOB Button

DAML ID Reference Editing.daml · Esri/arcgis-pro-sdk Wiki · GitHub 

Here is where I found the image for the OOB Button

DAML ID Reference Icons · Esri/arcgis-pro-sdk Wiki · GitHub 

0 Kudos
CharlesMacleod
Esri Regular Contributor
 var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_SaveEditsBtn");
 plugin.Caption = "Save Edits";
MKa
by
Occasional Contributor III

That is what I was looking for, thank you.  I ended up using my solution above, as i needed to fetch any server changes on the SaveEdits click.  So I added this to my button logic to get the latest server updates.  

await Project.Current.SaveEditsAsync();
await MapView.Active.RedrawAsync(true);

0 Kudos