|
POST
|
IQueryName2.CopyLocally Property will copy your table into the scratch workspace in your system temp directory to assign ObjectID column to your result table. The ObjectID column is used for selections. For more information check IQueryName2 Interface documentation.
... View more
06-26-2014
01:02 AM
|
1
|
0
|
2057
|
|
POST
|
A good idea is to make a new control inherits from Attachment Editor control then override onApplytemplate method to get the ItemsControl object. After that you can listen on ItemsSource property changed via DependencyProperty.RegisterAttached Method. Check this post for more information. ItemsControl attachmentListControl = null; public override void OnApplyTemplate() { base.OnApplyTemplate(); attachmentListControl = GetTemplateChild("AttachmentList") as ItemsControl; RegisterForNotification("ItemsSource", this.attachmentListControl, new PropertyChangedCallback(ItemsSourceChanged)); } public void ItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { System.Collections.ObjectModel.ObservableCollection<AttachmentInfo> attachmentInfoList = e.NewValue as System.Collections.ObjectModel.ObservableCollection<AttachmentInfo>; attachmentListControl.ItemsSource = attachmentInfoList.Where(x => x.Name.Contains(".pdf")); //or better check content type } public void RegisterForNotification(string propertyName, FrameworkElement element, PropertyChangedCallback callback) { Binding b = new Binding(propertyName) { Source = element }; var prop = System.Windows.DependencyProperty.RegisterAttached("ListenAttached" + propertyName, typeof(object), typeof(UserControl), new System.Windows.PropertyMetadata(callback)); element.SetBinding(prop, b); } you can also add another property for your filter to be more dynamic. Hope this helps. Regards,
... View more
06-25-2014
10:28 PM
|
0
|
0
|
1006
|
|
POST
|
My first thought is to handle the visibility of the item according to its file type. you can bind the visibility of the Item Template to the uri with converter to set visibility to Visible if it matched your filter. It's a quick solution and if you have more complex business you should implement your own control. Check this post for something similar. Regards,
... View more
06-25-2014
01:41 PM
|
0
|
0
|
1006
|
|
POST
|
Hi Carsten, you can't apply spatial filter on IQueryDef so your approach to use TableQueryNameClass is a good idea if your tables are in the same geodatabase, use it with query definition and then use a spatial filter. http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/d/000100000146000000.htm
... View more
06-25-2014
11:29 AM
|
0
|
0
|
2057
|
|
POST
|
Hello David, I have implemented a method which will loop over a folder contents (selected folder or specific folder name) and close all active database connections inside it.
private void DisconnectActiveSDEConnections(IGxApplication gxApp, bool useSelectedFolder = false, string folderName = "Database Connections")
{
IGxCatalog gxCatalog = gxApp.Catalog;
object connectionsFolder = null;
IGxSelection gxSel = null;
IGxObject gxObj = null;
int numFound;
try
{
if (useSelectedFolder)
{
gxSel = gxApp.Selection;
gxObj = gxSel.Location;
}
else
{
connectionsFolder = gxCatalog.GetObjectFromFullName(folderName, out numFound);
if (numFound != 1 || connectionsFolder == null)
{
MessageBox.Show("Folder not found!");
return;
}
gxObj = connectionsFolder as IGxObject;
}
if (gxObj is IGxObjectContainer)
{
IGxObjectContainer gxObjCont = null;
IEnumGxObject gxEnum = null;
IGxObject gxObject = null;
IGxDatabase2 gxDatabase = null;
gxObjCont = gxObj as IGxObjectContainer;
gxEnum = gxObjCont.Children; //enumerate folder contents
gxObject = gxEnum.Next();
while (gxObject != null)
{
gxDatabase = gxObject as IGxDatabase2;
Debug.Print(gxObject.Category);
if (gxDatabase != null && gxDatabase.IsConnected)
{
gxDatabase.Disconnect();
Debug.Print(gxObject.FullName + " Disconnected");
}
gxObject = gxEnum.Next();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Regards, Ahmed
... View more
06-18-2014
10:40 PM
|
1
|
1
|
2011
|
|
POST
|
You can start with template theme of Magnifier sample, It's a rounded map. I tried it with silverlight and it should work with WPF too. Regards,
... View more
06-18-2014
01:11 AM
|
0
|
0
|
680
|
|
POST
|
As Mody said you can pass your template layer as string because it's a Multi value parameter. You can also use ESRI.ArcGIS.DataManagementTools.CreateFeatureclass which is the same. Another approach is to use IfeatureWorkspace.CreateFeatureClass and pass your fields from Template featureclass. Regards,
... View more
06-17-2014
10:52 PM
|
0
|
0
|
1516
|
|
POST
|
The dependency property works with any silverlight sample. I'm still confuse? It depends on what you want, but basically if you want to pass object from your MainPage -which hosts your controls- to your child controls, you can use dependency property as you can bind to it.
... View more
06-17-2014
09:30 PM
|
0
|
0
|
623
|
|
POST
|
Hi all I've used sample "Bind a geodatabase table to .net control" to show attribute table of feature layers in a datagridview. Now, i wanna update that datagridview when user selects some features in map and select corresponding rows. Is there any code or sample for that? I've searched all internet but no help. Regards I have implemented a function based on ""Bind a geodatabase table to .net control"" sample, use this function when selection changed (may be in ActiveView Selection Changed). You should pass your featurelayer and ObjectID field as parameters. you should modify the code/parameters according to your business.
private void UpdateGridSelection(IFeatureLayer featureLayer,string oIDField)
{
try
{
//Clear Selection
dataGridView1.ClearSelection();
//Get Selection set and populate Object IDs in List
IFeatureSelection pFeatureSelection = featureLayer as IFeatureSelection;
ISelectionSet pSelectionSet = pFeatureSelection.SelectionSet;
IEnumIDs IDsEnum = pSelectionSet.IDs;
int Id = -1;
Id = IDsEnum.Next();
List<int> IdList = new List<int>();
while (Id != -1)
{
IdList.Add(Id);
Id = IDsEnum.Next();
}
//Select Rows Matches Selected Features By Its Object ID
if (IdList.Count > 0)
{
var rows = from row in dataGridView1.Rows.Cast<DataGridViewRow>()
where IdList.Contains(Convert.ToInt32(row.Cells[oIDField].Value))
select row;
foreach (var item in rows)
{
item.Selected = true;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Regards, Ahmed
... View more
06-17-2014
01:17 AM
|
0
|
0
|
719
|
|
POST
|
Hi Eliza, You can make a DependencyProperty in your new control then pass the map object to it. Check the attached sample. Regards,
... View more
06-16-2014
10:39 PM
|
0
|
0
|
623
|
|
POST
|
Hi, I am trying get layer names to text box but i am not getting result.Here is my code Can any one help IMxDocument imx = m_application.Document as IMxDocument; IMap map = imx.FocusMap; StreamWriter sw = new StreamWriter("C:\\temp\\layer.txt"); //Use StreamWriter inside Using statement ILayer layer =null; // int lcount = map.LayerCount; IEnumLayer player = map.get_Layers(null, false); for (int i=0;i<map.LayerCount;i++) //Don't loop here layer = player.Next(); //You should check layer object not player while (player!=null) { sw.WriteLine(layer.Name); layer = player.Next(); } } Try this, I have also explained what's wrong with your code:
IMxDocument imx = ArcMap.Application.Document as IMxDocument;
IMap map = imx.FocusMap;
ILayer layer = null;
//Get Layers
IEnumLayer player = map.get_Layers(null, false);
layer = player.Next();
//Write Layers To Stream
using (StreamWriter writer = new StreamWriter("C:\\temp\\layer.txt", true))
{
while (layer != null)
{
writer.WriteLine(layer.Name);
layer = player.Next();
}
}
Regards,
... View more
06-15-2014
11:24 PM
|
0
|
1
|
781
|
|
POST
|
It's mentioned here that To access raster from geodatabase, use IRasterWorkspaceEx interface. Regards,
... View more
06-02-2014
01:18 AM
|
0
|
0
|
732
|
|
POST
|
Hello Ahmed, your sample works nice as described, but removing templates permanently is not what I intended. Any idea about just temporarily filtering those templates? Thanks and Regards Fossi I didn't find a way to access filter window yet. It's included in the create feature dockable window and I don't think that you can access it. Check this sample for a custom feature template box,It may help you. http://blogs.esri.com/esri/arcgis/2011/12/13/implementing-a-feature-template-dialog-box-in-your-code/
... View more
06-02-2014
01:11 AM
|
0
|
0
|
1896
|
|
POST
|
What about Frequency Tool,It will get the count. You can get the result in InMemory Table and populate it to your list. You can run the tool from Arcmap and check its performance and output structue. Sample: private ITable RunFrequencyTool(ITable inputTable, string inputField)
{
try
{
ESRI.ArcGIS.AnalysisTools.Frequency FrequencyTool = new ESRI.ArcGIS.AnalysisTools.Frequency();
ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult Result;
FrequencyTool.in_table = inputTable;
FrequencyTool.frequency_fields = inputField;
FrequencyTool.out_table = "in_memory\\Result";
Result = RunTool(FrequencyTool, null);
return GetTablefromResult(Result);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
return null;
}
} private ESRI.ArcGIS.Geodatabase.ITable GetTablefromResult(ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult result)
{
ESRI.ArcGIS.Geodatabase.IGPValue GPVal;
string OutputTableName;
ESRI.ArcGIS.Geoprocessing.IGPUtilities3 GPUtil = new ESRI.ArcGIS.Geoprocessing.GPUtilities() as ESRI.ArcGIS.Geoprocessing.IGPUtilities3;
ESRI.ArcGIS.Geodatabase.ITable pOutputTable;
try
{
GPVal = result.GetOutput(0);
OutputTableName = GPVal.GetAsText();
pOutputTable = GPUtil.OpenTableFromString(OutputTableName);
return pOutputTable;
}
catch (Exception ex)
{
return null;
}
}
... View more
05-29-2014
01:23 AM
|
0
|
0
|
943
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-22-2015 06:50 AM | |
| 1 | 04-01-2014 10:01 PM | |
| 1 | 04-07-2014 11:18 PM | |
| 1 | 04-08-2014 09:19 PM | |
| 1 | 11-26-2014 07:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|