Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

ColorMeasureScale_PrepareCompleted fires before PreviewReadShapesCompleted and doesn't recognize changes to ExtendedData values

$
0
0

A simple problem .. I need to insert an ExtendedData  property dynamically during runtime based on a user selection.  (Or, I could hack it and change the value of an existing extended property - I don't really care at this point).    I tried added the new property in the PreviewReadShapesCompleted event, but the colorizer doesn't recognize it.  Even if I change an existing ExtendedData property's value, the colorizer does not reset it's range. 

Is there some way to refresh the colorizer?  I've tried setting a MinValue and MaxValue and binding the colorizer's Min and Max values to them but that doesn't work either.

For example, using the sample from WPF SDK for InformationLayerColorizerModeCount (world.shp/world.dbf) , I change the value of the "SQKM" property in the InformationLayerColorizerModeCount event by dividing it by 10.  When the map shows,  all countries are pretty much the same color.  If I divide it by 5, there is more variation in color, but not as much.  If I multiply it by 10, than all countries are dark with little or no variation. 

 Debugging shows me that ColorMeasureScale_PrepareCompleted fires before the PreviewReadShapesCompleted event and apparently sets it range of values from the original DBF values.

I tried to read the shape files in manually ( http://docs.telerik.com/devtools/wpf/controls/radmap/features/information-layer/shapefiles-support)  )  , modify the stream, and pass that into the  ShapeReader, but the "shapes" do not contain an ExtendedPropertySet so I can't manipulate the values. 

 

StreamResourceInfo shapeResourceInfo = Application.GetResourceStream(new Uri("/InformationLayerColorizerModeCount;component/Resources/world.shp", UriKind.RelativeOrAbsolute));
StreamResourceInfo dbfResourceInfo = Application.GetResourceStream(new Uri("/InformationLayerColorizerModeCount;component/Resources/world.dbf", UriKind.RelativeOrAbsolute));
Telerik.Windows.Controls.Map.ExtendedPropertySet extData = new ExtendedPropertySet();
List<FrameworkElement> shapes = new List<FrameworkElement>();
var x = ShapeFileReader.Read(shapeResourceInfo.Stream, dbfResourceInfo.Stream);
foreach (var shape in shapes)
{
    this.informationLayer.Items.Add(shape);
}

 In the foreach loop, I want to grab a value from my  model for the specific country, and then either change the value of an existing ExtendedData or create a new one, but the "shape" instance does not have any property that allows me to do this despite the fact that I included the DBF file in the Read method. 

Maybe I should use a different technique altogether ?   It seems that this requirement would be quite common, i.e. user picks a variable, program colorizes the map according to that variable.  What am I missing ? 

Thanks


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>