Hi, I have a first cut of mapsui working in Avalonia here https://github.com/ahopper/Mapsui/tree/initial-avalonia-port . Are you interested in a PR for this?
Yes, that would be great. It will be some weeks before I can look at the PR. I might not publish it as nuget in 3.x.
I have not worked with avalonia myself but have seen it mentioned here and there. How do you use it? For what platforms? Do you contribute to avalonia?
Great, I'll tidy up the unfinished bits and then PR. I do contribute to Avalonia and use it for my own projects. It works on Linux, Windows and OSX and has experimental support for Android and iOS. It is now considered production ready and used by a number of significant projects.
My own interest in mapsui is for mapping received radio transmissions in my software defined radio app SparkSDR.
An alternative to full integration would be to package the skia renderer as netstandard so an external control could access it ( Avalonia apps can be built for netframework or netcore but the vast majority are netcore). Avalonia exposes a gpu accelerated skia environment so using the skia renderer was very easy, I may also try porting the wpf xaml renderer.
I tried it and it takes up the whole app window for rendering.
I am not sure how to resolve it.
Have you made any progress?
@ahopper Let me know if I can help.
@georgiuk I'm not sure I understand, the sample does just use the whole window, I've not tried it as part of a more complex layout. Do you have a example of what fails?
OK.
I thought it is usable as standard control inside a layout.
Using this
<Grid RowDefinitions="50,*" ColumnDefinitions="*">
<TextBlock Grid.Row="0" Text="Name" Margin="0,0,0,3" />
<map:MapControl Grid.Row="1" x:Name="map" Background="Transparent"/>
</Grid>
and you get this

I mean the text gets hidden.
Also in more complex layouts it's the same.
thanks, I'll work on that, my first guess is I've not set clipping properly
Just pushed a quick fix that works for your example here, I suspect I am not respecting high dpi stuff but it is early days.
I made something more complex
<Grid>
<TabControl>
<TabItem Header="Data" >
<TextBlock Text="Name" Margin="0,0,0,3" />
</TabItem>
<TabItem Header="Map" >
<Grid RowDefinitions="50,50,*">
<TextBlock Grid.Row="0" Text="Name" Margin="0,0,0,3" />
<Button Grid.Row="1">Test</Button>
<map:MapControl Grid.Row="2" x:Name="map" Background="Transparent"/>
</Grid>
</TabItem>
</TabControl>
</Grid>
Now it is clipped correctly. However when I click the second tab and loads the map, it seems that the map is on top of everything (even though the visible part is clipped) and so nothing is clickable (neither the first tab and the button).
Also when you resize the whole window it seems that the map bounds are moving even though the actual control bounds are not resizing. It seems that map is bound to the Window and not the actual parent control.
Also when you drag during outside of map bounds you can see the map panning... so the map gets all the events.
I believe this is caused by the hit testing here https://github.com/ahopper/Mapsui/blob/4be758dfda0b3852b03ea02327a218ee72274759/Mapsui.UI.Avalonia/MapControl.cs#L541 I need to get a better understanding of the custom skia rendering in Avalonia :)
@georgiuk Clicking outside the map should work now, I had not set the clipping on the control.
Great!
Seems to work now. Also resizing of window seems to work.
I'm sorry if that might be a dumb question - but can the currently published Mapsui 2.0 be used with Avalonia or do i have to use the fork of @ahopper ?
Thanks in advance for your help!
No, there isn't a native Avalonia MapControl from Mapsui beside the @ahopper implementation.
Ok, so i have to use the implementation of @ahopper .
Thanks for your quick reply!
Yes
Thanks! :)
@ahopper Why didn't Avalonia extension be pushed to mapsui?
@jinyuttt sorry it is partly lack of time on my behalf and partly due to Skia versioning as the two projects keep jumping in and out of sync and I'm not sure the of the best way to deal with this. Perhaps the upcoming 0.10 release of Avalonia is a good point to try and push this forward. I will not be offended if someone else forks this and takes it on :)
@ahopper What is the version 0.10 is aiming for?
@pauldendulk the current master is using 2.80.0 but this is a recent change and preview1 missed getting it and is still on 1.68.2. I'm pretty sure the 0.10 will get this or newer, I'll ask.
@ahopper It's 0.11 now, but I haven't seen skia.
Are there any news on this?
Is there anything we could help?
This looks interesting, what's the latest news on this one?
I'm really just waiting for the 0.10 Avalonia release, there was a period where the skiasharp version kept changing but this seems to have settled down.
That are awesome news. Let us know if we can help.
TADAAAA the big day arrived end of December, three weeks ago. I am very excited about this.
Avalonia 0.10 was released.
:) it was just released with the wrong date :)
Just wanted to ask if there are any news on this?
Is there something how we can help?
@ahopper any update on your side ? anything we can try to help you ?
Most helpful comment
I'm really just waiting for the 0.10 Avalonia release, there was a period where the skiasharp version kept changing but this seems to have settled down.