-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to cast object of type 'GMap.NET.WindowsPresentation.GMapImage' to type 'GMap.NET.WindowsForms.GMapImage' #153
Comments
Why do you use winform version in wpf project? |
To promote code reuse, I want to reuse some of my legacy winform components in my (new) WPF projects. So it just happens that those legacy winform contains winform greatmaps.net. This is actually a pretty common scenario, and it's something that Microsoft supports formally via WindowsFormsHost |
Ok, but there is wpf version of gmaps https://github.com/radioman/greatmaps/tree/master/GMap.NET.WindowsPresentation |
...anyway, if you'd remove the reference of GMap.NET.WindowsPresentation and dll itself, it should work |
My use case is that I need to use both the WPF and winform version in my
application. For old work I have no choice but to use the winform
component, but for new work I want to use Wpf as the main app is WPF .
But it seems that WPF and Winform greatmaps.net has a problem coexist.
Thinking of fixing it ?
…On Tue, 3 Dec 2019 at 9:28 PM, radioman ***@***.***> wrote:
...anyway, if you'd remove the reference of GMap.NET.WindowsPresentation
and dll itself, it should work
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#153?email_source=notifications&email_token=ADENIZRMC7WI4GWN4MNXKZLQWZNJJA5CNFSM4JSA2KB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFZL2UQ#issuecomment-561167698>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADENIZSLDBLEMXKZPFMB2CDQWZNJJANCNFSM4JSA2KBQ>
.
|
I am also having this problem. |
Here's the code to illustrate the problem:
The 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 correctGMapImage
depending on whether it is WPF or WinForm control, however, at this point, it seems that the wrongGMapImage
is loaded into theGMapControl.
An
InvalidCastException
is thrown becauseIn the above code sample, the WPF version of the
GMapImage
is loaded into WinformGMapControl
, and hence it causes exception.Any ideas how to workaround, or any fixes for this?
The text was updated successfully, but these errors were encountered: