GetTable Method (BasicFeatureLayer)
Returns the underlying feature class as Table type.
This method must be called on the MCT. Use QueuedTask.Run.
Obtaining Geodatabase from FeatureLayer
public async Task ObtainingGeodatabaseFromFeatureLayer()
{
IEnumerable<Layer> layers = MapView.Active.Map.Layers.Where(layer => layer is FeatureLayer);
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
foreach (FeatureLayer featureLayer in layers)
{
using (Table table = featureLayer.GetTable())
using (Datastore datastore = table.GetDatastore())
{
if (datastore is UnknownDatastore)
continue;
Geodatabase geodatabase = datastore as Geodatabase;
}
}
});
}
Gets the count of how many rows are currently in a Table
//Note: call within QueuedTask.Run()
Table table = featureLayer.GetTable();
long count = table.GetCount();
Get the Annotation Text Graphic
await QueuedTask.Run(() =>
{
using (var table = annoLayer.GetTable())
{
using (var rc = table.Search())
{
rc.MoveNext();
using (var af = rc.Current as AnnotationFeature)
{
var graphic = af.GetGraphic();
var textGraphic = graphic as CIMTextGraphic;
//Note:
//var outline_geom = af.GetGraphicOutline();
//gets the anno text outline geometry...
}
}
}
});
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.