This is a migrated thread and some comments may be shown as answers.

[Solved] RadMap MapShapeStyleSelector

4 Answers 138 Views
Map for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Harshitha
Top achievements
Rank 1
Harshitha asked on 05 Feb 2014, 09:20 AM
Does MapShapeStyleSelector class data context be set to viewmodel (using MVVM architecture) by any ways? I had a requirement of this kind , so it will be helpful to know if it feasible or not (using any customized way). I tried my level best but everything went in vain... Please help me. 

4 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 05 Feb 2014, 04:54 PM
Hi Harshitha,

Thank you for contacting us.

The MapShapeStyleSelector.SelectStyleCore(...) method is called for every shape in a MapShapeLayer to set the shape's style. The MapShapeStyleSelector class does not have a data context property because its purpose is to be used by the specific MapShapeLayer to style its shapes.

From the provided information it is not very clear what is the scenario you are trying to achieve -- could you please provide more details about the final result you are looking for?

I look forward to your reply.

Regards,
Rositsa Topchiyska
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

0
Harshitha
Top achievements
Rank 1
answered on 06 Feb 2014, 07:07 AM
I have a custom behaviour class for SingleSelectionPerLayer behaviour. In that I have a hit test method implemented. My requirement is on click of a particular shape in the map, I want to colorize that map shape area selected based on a property present in my view model.
I treid implementiong SelectStyleCore(..) method in this custom behaviour class but falied to get the MapShapeStyleContext on click of the particular map shape. I also tried having custom class for Style selector but it allows to colorize shapes only during rendering the mapshape and not on particular selection behaviour. And as discussed above it does not allow datacontext to be set to my view model. (as based on that property value I want to set different color for that shape).
So it would be of great help, if you could suggest me anyways through which I can achieve my requirement.

Thanks in advance.
0
Rosy Topchiyska
Telerik team
answered on 06 Feb 2014, 04:39 PM
Hi Harshitha,

Thank you for the information.

The RadMap control provides functionality to set custom attributes to the map shapes. The shapes implement the IMapShape interface that defines the SetAttribute(...) method. You can subscribe to the ShapefileDataSource.ShapeProcessingCompleted event and set all the attributes you need after the shapes are loaded. To see an example, you can take a look at our demo application - Telerik Controls Examples (XAML) - Map - Colorization example (ShapefileDataSource_ShapeProcessingCompleted method in Map.Colorization.Example.xaml.cs file).

I hope this helps. Please, let us know if you have further questions.

Regards,
Rositsa Topchiyska
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

0
Harshitha
Top achievements
Rank 1
answered on 07 Feb 2014, 08:59 AM
Hi,

Thank you for the help. It did help me to a certain extent.

Regards,
Harshitha S
Tags
Map for XAML
Asked by
Harshitha
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Harshitha
Top achievements
Rank 1
Share this question
or