{"action":"created","issue":{"url":"https://api.github.com/repos/radioman/greatmaps/issues/153","repository_url":"https://api.github.com/repos/radioman/greatmaps","labels_url":"https://api.github.com/repos/radioman/greatmaps/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/radioman/greatmaps/issues/153/comments","events_url":"https://api.github.com/repos/radioman/greatmaps/issues/153/events","html_url":"https://github.com/radioman/greatmaps/issues/153","id":529092680,"node_id":"MDU6SXNzdWU1MjkwOTI2ODA=","number":153,"title":" Unable to cast object of type 'GMap.NET.WindowsPresentation.GMapImage' to type 'GMap.NET.WindowsForms.GMapImage'","user":{"login":"WindingWinter","id":13161574,"node_id":"MDQ6VXNlcjEzMTYxNTc0","avatar_url":"https://avatars3.githubusercontent.com/u/13161574?v=4","gravatar_id":"","url":"https://api.github.com/users/WindingWinter","html_url":"https://github.com/WindingWinter","followers_url":"https://api.github.com/users/WindingWinter/followers","following_url":"https://api.github.com/users/WindingWinter/following{/other_user}","gists_url":"https://api.github.com/users/WindingWinter/gists{/gist_id}","starred_url":"https://api.github.com/users/WindingWinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WindingWinter/subscriptions","organizations_url":"https://api.github.com/users/WindingWinter/orgs","repos_url":"https://api.github.com/users/WindingWinter/repos","events_url":"https://api.github.com/users/WindingWinter/events{/privacy}","received_events_url":"https://api.github.com/users/WindingWinter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-11-27T03:30:28Z","updated_at":"2019-12-03T13:21:31Z","closed_at":null,"author_association":"NONE","body":"Here's the code to illustrate the problem:\r\n\r\n```\r\n   public  class GMapWPFControl: GMap.NET.WindowsPresentation.GMapControl\r\n    {\r\n        public GMapWPFControl()\r\n        {\r\n            MapProvider = GMapProviders.GoogleTerrainMap;\r\n        }\r\n    }\r\n\r\n\r\n    public class GMapWinFormControl: WindowsFormsHost\r\n    {\r\n\r\n        private GMapControl _mapControl;\r\n\r\n        public GMapWinFormControl()\r\n        {\r\n            _mapControl = new GMap.NET.WindowsForms.GMapControl();\r\n            _mapControl.MapProvider = GMapProviders.GoogleTerrainMap;\r\n            Child = _mapControl;\r\n        }\r\n    }\r\n\r\n\r\n<Window\r\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\r\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\r\n        xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\r\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\r\n        xmlns:local=\"clr-namespace:tabcontrolgrey\"\r\n        x:Class=\"tabcontrolgrey.MainWindow\"\r\n        mc:Ignorable=\"d\"\r\n        Title=\"MainWindow\" Height=\"350\" Width=\"525\">\r\n\r\n    <TabControl>\r\n        <TabItem Header=\"Winform\">\r\n            <local:GMapWinFormControl />\r\n        </TabItem>\r\n\r\n        <TabItem Header=\"WPF\">\r\n         <local:GMapWPFControl />\r\n        </TabItem>\r\n    </TabControl>\r\n\r\n</Window>\r\n```\r\nThe problem occurs when the program is launched, and both Winform and WPF of GmapControl will be loaded, so for `Tile.Overlays`, it should return the correct `GMapImage` depending on whether it is WPF or WinForm control, however, at this point, it seems that the wrong `GMapImage` is loaded into the `GMapControl.`\r\n\r\nAn `InvalidCastException` is thrown because \r\n\r\n> Unable to cast object of type 'GMap.NET.WindowsPresentation.GMapImage' to type 'GMap.NET.WindowsForms.GMapImage'.\r\n\r\n\r\n![invalidcastexception](https://user-images.githubusercontent.com/13161574/69691269-87444e80-1109-11ea-8612-1c0d5f38e9b8.png)\r\n\r\n\r\nIn the above code sample, the WPF version of the `GMapImage` is loaded into Winform `GMapControl`, and hence it causes exception. \r\n\r\nAny ideas how to workaround, or any fixes for this?"},"comment":{"url":"https://api.github.com/repos/radioman/greatmaps/issues/comments/561163802","html_url":"https://github.com/radioman/greatmaps/issues/153#issuecomment-561163802","issue_url":"https://api.github.com/repos/radioman/greatmaps/issues/153","id":561163802,"node_id":"MDEyOklzc3VlQ29tbWVudDU2MTE2MzgwMg==","user":{"login":"radioman","id":709019,"node_id":"MDQ6VXNlcjcwOTAxOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/709019?v=4","gravatar_id":"","url":"https://api.github.com/users/radioman","html_url":"https://github.com/radioman","followers_url":"https://api.github.com/users/radioman/followers","following_url":"https://api.github.com/users/radioman/following{/other_user}","gists_url":"https://api.github.com/users/radioman/gists{/gist_id}","starred_url":"https://api.github.com/users/radioman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radioman/subscriptions","organizations_url":"https://api.github.com/users/radioman/orgs","repos_url":"https://api.github.com/users/radioman/repos","events_url":"https://api.github.com/users/radioman/events{/privacy}","received_events_url":"https://api.github.com/users/radioman/received_events","type":"User","site_admin":false},"created_at":"2019-12-03T13:21:31Z","updated_at":"2019-12-03T13:21:31Z","author_association":"OWNER","body":"Ok, but there is wpf version of gmaps https://github.com/radioman/greatmaps/tree/master/GMap.NET.WindowsPresentation"}}
{"actor":{"display_login":"radioman"}}