|
POST
|
Hi Uma, I tried this but it does something weird to the padding or margins, see below: I think this style is meant for buttons on forms, not ribbons (maybe).
... View more
05-02-2023
03:37 AM
|
0
|
0
|
1263
|
|
POST
|
Hi I'm struggling to get a custom control to behave like a standard button on the ribbon. My custom control is basically the same as a medium size button (text and image), a little notification badge appears on the button which is my embellishment and irrelevant to this question so I'll leave that out. When I mouse over in dark mode it should be dark grey (like other standard controls), but it shows up as a pale blue (I think the same as the light theme). Also the esri image I have embedded into the button doesn't seem to respect dark mode. The following image should help explain: Here is the XAML, which may prove useful: <UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Width="120" Height="22">
<Button BorderThickness="0" Background="Transparent" Command="{Binding CommandShowDataGroups}" >
<StackPanel Orientation="Horizontal" Width="120" Height="22">
<!--Grid only used to overlay the badge over the icon, it uses the same coloumn 0-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="18"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Margin="2 0 0 0" Source="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/VariableCategoryKeyUSData16.png" Width="16" Height="16" Stretch="None"/>
<ui:BadgeControl Grid.Column="0" Visibility="{Binding IsBadgeVisible}" BadgeControlText="{Binding BadgeText}" BadgeControlColor="{Binding BadgeColor}" Width="15" Height="17"></ui:BadgeControl>
<TextBlock Foreground="{DynamicResource Esri_TextStyleDefaultBrush}" Grid.Column="1" Margin="4 0 0 0" FontSize="12" TextWrapping="Wrap" VerticalAlignment="Center" TextAlignment="left" Width="100" Text="Data Groups"></TextBlock>
</Grid>
</StackPanel>
</Button>
</Grid> Can anyone assist?
... View more
04-27-2023
06:35 AM
|
0
|
3
|
1292
|
|
POST
|
After I wrote the initial post, I found that missing bit of code that you mentioned (MapMemberPosition.Index) and thought I'd cracked it! and you'd think that would fix it wouldn't you? Well, I did try that and it made zero difference. I was so frustrated and I really couldn't think what else it would be. It's only when I stumbled across an example piece of ESRI help code showing the non-constructor example of using LayerCreationParams, that it actually started working. I have updated the post - so people, like yourself don't think "MapMemberPosition.Index is missing". I should have done that in the first place really. I would be interested if you can confirm my findings though if you have chance. I am using 3.x version of Pro.
... View more
02-17-2023
01:42 AM
|
0
|
1
|
1132
|
|
POST
|
I'm suspecting that the constructor is at fault here - if ESRI could confirm this as a bug or not that would be good. I have since changed the code to this, not using a constructor, and it works perfectly. Very strange and certainly a high chance that this will "can-trip" a lot of developers. Here is the code that now works: Item currentItem = ItemFactory.Instance.Create(AgolId, ItemFactory.ItemType.PortalItem);
await QueuedTask.Run(() =>
{
//Create a LayerCreationParam - constructor method does not honour indexes.
var layerParam = new LayerCreationParams(currentItem);
layerParam.Name = layer.Name;
layer.Visible = layer.Visible;
layerParam.MapMemberPosition = MapMemberPosition.Index;
layerParam.MapMemberIndex = layer.LayerOrder;
if (LayerFactory.Instance.CanCreateLayerFrom(currentItem))
{
LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParam, groupLayer);
}
});
... View more
02-14-2023
09:31 AM
|
0
|
3
|
1158
|
|
POST
|
Hi, I am trying to add 3 layers to a group layer in a specific index order. I use the FeatureLayerCreationParams object with the LayerFactory.Instance.CreateLayer() function - but when I look at the results in the TOC - the layers have come in a random order and not the order I specified. This was working fine in 2.x but since I have moved to 3.x this code does not seem to work - I'm not sure what I can do but I need to fix the problem urgently. Here is the code I use (I pass in my object called "layer", which holds the index information to pass on): await QueuedTask.Run(() =>
{
Item stagingLayer = ItemFactory.Instance.Create(AgolId, ItemFactory.ItemType.PortalItem);
if (LayerFactory.Instance.CanCreateLayerFrom(stagingLayer))
{
var featureCreateParams = new FeatureLayerCreationParams(stagingLayer)
{
IsVisible = layer.Visible,
MapMemberIndex = layer.LayerOrder,
//Even this does NOT fix the issue
MapMemberPosition = MapMemberPosition.Index,
Name = layer.Name
};
LayerFactory.Instance.CreateLayer<FeatureLayer>(featureCreateParams, groupLayer);
}
});
... View more
02-14-2023
07:37 AM
|
0
|
4
|
1212
|
|
POST
|
Hi, I did, in the end, do something similar to what you are suggesting. Multiple queries with guaranteed results of less that 10,000 - then store that in a list. It was a bit more faffing about - but I did learn about clever multiple async calls to the rest endpoint - that ended up getting the results much faster than I thought. So I did gain some benefit out of it.
... View more
02-02-2023
07:06 AM
|
0
|
0
|
1474
|
|
POST
|
No I don't mean that. I mean my actual project/add-in. Its huge from version 2.x of Pro. If I have to start a new addin project and copy in all the code and start again - thats a real pain in the backside!
... View more
01-25-2023
07:14 AM
|
0
|
1
|
1374
|
|
POST
|
Where do you begin with this sort of stuff?! I did the migration process, but who knows if its done it 100% right. It would seem it hasn't ported cleanly. I really don't want to start remaking all over project again.
... View more
01-25-2023
06:59 AM
|
0
|
3
|
1378
|
|
POST
|
I have a maptool where I just place a marker on a map. Nothing else, no other business logic. The marker is placed fine, however - when you look at the debug the amount of exceptions thrown from ArcGIS.Dektop.Mapping.dll is concerning. What is going on here, should this be happening? Here is my simple code: internal class FooTool : MapTool
{
private IDisposable _graphic = null;
public FooTool()
{
IsSketchTool = true;
SketchType = SketchGeometryType.Point;
SketchOutputMode = SketchOutputMode.Map;
}
protected override async Task<bool> OnSketchCompleteAsync(ArcGIS.Core.Geometry.Geometry geometry)
{
try
{
MapPoint mapPoint = (MapPoint)geometry;
await QueuedTask.Run(() =>
{
var mapView = MapView.Active;
//Show marker
if (_graphic != null)
{
_graphic.Dispose();
}
_graphic = mapView.AddOverlay(mapPoint, SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.BlueRGB, 14, SimpleMarkerStyle.Pushpin).MakeSymbolReference());
});
}
catch (ArgumentException ae)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ae.Message, "Tool error");
}
catch (Exception ex)
{
Log.Error(ex);
}
return true;
}
}
... View more
01-25-2023
05:46 AM
|
0
|
7
|
1426
|
|
POST
|
Hi, We, as a company are facing a serious limitation which is having an impact on the add-in software we supply to our customers. We need to be able to search AGOL for items (Layers) that exceed the 10000 limit - we have around 33,000 items we want to return. This is my code which hits the hard limit of 10,000 - it uses pagination. private static async Task<HashSet<AgolLayer>> GetLayersFromAGOL(string search)
{
var portal = ArcGISPortalManager.Current.GetActivePortal();
HashSet<AgolLayer> agolLayers = new HashSet<AgolLayer>(new AgolIdComparer());
if (portal.IsSignedOn())
{
var query = PortalQueryParameters.CreateForItemsOfTypes(new List<PortalItemType>() { PortalItemType.Layer }, "", Properties.Settings.Default.CurrentGroupId, search);
query.Limit = 100;
query.Query = query.Query + "&sortField=modified&sortOrder=desc";
//Loop until done
var portalItems = new List<PortalItem>();
while (query != null)
{
//run the search
PortalQueryResultSet<PortalItem> results = await portal.SearchForContentAsync(query);
portalItems.AddRange(results.Results);
totalResultsCount = results.TotalResultsCount;
query = results.NextQueryParameters;
}
foreach (var pi in portalItems)
{
AgolLayer agolLayer = new AgolLayer(pi);
agolLayers.Add(agolLayer);
}
}
return agolLayers;
} Is there a way around this limitation? Some links (below) back the findings I am referring to: https://developers.arcgis.com/rest/users-groups-and-items/considerations-and-limitations.htm
... View more
01-18-2023
06:27 AM
|
0
|
3
|
1579
|
|
POST
|
It does actually. However the code I left out was a line that created a row in a database (a method that is not async) based on findings earlier on i.e. the alias name. I think this may be the bit of code that is causing the code to not run properly.
... View more
11-14-2022
03:18 AM
|
0
|
0
|
1574
|
|
POST
|
You're right it does work. I have simplified what I have done - so I guess I'll take it from there and build it up in complexity and see what is causing the problem.
... View more
11-14-2022
02:09 AM
|
0
|
2
|
1584
|
|
POST
|
Updated - not really anything special to call code.
... View more
11-14-2022
01:36 AM
|
0
|
4
|
1588
|
|
POST
|
Hi, I'm trying to go through each layer in the TOC and do get the alias name of the layer then do something that name. In order to this - I have a recursive method that loops - however you need to await QueuedTask.Run() the call to get information about an alias in layer - and in a recursive function something weird is happening - as this only gets called once and never breaks into that Queued Task code block again. Something is happening here thats a bit beyond me when it gets to asynchronous programming - can anyone help me find a way to get this recursive function to work properly? //calling code:
var map = MapView.Active.Map;
foreach (var item in map.Layers)
{
await RecurseTocLayers(item);
}
private async Task RecurseTocLayers(Layer layer)
{
if (layer is BasicFeatureLayer)
{
FeatureLayer featureLayer = layer as FeatureLayer;
//THIS ONLY GETS CALLED ONCE - THEN NEVER AGAIN!
await QueuedTask.Run(() =>
{
var table = featureLayer.GetTable();
TableDefinition tableDefinition = table.GetDefinition();
string alias = tableDefinition.GetAliasName();
//do something here with alias name.....e.g.
System.Diagnostics.Debug.WriteLine($"The alias name is: {alias}");
});
}
if (layer is GroupLayer)
{
//do something here with GroupLayer, then....
GroupLayer groupLayer = (GroupLayer)layer;
foreach (var child in groupLayer.Layers)
{
await RecurseTocLayers(child);
}
}
} ASDFDSAF
... View more
11-13-2022
05:14 AM
|
0
|
7
|
1643
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 12-18-2023 10:11 AM | |
| 1 | 08-22-2025 02:27 AM | |
| 2 | 12-19-2023 01:36 AM | |
| 1 | 12-21-2023 04:02 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|