How can I provide custom data as DataProvider for ImageTilesLayer on mapControl in XAML file?

How can I provide custom data as DataProvider for ImageTilesLayer on mapControl in XAML file?

I am new to WPF and DevExpress. I have tried several examples provided on the DevExpress documentation site.

Reference: how to download graphic snippets from another source

In this example, how to load graphic snippets from another source specified in their site, the DataProvider for the ImageTilesLayer is assigned in code behind the file. Can I mention the same DataProvider in XAML instead of code behind the file?

+3


source to share


2 answers


You can assign the ImageTilesLayer.DataProvider property in XAML like this:

<dxc:MapControl>
    <dxc:ImageTilesLayer>
        <dxc:ImageTilesLayer.DataProvider>
            <local:CustomMapDataProvider/>
        </dxc:ImageTilesLayer.DataProvider>
    </dxc:ImageTilesLayer>
</dxc:MapControl>

      



PS
For more information on XAML property syntax, see XAML Overview (WPF) -> Property Element Syntax Article on MSDN. For more information on custom types in XAML, see XAML and Custom Classes for WPF .

+3


source


Coding Horror, I would suggest you read the DevExpress tutorials first. The link to the tutorials is given below.

https://documentation.devexpress.com/#WPF/CustomDocument10682

It explains the different levels of card management.

Once you read this, read how to download images from various sources https://documentation.devexpress.com/#wpf/CustomDocument11174



In the code, instead of specifying the URL, change it to the local images folder where you cached all the map tiles.

 public class CustomTileSource : MapTileSourceBase {
    const string roadUrlTemplate = 
        @"http://{subdomain}.tile.openstreetmap.org/{tileLevel}/{tileX}/{tileY}.png";

      

You can read more about caching https://documentation.devexpress.com/#WPF/CustomDocument12205

+1


source







All Articles