<UserControl x:Class="FeatureLayerBindingTest.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <esri:Map> <esri:Map.Layers> <esri:ArcGISTiledMapServiceLayer Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> <esri:FeatureLayer Url="{Binding FeatureLayerURL}"/> </esri:Map.Layers> </esri:Map> </Grid> </UserControl>
using System.Windows.Controls; using System.ComponentModel; namespace FeatureLayerBindingTest{ public partial class MainPage : UserControl{ public string FeatureLayerURL { get { return "http://okcgisprd200/ArcGIS/rest/services/Systems/Dynamic_UIM/MapServer/1"; } } public MainPage(){ InitializeComponent(); this.DataContext = this; } } }
But if I want to initialize my featurelayer's Url by binding to a Configued string, is there any solution? Because I want to use the xaml to personalize my featurelayer's maptips/cluster/...,I'm so lazy and donot want to code behind.I tried to build a dependencyproperty and bind url to that but it did not work,I just do not know why featurelayer's url cannot be binded or set before it's initializing event,any advice will be appreciated!!!
FeatureLayer.Url is a DependencyProperty which means you can bind to it. However, it cannot be updated once the layer is initialized.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.