MouseEnter on FrameworkElements?

2 posts, 0 answers
  1. Fredrik
    Fredrik avatar
    54 posts
    Member since:
    Sep 2010

    Posted 27 Sep 2010 Link to this post

    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.


  2. Andrey
    Andrey avatar
    1681 posts

    Posted 29 Sep 2010 Link to this post

    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;
            element.MouseEnter += this.MouseEnter;

    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
  3. DevCraft banner
Back to Top