How do I refresh a custom provider?

4 posts, 0 answers
  1. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 15 Apr 2011 Link to this post

    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?
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 20 Apr 2011 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jason D
    Jason D avatar
    72 posts
    Member since:
    Jan 2011

    Posted 08 Aug 2011 Link to this post

    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)
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 10 Aug 2011 Link to this post

    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 >>

Back to Top