GenerateRendererTask with Dynamic Workspace

2044
2
Jump to solution
02-11-2013 12:30 PM
Labels (1)
GeorgeFaraj
Occasional Contributor III
Is it possible to use the GenerateRendererTask to generate a ClassBreaksRenderer for a dynamic FeatureLayer? I posted my current code below. I get an exception when executing the renderer task ("Invalid or missing input parameters."). My featureLayer.Url is http://<my-mapservice-url>/dynamicLayer.

I found this similar post under the Flex forums: http://forums.arcgis.com/threads/69563-Dynamic-workspace-and-generate-renderer

The solution there specifically says that I must set the Source property of the GenerateRendererTask. There is no Source property in the WPF api.


GenerateRendererTask generateRendererTask = new GenerateRendererTask(featureLayer.Url);     GenerateRendererParameters generateRendererParameters = new GenerateRendererParameters();      ClassBreaksDefinition classification = new ClassBreaksDefinition();     classification.BreakCount = 10;     classification.ClassificationField = "prop_id";     classification.ClassificationMethod = ClassificationMethod.NaturalBreaks;      ColorRamp colorRamp = new ColorRamp();     colorRamp.Algorithm = Algorithm.LabLChAlgorithm;     colorRamp.From = Colors.Yellow;     colorRamp.To = Colors.Red;      List<ColorRamp> colorRamps = new List<ColorRamp>();     colorRamps.Add(colorRamp);      classification.ColorRamps = new ObservableCollection<ColorRamp>(colorRamps);      generateRendererParameters.ClassificationDefinition = classification;      GenerateRendererResult generateRendererResult = generateRendererTask.Execute(generateRendererParameters);     featureLayer.Renderer = generateRendererResult.Renderer as ClassBreaksRenderer;
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor
Hi,

You should find a Source property on the GenerateRendererParamaters class: http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.G....

Cheers

Mike

View solution in original post

0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

You should find a Source property on the GenerateRendererParamaters class: http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.G....

Cheers

Mike
0 Kudos
GeorgeFaraj
Occasional Contributor III
Works like a charm!

Thanks Mike
0 Kudos