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

How do I refresh a custom provider?

3 Answers 186 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jason D
Top achievements
Rank 1
Veteran
Jason D asked on 15 Apr 2011, 03:35 PM
When my data changes, is there a way to force a refresh of a TiledProvider or TiledMapSource, short of removing the provider and adding it again?

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 20 Apr 2011, 09:57 AM
Hi Jason,

I think this is the correct way, but you can just reassign the provider instead of removing it and adding it again. The sample code is below.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
    Dim loVedaProvider As New VedaProvider
    RadMap1.Providers.Item(1) = loVedaProvider
End Sub

The alternative is to invalidate tiles which are returned from the GetTile method using the InvalidateTileLayer method of the Tiled Map Source. Its implementation is more difficult and it will take more time than the above approach, because the InvalidateTileLayer method should be called for each tile.

Best wishes,
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
0
Jason D
Top achievements
Rank 1
Veteran
answered on 08 Aug 2011, 05:17 PM
I've tried re-assigning the layer a couple of times now, but with no success. It would be really nice to have a method to force a provider to refresh. For example, I found a bug (ticket coming later), where the provider wasn't being drawn. They only way I found to force it to redraw was by doing something that caused the layout to change:

moMap.Margin = New Windows.Thickness(1)
moMap.UpdateLayout()
moMap.Margin = New Windows.Thickness(0)
0
Andrey
Telerik team
answered on 10 Aug 2011, 04:17 PM
Hi Jason,

Thank you for the feedback. We have created a PITS issue to fix the problem. You can track it using the following link:
http://www.telerik.com/support/pits.aspx#/public/wpf/7298

The map should be drawn automatically. As a workaround you can change the Center property of RadMap to re-draw the map. The sample code is below.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
    Dim loVedaProvider As New VedaProvider
    RadMap1.Providers.Add(loVedaProvider)
 
    Dim center As Location = RadMap1.Center
    RadMap1.Center = New Location(0, 0)
    RadMap1.Center = center
End Sub


Best wishes,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
Map
Asked by
Jason D
Top achievements
Rank 1
Veteran
Answers by
Andrey
Telerik team
Jason D
Top achievements
Rank 1
Veteran
Share this question
or