Hi all, I'm working with ArcGIS Pro SDK Add-in. I want to change "Project" button caption, that open backstage, to something else in my language. I cannot find anything relate to that button in DAML ID Reference.
I also want to customize application's titlebar. How to do it?
Please help me. Thanks.
Solved! Go to Solution.
Hi @MinhHoangf
Indeed the "Project" button (as @UmaHarano mentioned) is not a standard Framework Plugin (button) like the other tabs on the ArcGIS Pro ribbon. But, since ArcGIS Pro is a WPF application, and you can 'spy' on the WPF visual tree (you can use Visual Studio to do so) to find which control implements the "Project" button. I found that the "Project" control's name is "appButton" and the type of the control is "ActiproSoftware.Windows.Controls.Bars.RibbonApplicationButton". Once ArcGIS Pro is open you can use the code below to update the "Project" button to "New Caption". Note: since we can't access any ActiProSoftware resources the code below is using reflection to make the .Content property update:
// change the caption of the 'Application' button in the main window: appButton
string newCaption = "New Caption";
var mainWindow = FrameworkApplication.Current.MainWindow;
if (mainWindow != null)
{
var appButton = mainWindow.FindName("appButton");
if (appButton != null && appButton is FrameworkElement frameworkElement)
{
System.Diagnostics.Trace.WriteLine($@"{appButton.GetType()}");
PropertyInfo propertyInfo = appButton.GetType().GetProperty("Content");
propertyInfo.SetValue(appButton, Convert.ChangeType(newCaption, propertyInfo.PropertyType), null);
}
}
In similar fashion you can update the Application's titlebar, but be aware that the titlebar is getting overwritten by project names.
(Edit: Comment removed. Correct answer provided by Wolf and Uma)
Hi @Min The "Project" button is a special button and cannot be customized.
To change the application title, please use a "Managed Configuration".
Hi @MinhHoangf
Indeed the "Project" button (as @UmaHarano mentioned) is not a standard Framework Plugin (button) like the other tabs on the ArcGIS Pro ribbon. But, since ArcGIS Pro is a WPF application, and you can 'spy' on the WPF visual tree (you can use Visual Studio to do so) to find which control implements the "Project" button. I found that the "Project" control's name is "appButton" and the type of the control is "ActiproSoftware.Windows.Controls.Bars.RibbonApplicationButton". Once ArcGIS Pro is open you can use the code below to update the "Project" button to "New Caption". Note: since we can't access any ActiProSoftware resources the code below is using reflection to make the .Content property update:
// change the caption of the 'Application' button in the main window: appButton
string newCaption = "New Caption";
var mainWindow = FrameworkApplication.Current.MainWindow;
if (mainWindow != null)
{
var appButton = mainWindow.FindName("appButton");
if (appButton != null && appButton is FrameworkElement frameworkElement)
{
System.Diagnostics.Trace.WriteLine($@"{appButton.GetType()}");
PropertyInfo propertyInfo = appButton.GetType().GetProperty("Content");
propertyInfo.SetValue(appButton, Convert.ChangeType(newCaption, propertyInfo.PropertyType), null);
}
}
In similar fashion you can update the Application's titlebar, but be aware that the titlebar is getting overwritten by project names.
@Wolf @UmaHarano Thanks for your help. This method is very flexible. 😀
ArcGIS Pro Configuration extensibility pattern can be used to modify the QAT. More info here:
Cofigurations: OnCreateQuickAccessToolbar