|
POST
|
Hi, Start listening to OnProjectOpened event. You will find project path in ProjectEventArgs parameter. private void OnProjectOpened(ProjectEventArgs obj) //Project Opened event handler
{
MessageBox.Show($"{obj.Project.Path} has opened"); //show project path
}
... View more
04-03-2024
10:18 PM
|
0
|
3
|
1566
|
|
POST
|
I think your code goes into race condition. You don't know each part will update first MVVM or code behind on selection changed. If you started using MVVM then you need to avoid writing code in code behind.
... View more
04-02-2024
08:08 AM
|
0
|
1
|
1583
|
|
POST
|
Hi, Your shared code is not so accurate. Code below works: Protected async Overrides Sub OnClick()
Try
Dim currentLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType(Of FeatureLayer).FirstOrDefault
If currentLayer.ConnectionStatus = ConnectionStatus.Broken Then
End If
If currentLayer.SelectionCount = 0 Then
Else
Dim out_features = "C:\PATH\file.shp"
Dim where_clause = "TYPE = 80"
Dim use_field_alias_as_name = "NOT_USE_ALIAS"
Dim sort_field = "None"
Dim progDlg = New ProgressDialog("Export map" & vbCrLf & "Go get a coffee", "Cancel")
progDlg.Show()
Dim progsrc=New CancelableProgressorSource(progDlg)
Dim outpath = System.IO.Path.GetDirectoryName(out_features)
If Not System.IO.Directory.Exists(outpath) Then System.IO.Directory.CreateDirectory(outpath)
Dim valueArray = Await QueuedTask.Run(Function()
Return Geoprocessing.MakeValueArray(currentLayer, out_features, where_clause, use_field_alias_as_name, sort_field)
End Function)
Dim flags As GPExecuteToolFlags = GPExecuteToolFlags.GPThread
Dim gpResult As IGPResult = Await Geoprocessing.ExecuteToolAsync("conversion.ExportFeatures", valueArray, Nothing, progsrc.CancellationTokenSource.Token, Nothing, flags)
progDlg.Hide()
Dim val = If(String.IsNullOrEmpty(gpResult.ReturnValue), $"Error in gp tool: {gpResult.ErrorMessages}", $"Ok: {gpResult.ReturnValue}")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
... View more
04-01-2024
11:49 AM
|
0
|
0
|
1224
|
|
POST
|
Hi, Your datagrid behavior implementation is redundant. You can do the same workflow in your datagrid SelectedItem binded property setter: private object _selectedBene;
public object SelectedBene
{
get { return _selectedBene; }
set {
_selectedBene = value;
OnPropertyChanged();
_ = YourWorkflow();
}
}
private async Task YourWorkflow()
{
var LayerBeni = MapView.Active.Map.FindLayers(Constants.LayerNames.Beni).OfType<FeatureLayer>().FirstOrDefault();
//ZoomTo - IT BREAKS COMMAND BINDING
await MapView.Active.ZoomToAsync(LayerBeni, SelectedBene.OID, new TimeSpan(0, 0, 1));
//Flash
var selectionDictionary = new Dictionary<MapMember, List<long>>() { { LayerBeni, new List<long>() { SelectedBene.OID } } };
SelectionSet selectionToFlash = SelectionSet.FromDictionary(selectionDictionary);
MapView.Active.FlashFeature(selectionToFlash);
} Sorry, I don't know your real structure and object types. So I improvised
... View more
03-28-2024
09:52 AM
|
0
|
3
|
1629
|
|
POST
|
Hi, You can create CustomControl. Then customize it as you want. For example: <UserControl x:Class="RibbonControls.CustomControl1View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="clr-namespace:RibbonControls"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
d:DataContext="{Binding Path=ui.CustomControl1ViewModel}">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="My Combobox" />
<ComboBox Grid.Row="1" />
</Grid>
</UserControl> It will look like this: GKmieliauskas_0-1711488807922.png I have modified RibbonControls sample
... View more
03-26-2024
02:35 PM
|
1
|
0
|
868
|
|
POST
|
Hi, Have you tried to set AutoZoomOnEmptyMap outside LayerCreationParams constructor. Sometimes it could help. Like in code below: LayerCreationParams lyrParams = new(uri); // uri is a path to a .lyrx file
lyrParams.AutoZoomOnEmptyMap = false
LayerFactory.Instance.CreateLayer<Layer>(lyrParams, MapView.Active.Map);
... View more
03-26-2024
12:46 PM
|
0
|
1
|
4764
|
|
POST
|
Hi, As I said earlier you don't need code in Dockpane1View.xaml.cs. Delete all content from Dockpane1View.xaml.cs except constructor with one line InitializeComponent(); or create new dockpane from scratch. Your comboboxes must be binded to Dovpane1ViewModel properties as in MetadataBrowserControl sample. Combobox selection event will update special property in Docpane1ViewModel. Bind buttons to commands as in WorkingWithQueryDefinitionFilters sample. All stable properties fill in Dockpane contructor or override InitializeAsync() method as in samples above. In overriden OnShow method subscribe/unsubscribe to/from events and fill properties which can change content which depends on MapView or current application status. If it's difficult to understand how it works, download mentioned samples, build and debug using Visual Studio. MVVM is WPF stuff, not ArcGIS Pro.
... View more
03-25-2024
12:58 PM
|
0
|
0
|
2720
|
|
POST
|
Hi, Your code UpdateModule refID is wrong. DAML below shows group in esri_core_homeTab. <modules>
<insertModule id="ReportsSampleProject_Module" className="Module1" autoLoad="false" caption="Module1">
<!-- uncomment to have the control hosted on a separate tab-->
<tabs>
<!--<tab id="ReportsSampleProject_Tab1" caption="New Tab">
<group refID="ReportsSampleProject_Group1"/>
</tab>-->
</tabs>
<groups>
<!-- comment this out if you have no controls on the Addin tab to avoid
an empty group-->
<group id="ReportsSampleProject_Group1" caption="Group 1" appearsOnAddInTab="false">
<!-- host controls within groups -->
<button refID="ReportsSampleProject_Dockpane1_ShowButton" size="large" />
</group>
</groups>
<controls>
<!-- add your controls here -->
<button id="ReportsSampleProject_Dockpane1_ShowButton" caption="Show Dockpane 1" className="Dockpane1_ShowButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
<tooltip heading="Show Dockpane">Show Dockpane<disabledText /></tooltip>
</button>
</controls>
<dockPanes>
<dockPane id="ReportsSampleProject_Dockpane1" caption="Dockpane 1" className="Dockpane1ViewModel" dock="group" dockWith="esri_core_projectDockPane">
<content className="Dockpane1View" />
</dockPane>
</dockPanes>
</insertModule>
<updateModule refID="esri_core_module">
<tabs>
<updateTab refID="esri_core_homeTab">
<insertGroup refID="ReportsSampleProject_Group1"/>
</updateTab>
</tabs>
</updateModule>
</modules> My group appearsOnAddInTab="false" GKmieliauskas_0-1711355938053.png
... View more
03-25-2024
01:39 AM
|
0
|
0
|
852
|
|
POST
|
Please share your updated code and cleanup empty lines
... View more
03-22-2024
08:16 AM
|
0
|
3
|
2760
|
|
POST
|
Hi, 1. Find your dockpane: DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
if (pane == null)
return; 2. Cast pane to you ViewModel class and access public property: (pane as YourDockpaneViewModel).YourPropertyName = value;
... View more
03-22-2024
08:11 AM
|
1
|
1
|
2309
|
|
POST
|
Hi, Look at the ArcGIS Pro SDK community sample DatastoresDefinitionsAndDatasets
... View more
03-21-2024
01:21 PM
|
0
|
2
|
1518
|
|
POST
|
Hi, I would suggest you to check dockpane 'classname' and dockpane's content 'classname' paths. For dockpane viewmodel class is specified as 'classname' value and view class - as content 'classname' value. DataContext is set inside dockpane's internal code. I have noticed that you change module class name from Module1 to BiosModule. Have you changed Module class name in daml? - <insertModule id="*******_Module" className="Module1" autoLoad="false" caption="Module1"> Setting autoLoad to true could help too.
... View more
03-20-2024
07:51 AM
|
0
|
0
|
2415
|
|
POST
|
Hi, You can set DisplayName and other CIMTableField properties after report creating: List<string> displayNames = new List<string>() { "Project Id", "Id", "Field 1", "Field 2", "Field 3", "Field 4", "Field 5", "Field 6", };
internal async Task Execute()
{
if (FLayer == null) return;
try
{
var reportDataSource = PrepareDataSource();
var report = await CreateReportAsync(reportDataSource);
for (int i = 0; i < report.DataSource.Fields.Count(); i++)
{
var cimField = report.DataSource.Fields.ElementAt(i);
cimField.DisplayName = displayNames[i];
if (i == 0) cimField.Group = true;
if (i == 3 || i == 5 || i == 7)
{
cimField.IsVisible = false;
}
}
MessageBox.Show("Report created successfuly.");
}
catch (Exception ex)
{
MessageBox.Show("Failed to create report. Error" + ex.Message);
}
}
... View more
03-20-2024
07:42 AM
|
0
|
1
|
1782
|
|
POST
|
Hi, You can do it using geoprocessing Feature Class To Shapefile tool. Geoprocessing API reference is here
... View more
03-16-2024
12:03 PM
|
0
|
0
|
1320
|
|
POST
|
Why do you use code behind (xaml.cs) with dockpane? Can you share parts of code?
... View more
03-04-2024
02:49 AM
|
0
|
0
|
2699
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | a month ago | |
| 1 | 06-30-2026 10:14 PM | |
| 1 | 06-30-2026 01:43 PM | |
| 2 | 04-24-2026 08:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
Monday
|