How to Set SDE-added Layers as Read-Only, Uneditable?

243
2
Jump to solution
02-22-2024 07:03 PM
MaxWei
by
New Contributor II

I'm using the method new FeatureLayerCreationParams(new Uri(XXX)) to add layers from SDE to the map. How can I set the added layers as read-only and uneditable?

0 Kudos
1 Solution

Accepted Solutions
UmaHarano
Esri Regular Contributor

Hi,

Here is a code snippet that sets a FeatureLayer to be uneditable.

 

QueuedTask.Run(() =>
{
  var cimFeatureLayer = layer.GetDefinition() as CIMFeatureLayer;
  var featureTable = cimFeatureLayer.FeatureTable;
  featureTable.Editable = false;
  cimFeatureLayer.FeatureTable = featureTable;
  layer.SetDefinition(cimFeatureLayer);

});

View solution in original post

2 Replies
UmaHarano
Esri Regular Contributor

Hi,

Here is a code snippet that sets a FeatureLayer to be uneditable.

 

QueuedTask.Run(() =>
{
  var cimFeatureLayer = layer.GetDefinition() as CIMFeatureLayer;
  var featureTable = cimFeatureLayer.FeatureTable;
  featureTable.Editable = false;
  cimFeatureLayer.FeatureTable = featureTable;
  layer.SetDefinition(cimFeatureLayer);

});
MaxWei
by
New Contributor II

Thank you so much.

0 Kudos