POST
|
It would be good if folks at ESRI could detail and document this control. It is also a bit clunky and has issues with visibility when closes the label down.
... View more
03-05-2024
02:18 AM
|
0
|
0
|
36
|
POST
|
Hi I have a recursive function that goes through a nested hierarchy of layers and loads them into a map. When the code hits line 3 - it can take a long time for the layer to be actually created in the map (bearing in mind this is coming over the wire from ArcGIS Online storage). Is there a quicker way to load layers? I was thinking of trying to do something with a Task.WaitAll() kind of approach but I'm not sure that's going to work if its recursive and also I think it will mess up index order for layers that need to go in a certain order in a group node. l if (LayerFactory.Instance.CanCreateLayerFrom(currentItem))
{
FeatureLayer featureLayer = LayerFactory.Instance.CreateLayer<FeatureLayer>
(layerParam, groupLayer);
} asdf
... View more
01-24-2024
12:56 PM
|
0
|
0
|
260
|
POST
|
Hi, I want to put an autocomplete combobox in a dock pane that will be sensitive to dark and light themes in Pro. Does anyone know of a good third party control or how to do it by hand using standard windows WPF controls? Thanks in advance.
... View more
12-21-2023
04:02 AM
|
1
|
0
|
284
|
POST
|
So ESRI's implementation does not follow standard Windows behaviour? I really don't like it. The fact that you have to remember to type in the file extension. However, there is nothing I can do about it. I wish ESRI would change this to be more standard behaviour that we are used to.
... View more
12-19-2023
01:36 AM
|
1
|
0
|
207
|
POST
|
I have used the SaveItemDialog with 2 filters. Whenever I type a name for the file I want to save it never puts the appropriate suffix for the file type I want to save as. I cannot seem to find anything in the instance of the SaveItemDialog to see what the current filter selected is as there is nothing showing a property to this effect. Can someone help me understand how I can get the right file suffix on save? var jsonFilter = BrowseProjectFilter.GetFilter("esri_browseDialogFilters_json_file");
var csvFilter = BrowseProjectFilter.GetFilter("esri_browseDialogFilters_browseFiles");
csvFilter.FileExtension = "csv";
csvFilter.Name = "CSV files (*.csv)|*.csv";
csvFilter.BrowsingFilesMode = true;
BrowseProjectFilter compositeFilter = new BrowseProjectFilter();
compositeFilter.AddFilter(jsonFilter);
compositeFilter.AddFilter(csvFilter);
SaveItemDialog saveDialog = new SaveItemDialog()
{
Title = "Save",
BrowseFilter = compositeFilter,
OverwritePrompt = true
};
bool? result = saveDialog.ShowDialog();
if (result == true)
{
//Get the selected file path
string filePath = saveDialog.FilePath;
//File path is always missing file suffix which is specified in the filter
}
... View more
12-18-2023
10:11 AM
|
0
|
2
|
321
|
POST
|
A bit disappointing that this question hasn't been addressed. There are a few things unclear about the SaveItemDialog() in the documentation - too much emphasis on the OpenItemDialog(). At the moment I am finding that I can't use a file filter of more than one type and have it honoured. The dialog just removes any suffix. So any help in regards to this would be useful (similar problem to the one initially outlined): var dlg = new SaveItemDialog();
dlg.Title = "Save File";
dlg.OverwritePrompt = true;
// Create file filters for JSON and CSV
var jsonFilter = BrowseProjectFilter.GetFilter("esri_browseDialogFilters_browseFiles");
jsonFilter.FileExtension = "json";
jsonFilter.Name = "(*.json)";
var csvFilter = BrowseProjectFilter.GetFilter("esri_browseDialogFilters_browseFiles");
csvFilter.FileExtension = "csv";
csvFilter.Name = "(*.csv)";
BrowseProjectFilter compositeFilter = new BrowseProjectFilter();
compositeFilter.AddFilter(jsonFilter);
compositeFilter.AddFilter(csvFilter);
dlg.BrowseFilter = compositeFilter;
bool? result = dlg.ShowDialog();
if (result == true)
{
//!!!!! filePath has its file suffix missing!
string filePath = dlg.FilePath;
}
... View more
12-18-2023
08:07 AM
|
0
|
0
|
172
|
POST
|
Hi, I have a pro window that is modal - it lists the maps in the project. You select a map and press ok. Meanwhile there is QueuedTask that opens up the map, this can take some time so I use a progress dialog just so the user knows Pro is doing things. However if I don't put a message box after it has opened the map, code execution continues and won't allow the user to select a file to save the json and just says "JSON file not saved". I want to get rid of this! This is really strange because the save file dialog is modal but its almost like the computer has automatically cancelled the dialog and continued execution on it's own accord. I though execution had to halt on a modal dialog. If anyone can help me get rid of the unnecessary message box that would be great. Also an explanation to what stupid thing I'm doing wrong would be great. I have tried many things but I can't seem to solve it. The code below should be able to be copy pasted behind a ribbon button in pro. However you may need some rudimentary XAML for the pro window. Just an ok button would do I guess. protected async override void OnClick()
{
var proWindowModal = new MapPaneChooserWindow
{
DataContext = new MapPaneChooserWindowVM(),
Owner = FrameworkApplication.Current.MainWindow
};
var dialogResult = proWindowModal.ShowDialog();
if (dialogResult == true)
{
ProgressorSource ps = new ProgressorSource("Opening map...");
//This can take some time - so we use a progress dialog.
chosenMap = await QueuedTask.Run(() =>
{
return Module1.MapPaneChooserWindowVM.SelectedMap.GetMap();
}, ps.Progressor);
//!!!! Forced to put a message box here or it will run automatically to "Layer collection not saved" section below !!!!
//If you take this message box out of hte code - you will see the effect
MessageBox.Show("Finished opening map.", "Map", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "JSON files (*.json)|*.json";
saveFileDialog.Title = "Save JSON File";
var result = saveFileDialog.ShowDialog();
if (result == true)
{
//do stuff about saving a json file here...
}
else
{
MessageBox.Show("JSON file not saved", "Save JSON file", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
}
}
}
... View more
12-12-2023
03:32 AM
|
0
|
1
|
317
|
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
|
391
|
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
|
420
|
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
|
428
|
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
|
454
|
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
|
508
|
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
|
560
|
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
|
610
|
Title | Kudos | Posted |
---|---|---|
1 | 12-19-2023 01:36 AM | |
1 | 12-21-2023 04:02 AM | |
1 | 05-27-2021 10:01 AM | |
1 | 05-05-2021 01:32 AM | |
2 | 02-11-2021 08:46 AM |
Online Status |
Offline
|
Date Last Visited |
03-14-2024
04:02 PM
|