|
POST
|
Mody, buttons cannot be hidden on the ribbon - only disabled. However, it is possible to delete buttons from the daml via a Configuration at start up. There is a callback u can override in the ConfigurationManager class called "OnUpdateDatabase". In many of the samples (and in many demos we have done) we show deleting many of the Pro tabs - u wld apply the same logic to delete buttons. For example: https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Configuration/ConfigWithMap/ConfigurationManagerWIthMap.cs#L98-L132 Here are the key lines: //here is where the tab elements are selected
var tabElements = from seg in database.Root.Descendants(nsp + "tab") select seg;
//In your case u wld be selecting buttons - eg
var buttonElements = from seg in database.Root.Descendants(nsp + "button") select seg; Then, in a loop, the sample examines each tab element (probably around 100 or so). It skips any of its own tabs (tab ids beginning with "ConfigWithMap" or "Acme" and any on the backstage). It adds all of the other tab elements into a collection where they will be deleted. if (... tabElement.Parent.Name.LocalName.StartsWith("backstage"))
continue;//keep backstage tabs
//delete all tabs other than "our" own
if (!id.Value.StartsWith("Acme") && !id.Value.StartsWith("ConfigWithMap"))
elements.Add(tabElement);//any tab added here will be deleted
//u wld do similar logic to delete buttons
if (id.Value == "some_button_daml_id_which_I_want_to_delete_off_the_ribbon")
elements.Add(btnElement); The tabs are deleted in a separate loop here: foreach (var element in elements){
element.Remove();//delete all the tabs (or buttons in your case)
} (fyi - attempting to delete them within the same loop as the search will throw an exception) Read more about configurations here: https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Configurations
... View more
01-03-2025
11:40 AM
|
0
|
0
|
982
|
|
POST
|
Here are two ways to do it. One uses an event which keeps the button and edit box loosely coupled, the other uses a direct reference where the button updates the edit box directly. The loosely coupled is the most flexible but is a bit more work than simply updating the edit box text - and, if that is literally all u need, then its overkill.
public class DateTimeStringChangedEventArgs : EventBase
{
public string OldDateTimeString { get; private set; }
public string NewDateTimeString { get; private set; }
public DateTimeStringChangedEventArgs(string oldDateTimeString, string newDateTimeString)
{
OldDateTimeString = oldDateTimeString;
NewDateTimeString = newDateTimeString;
}
}
public class DateTimeStringChangedEvent :
CompositePresentationEvent<DateTimeStringChangedEventArgs>
{
public static SubscriptionToken Subscribe(
Action<DateTimeStringChangedEventArgs> action, bool keepSubscriberReferenceAlive = false)
{
return FrameworkApplication.EventAggregator.GetEvent<DateTimeStringChangedEvent>()
.Register(action, keepSubscriberReferenceAlive);
}
public static void Unsubscribe(Action<DateTimeStringChangedEventArgs> subscriber)
{
FrameworkApplication.EventAggregator.GetEvent<DateTimeStringChangedEvent>()
.Unregister(subscriber);
}
public static void Unsubscribe(SubscriptionToken token)
{
FrameworkApplication.EventAggregator.GetEvent<DateTimeStringChangedEvent>()
.Unregister(token);
}
internal static void Publish(DateTimeStringChangedEventArgs payload)
{
FrameworkApplication.EventAggregator.GetEvent<DateTimeStringChangedEvent>()
.Broadcast(payload);
}
}
internal class Module1 : Module
{
private static Module1 _this = null;
private string _dateTimeString =
DateTime.Now.ToString("G", CultureInfo.CurrentCulture);
public string DateTimeString
{
get
{
return _dateTimeString;
}
set
{
var args = new DateTimeStringChangedEventArgs(
_dateTimeString, value);
_dateTimeString = value;
//Raise the event
DateTimeStringChangedEvent.Publish(args);
}
}
public EditBoxDirectApproach EditBoxDirectApproach { get; set; } = null;
...
}
internal class Button1 : Button
{
protected override void OnClick()
{
var date_string = DateTime.Now.ToString("G", CultureInfo.CurrentCulture);
//Indirect, loose-coupling
Module1.Current.DateTimeString = date_string;
//Direct, direct-coupled
Module1.Current.EditBoxDirectApproach.Text = date_string;
}
}
internal class EditBoxIndirectApproach : EditBox
{
public EditBoxIndirectApproach()
{
Initialize();
}
private bool _ignoreEvents = false;
private void Initialize()
{
//This will invoke OnTextChange which is ok
//as we havent subscribed to the event yet
this.Text = Module1.Current.DateTimeString;
DateTimeStringChangedEvent.Subscribe((args) =>
{
_ignoreEvents = true;
try
{
//Invokes OnTextChange
this.Text = args.NewDateTimeString;
}
finally
{
_ignoreEvents = false;
}
});
}
protected override void OnTextChange(string text)
{
//prevent (infinite) recursion
if (_ignoreEvents)
return;
Module1.Current.DateTimeString = text;
base.OnTextChange(text);
}
}
internal class EditBoxDirectApproach : EditBox
{
public EditBoxDirectApproach()
{
Module1.Current.EditBoxDirectApproach = this;
this.Text = DateTime.Now.ToString("G", CultureInfo.CurrentCulture);
}
}
... View more
12-12-2024
04:19 PM
|
2
|
0
|
790
|
|
POST
|
3.1.3 was .NET 6. he will need to recompile against the .3.1 assemblies.
... View more
12-04-2024
08:53 AM
|
0
|
1
|
1196
|
|
POST
|
I suspect that because u r setting the fill transparent it (ie the selection symbol) isnt giving u an appropriate contrast to the "underlying" feature symbol (of the selected feature) with just the highlight being applied to the feature boundary...
CIMFill transpFill = SymbolFactory.Instance.ConstructSolidFill(CIMColor.NoColor());
I think, at this juncture, it is trial and error w/ the selection symbol to get the effect u r looking for. As far as your code goes, it all looks correct to me.
p.s. I have never used UseSelectionSymbol but, given the name of the property, I wld expect it to have to be "true".
... View more
12-04-2024
08:50 AM
|
0
|
3
|
1580
|
|
POST
|
https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-GeometryEngine#scale-a-geometry
... View more
12-04-2024
08:36 AM
|
0
|
1
|
1775
|
|
POST
|
I think this is what u r running into:
https://community.esri.com/t5/arcgis-pro-sdk-questions/color-transparency-problem-in-arcgis-pro-3-4-when/m-p/1558573#M12298
I'll ask the Pro team if we can get a KB posted.
... View more
12-03-2024
02:26 PM
|
0
|
0
|
954
|
|
POST
|
Hi tim, i spoke to development about this as it is not something i am intimately familiar with. Accordingly, the original interface was based on interaction of the AO symbol model and GDI. Pro's display pipeline, as such, is quite different. That said, CIMGraphic does have a BlendingMode property which may cover the cases u were using depending on the opcode: https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic1910.html -But- the blending mode u specified would only be honored per graphic within the overlay layer. The overlay layer itself in Pro is hardcoded to alpha blending. Likely the interaction between the overlay and other layers may not be as expected so your mileage will vary.
... View more
09-10-2024
01:12 PM
|
0
|
1
|
973
|
|
POST
|
Addins are not intended to be, nor well suited to being, authoring tools for admin settings. That is best done w/ a custom script or .NET exe if the idea is to create a little utility admins can use to generate a Pro.settingsConfig rather than creating it by hand
... View more
09-09-2024
08:26 PM
|
0
|
0
|
1367
|
|
POST
|
Sounds like u/your organization has an admin setting in-place locking the home folder value. When a setting is locked, it cant be changed in the UI, via the SDK properties/methods, or via the ArcPy commands that give you similar access. Attempts to change a locked setting should fail. Only a user with the relevant permissions to change the underlying admin setting can make a change. https://pro.arcgis.com/en/pro-app/latest/get-started/application-setting-management.htm
... View more
09-09-2024
10:20 AM
|
0
|
0
|
1399
|
|
POST
|
try: var window = Project.GetCatalogPane(true);
if (window != null)
{
Project.OpenAsync(@"path_to_your_project");
} In your application ready. However, I dont quite follow the workflow. Your start page is being shown/ refreshing (asynchronously) for the purpose of selecting a project when u trigger opening of another project "underneath" it? Anyway, this is probably a timing issue in that the application is refreshing the start page UI when u call OpenAsync. If GetCatalogPane returns null u cld try building in a delay before invoking OpenAsync to allow the UI to complete its refresh. Something like "Task.Delay(500).Wait()" or whatever. That said, the preferred way to open a project without selecting a project from the start page is to specify the project on the command line - as the last argument (ie after the "/config:xxxxxxx"). This will skip showing the start page entirely. If u need to determine the project URI programmatically, and so cant use the cmd line, id suggest building in an event in your start page view model to fire after it (ie the start page user control) is loaded - and have that event do the OpenAsync.
... View more
09-03-2024
10:31 AM
|
0
|
1
|
1556
|
|
POST
|
Gurunara, if this answers your question please mark this post as the solution, thanks
... View more
07-19-2024
12:48 PM
|
0
|
0
|
1700
|
|
POST
|
No. This is the problem: graphicElement.GetGraphic().Symbol = polygonSymbol; The CIM uses a transactional pattern. You get a local copy, not a reference, of the deserialized state that u can modify (as needed) Changes must be _applied_ back via a commit. So, get the graphic (local copy) and _hold_ a reference (to that copy). var graphic = graphicElement.GetGraphic(); Next, apply your change to the copy whose reference you are holding: graphic.Symbol = polySymbol [or polySymbol.MakeSymbolReference() if u hv a symbol] Now, commit the change(s) made to the local copy _back_ graphicElement.SetGraphic(graphic);
... View more
07-18-2024
12:31 PM
|
0
|
0
|
1715
|
|
POST
|
You are close, - almost there. Use graphicElement.SetGraphic(...) - https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11077.html - to apply the changes to the graphic symbol _back_ to the element. There is a code snippet there u can use.
... View more
07-14-2024
01:20 PM
|
0
|
1
|
1765
|
|
POST
|
Change the color on the symbol, not the fill. if (symbol is CIMPolygonSymbol polygonSymbol)
polygonSymbol.SetColor(....) To change the color on a fill, use its color property. var solidFill = polygonSymbol.SymbolLayers.OfType<CIMSolidFill>().FirstOrDefault();
solidFill?.Color = .... ; "Symbol" take a symbol reference not a symbol. An unfortunate property naming. //polygonGraphic.Symbol = symbol;
polygonGraphic.Symbol = symbol.MakeSymbolReference();
... View more
07-13-2024
01:21 PM
|
0
|
0
|
1680
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | yesterday | |
| 1 | 3 weeks ago | |
| 1 | 01-08-2026 02:03 PM | |
| 1 | 01-08-2026 02:15 PM | |
| 3 | 12-17-2025 11:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|