Is it possible to change the version at the feature service level, instead of iterating and changing it at each individual featurelayer level for the current active map?
Solved! Go to Solution.
MapView.Active.Map.ChangeVersion(fromVersion, toVersion);
MapView.Active.Map.ChangeVersion(fromVersion, toVersion);
Thanks Gurunara. Is it possible to change version of few feature instead of entire map. I want to show feature layer in default version as well as same feature layer in different version.
Below changes the map's version
FeatureLayer featureLayer = (FeatureLayer)LayerFactory.Instance.CreateLayer(new Uri(queryUrl), MapView.Active.Map);
featureLayer.SetDefinitionQuery(query);
var dataStore = featureLayer.GetFeatureClass().GetDatastore();
// Create a geodatabase from the feature service URL
Geodatabase geodatabase = dataStore as Geodatabase; //casting to Geodatabase
if (geodatabase == null)
return;
VersionManager versionManager = geodatabase.GetVersionManager();
ArcGIS.Core.Data.Version currentVersion = versionManager.GetCurrentVersion();
//Getting all available versions except the current one
ArcGIS.Core.Data.Version toVersion = versionManager.GetVersion("versionName");
if (toVersion != null)
{
//Changing version
MapView.Active.Map.ChangeVersion(currentVersion, toVersion);
}