POST
|
I've successfully got it worked with my codes. Thank you so very much. You're truly life saver!
... View more
06-17-2020
01:38 PM
|
0
|
0
|
392
|
POST
|
All, I have the codes below to do selection but I also need the code to return to me what account in the 'queryString' that it could not find in my layer. How do I do that? Thank you! queryString = accountNum in ('123', '456', '789') public static Task<int> SelectByAttributeAsync(string featureLayerName, string queryString)
{
return QueuedTask.Run(async () =>
{
var firstLyr =
MapView.Active.Map.FindLayers(featureLayerName).FirstOrDefault() as FeatureLayer;
if (firstLyr == null) throw new Exception(string.Format("The feature class: {0} does not exist", featureLayerName));
var qf = new QueryFilter()
{
WhereClause = queryString,
SubFields = "*"
};
};
MapView.Active.ZoomToSelected();
MapView.Active.ZoomToSelected(new TimeSpan(0, 0, 3), true);
return selectionCount;
});
... View more
06-16-2020
01:32 PM
|
0
|
2
|
418
|
POST
|
That's exactly what I'm looking for. Thank you very much!
... View more
06-09-2020
01:37 PM
|
0
|
0
|
854
|
POST
|
Hi, The codes below pick up the first layer. If I want a layername instead of 1st. How do I do that ? Thank you! // get the currently selected features in the map var selectedFeatures = ArcGIS.Desktop.Mapping.MapView.Active.Map.GetSelection(); // get the first layer and its corresponding selected feature OIDs var firstSelectionSet = selectedFeatures.First();
... View more
06-09-2020
12:17 PM
|
0
|
2
|
1659
|
POST
|
All, I found a snippet for creating callout text symbol below. What I need is to add callout text symbols to all selected features in layout. How do I use my selected feature centroid x, y with the codes below ? Thank you for your help. private static Task<CIMTextSymbol> CreateBackgroundCalloutAsync() { return QueuedTask.Run<CIMTextSymbol>(() => { var textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8, "Tahoma", "Bold"); //Create a call out var backgroundCalloutSymbol = new CIMBackgroundCallout(); //Leader line //Get a line symbol var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1, SimpleLineStyle.DashDotDot); //Create a solid fill polygon symbol for the callout. var aquaBackground = ColorFactory.Instance.CreateRGBColor(190, 255, 232, 100); var polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(aquaBackground, SimpleFillStyle.Solid); //assign the line to the callout backgroundCalloutSymbol.LeaderLineSymbol = lineSymbol; //Offset for the text textSymbol.OffsetX = 10; textSymbol.OffsetY = 10; //Assign the polygon to the background callout backgroundCalloutSymbol.BackgroundSymbol = polySymbol; //Accent bar var accentSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 2, SimpleLineStyle.Solid); backgroundCalloutSymbol.AccentBarSymbol = accentSymbol; //Set margins for the callout backgroundCalloutSymbol.Margin = new CIMTextMargin { Left = 5, Right = 5, Top = 5, Bottom = 5 }; //assign the callout to the textSymbol textSymbol.Callout = backgroundCalloutSymbol; return textSymbol; }); }
... View more
05-29-2020
01:16 PM
|
0
|
3
|
918
|
POST
|
Hi, in my case, after loading ExcelData, I move the item(s) around to other listboxes depends on the type. So let me rephrase my question, below is my listbox <ListBox x:Name="lslSubjAcct" /> Because I wrote codes to load data to lstSubjAcct listbox in a button click event therefore I have no ItemsSource binding in my xaml file. Now I need to get all items in my lstSubjAcct listbox to a string in the viewmodel, how do I do that ? Thank you! private void BtnAddSubject_Click(object sender, RoutedEventArgs e) { string currentItemText; int currentItemIndex; List<string> myDataList = new List<string>(); foreach (object item in lstAllAcct.Items) myDataList.Add(item as string); // Find the right item and it's value and index currentItemText = lstAllAcct.SelectedValue.ToString(); currentItemIndex = lstAllAcct.SelectedIndex; lslSubjAcct.Items.Add(currentItemText); if (myDataList != null) { myDataList.RemoveAt(currentItemIndex); } // Refresh data binding ApplyDataBinding(myDataList); } private void ApplyDataBinding(List<string> myNewDataList) { lstAllAcct.ItemsSource = null; // Bind ArrayList with the ListBox lstAllAcct.ItemsSource = myNewDataList; }
... View more
05-20-2020
07:55 AM
|
0
|
2
|
830
|
POST
|
Hi all, I have <ListBox x:Name="lstAllAcct" Grid.Row="1" ItemsSource="{Binding ExcelData}"/> <Button x:Name="btnNewSelection" Command="{Binding Path=NewSelectionCmd}"> {Binding ExcelData} is to get accounts from excel sheet to my listbox : done Now when button btnNewSelection is click I want to get all accounts in that listbox to a string (to construct my query statement) The code behind for the button: private RelayCommand _newSelectionCmd; public ICommand NewSelectionCmd { get { if (_newSelectionCmd == null) _newSelectionCmd = new RelayCommand(() => DoSearch(), () => true); return _newSelectionCmd; } private void DoSearch () { string strAllAccount ="" (how to I get all items in my listbox to strAllAccount?) } Your help is very much appreciated.
... View more
05-19-2020
12:15 PM
|
0
|
4
|
913
|
POST
|
Hi Daniel, Sorry for not explaining clearly and thanks for your response. 1/ Yes I created a dockpane 2/ A button on my dockpane to do search and zoom to selection on active map. 3/ lslSubjAcct is the name of a listbox that stores single or multiple account numbers to search 4/ SelectByAttributeAsync is a custom method that DoSearch call. I hard coded my where clause for the query and it works fine. What I'm trying to accomplish is to get all accounts on my listbox lslSubjAcct. The queryString (for the codes above) should be '1234','5678',9101'. Then I'll add FieldNameString, parentheses later. Final queryString should be Fieldname in ('1234', '5678') In ArcObject everything is in 1 place, much more simple for me to understand. Thank you so much.
... View more
05-19-2020
04:39 AM
|
1
|
0
|
954
|
POST
|
Hi, I'm from ArcMap world and totally confused between MVVM annd WPF and RelayCommand so please help me out. In my Dockpane1ViewModel.cs I tried private void DoSearch () { string strLayerName = "abc"; string queryString= ""; foreach (var item in lslSubjAcct.Items) { queryString+= item.ToString() + ", "; } SelectByAttributeAsync(strLayerName , queryString); } Error: lslSubjAcct does not exist in current context. How do I fix it? Thank you!
... View more
05-18-2020
03:29 PM
|
0
|
4
|
1020
|
POST
|
Hi Wolfgang, I've been studying the sample you suggested. I understand it a bit more but I'm still pvery much in dark. Hopefully you can shed some more light on me. I find case of textbox, it uses <TextBox Text="{Binding ItemID}"> in .xaml file, to bind the data returned from the codes in Dockpane1ViewModel.cs . My case I have to use listview to list all lines returned from excel. Which property of listview should I use for binding in .xaml file ? And many properties like View = View.Details; GridLines = true; FullRowSelect = true are not available in .xaml too. Your help is greatly appreciated. ---codes from my arcmap addin--------------- Dim workbook = package.Workbook If workbook IsNot Nothing Then Dim sheet = workbook.Worksheets(1) Dim firstColumnRows = sheet.Cells("A1:A") ' Loop through rows in the first column, get values based on offset Dim cell As Object myForm.lstAllAcct.View = View.Details myForm.lstAllAcct.Clear() myForm.lstAllAcct.Columns.Add("Account Number", 122) For Each cell In firstColumnRows Dim column1CellValue = cell.GetValue(Of String)() lvItem = myForm.lstAllAcct.Items.Add(Trim(column1CellValue.ToString)) Next End If -----------------------------------------------------------
... View more
04-29-2020
03:02 PM
|
0
|
2
|
2184
|
POST
|
Thank you very much. I'll work on it and keep you posted. I still can't wrap my brain around this. Addin for Arcmap was a lot more straight forward to me.
... View more
04-17-2020
06:46 AM
|
0
|
0
|
2184
|
POST
|
Hi, I'm a new with both C# and Pro SDK. I have to convert my vb.net ArcMap addin to Pro. I'm taking baby steps here so please bear with me. Today I'm trying to write codes for the addin for user to open an excel file and import a column to a list view which I put inside a dockpane. I got errors at lstviewAllAcct.View = View.Details; //error: View does not exist in the current context lstviewAllAcct.GridLines = true; //error: 'ListView' does not contain a definition for GridLines and no accessible extension method lstviewAllAcct.FullRowSelect = true; //error: same as above How to I access the properties of my listview? Thanks for your help. using ArcGIS.Desktop.Catalog;
using Microsoft.Win32;
using OfficeOpenXml; //reference EPPlus (excelpackage)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ProAppApril92
{
/// <summary>
/// Interaction logic for Dockpane1View.xaml
/// </summary>
public partial class Dockpane1View : UserControl
{
public Dockpane1View()
{
InitializeComponent();
}
private void BtnOpenExcelFile_Click(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = @"c:\";
openFileDialog1.Filter = "XLSX Files (*.xlsx)|*.xlsx|XLS Files (*.xls)|*.xls|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
openFileDialog1.RestoreDirectory = true;
openFileDialog1.ShowDialog();
var package = new ExcelPackage();
var workbook = package.Workbook;
if (workbook != null)
{
var sheet = workbook.Worksheets[1];
var firstColumnRows = sheet.Cells["A1:A"];
object cell;
lstviewAllAcct.View = View.Details;
lstviewAllAcct.GridLines = true;
lstviewAllAcct.FullRowSelect = true;
}
else
System.Windows.MessageBox.Show(openFileDialog1.Title);
}
}
}
... View more
04-16-2020
02:09 PM
|
0
|
5
|
2366
|
POST
|
I called ESRI support and the solution is arcpy.CopyFeatures_management(lyr, street_CopySelected, "", "0", "0", "0") It can not read the longName but it could read the object lyr. Thank you all so much for your help.
... View more
09-21-2018
02:06 PM
|
1
|
0
|
1006
|
Title | Kudos | Posted |
---|---|---|
1 | 08-21-2020 05:42 AM | |
1 | 09-28-2021 05:11 AM | |
1 | 09-17-2021 10:17 AM | |
1 | 05-19-2020 04:39 AM | |
1 | 09-21-2018 02:06 PM |
Online Status |
Offline
|
Date Last Visited |
01-19-2022
01:25 PM
|