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

MouseEnter on FrameworkElements?

1 Answer 46 Views
Map
This is a migrated thread and some comments may be shown as answers.
Fredrik
Top achievements
Rank 1
Fredrik asked on 27 Sep 2010, 12:19 PM
Hello !!!

Our company is evaluating your products and we are having some problems.
I´m having a map with an emptyprovider and adding som Framework elements using an KmlReader to fill up som county regions in a country map.
What we are trying to achive is to highlight a county when a user is dragging the mouse over it.
I have tryied to use the FrameworkElements MouseEnter event that I have added when iterating thrue the kmlreader list but i cant get it triggered?
I have read different posts in this forum and the online help but with no success.

Can you please give me an example how to make this happen.

Regards

Fredrik

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 29 Sep 2010, 12:24 PM
Hi Fredrik,

The objects which returns by KmlReader.Read method are map shapes objects like to MapPlygon, MapPolyline etc. The MouseEnter event of map shapes is not the same as MouseEnter of the FrameworkElement class.
You should cast the framework element to the MapShape type before attaching a handler.
The sample code is below.
List<FrameworkElement> list = KmlReader.Read(stream);
foreach (FrameworkElement element in list)
{
    MapShape shape = element as MapShape;
    if (shape != null)
    {
        shape.MouseEnter += this.MouseEnter;
    }
    else
    {
        element.MouseEnter += this.MouseEnter;
    }
  
    this.informationLayer.Items.Add(element);
}

Greetings,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Map
Asked by
Fredrik
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or