Hello,
Could you please provide your suggestions on it.
When I click on the feature on a map - it should display the "FieldAliases" of the layer instead of "DisplayFieldName". And there is a property for the featurset -"FieldAliases" - but I am not sure how I can convert the Dictionary<string,string> to string datatype.
Please find below the code for this:
#region GeoFeatureCollection Class - Equivalent to FeatureSet
public class GeoFeatureCollection : ObservableCollection<Graphic>
{
private string _outputFields = "";
private string _outputLabels = "";
private string _displayField = "";
private string _featureLayer = "";
private string _dataSourceName = "";
private string _hyperlinkField = "";
private GeometryType _geometryType;
private string _fieldaliases = "";
#region Properties
public string OutputFields
{
get { return this._outputFields; }
set { this._outputFields = value; }
}
public string OutputLabels
{
get { return this._outputLabels; }
set { this._outputLabels = value; }
}
public string DisplayFieldName
{
get { return this._displayField; }
set { this._displayField = value; }
}
public string FieldAliases
{
get { return this._fieldaliases; }
set { this._fieldaliases = value; }
}
public string FeatureLayerName
{
get { return this._featureLayer; }
set { this._featureLayer = value; }
}
public string DataSourceName
{
get { return this._dataSourceName; }
set { this._dataSourceName = value; }
}
public string HyperlinkField
{
get { return this._hyperlinkField; }
set { this._hyperlinkField = value; }
}
public GeometryType GeometryType
{
get { return this._geometryType; }
set { this._geometryType = value; }
}
#endregion
public GeoFeatureCollection()
{
}
public GeoFeatureCollection(FeatureSet fset, string featureLayerName) : this(fset, "", "", featureLayerName) { }
public GeoFeatureCollection(FeatureSet fset, string outputFields, string outputLabels, string featureLayerName)
{
this._outputFields = outputFields;
this._outputLabels = outputLabels;
this._featureLayer = featureLayerName;
this._geometryType = fset.GeometryType;
this._displayField = fset.DisplayFieldName;
this._fieldaliases = fset.FieldAliases; (This is the line of the code for which I m getting the below message)
"Cannot implicitly convert type 'System.Collections.Generic.Dictionary<string,string>' to 'string'"
foreach (Graphic graphic in fset.Features)
{
graphic.Geometry.SpatialReference = fset.SpatialReference;
this.Add(graphic);
}
}
Thanks in Advance for providing your inputs.