xmlns:local="clr-namespace:Sprint20" xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <esri:Envelope x:Key="MyEnvelope" XMin="-117" YMin="34" XMax="-117" YMax="34"/> <local:MyUIElements x:Key="MyElementLayerChildren"> <!--Clickable button--> <Button x:Name="RedlandsButton" Width="20" Height="20" Content="X" esri:ElementLayer.Envelope="{StaticResource MyEnvelope}" VerticalAlignment="Center" HorizontalAlignment="Center" /> <!--Arrow pointing at Copenhagen from the right--> <TextBlock Text="<=" HorizontalAlignment="Right" FontSize="15" Foreground="Blue" FontWeight="Bold" esri:ElementLayer.Envelope="12.5698,55.6765,12.5698,55.6765" /> <!--Arrow pointing at Copenhagen from the left--> <TextBlock Text="=>" HorizontalAlignment="Left" FontSize="15" Foreground="Blue" FontWeight="Bold" esri:ElementLayer.Envelope="12.5698,55.6765,12.5698,55.6765" /> <!-- Red box - No size specified. Envelope guides the size --> <Rectangle Fill="Red" esri:ElementLayer.Envelope="0,0,10,10" /> <!--Editable textbox--> <TextBox Width="100" Height="20" esri:ElementLayer.Envelope="40,0,40,0" Text="Editable text" HorizontalAlignment="Right" VerticalAlignment="Bottom" /> </local:MyUIElements> </Grid.Resources> <esri:Map x:Name="MyMap"> <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer"/> <esri:ElementLayer Children="{Binding Source={StaticResource MyElementLayerChildren}}"/> </esri:Map> </Grid>
public class MyUIElements : ObservableCollection<UIElement> { public MyUIElements() { } }
ElementLayer.Envelope is an Attached property and therefore support binding. It expects value of type Envelope. You can try the following code:
<DataTemplate x:Name="example1"> <Border BorderBrush="AliceBlue" BorderThickness="2" esri:ElementLayer.Envelope="{Binding _envelope}" Background="AliceBlue" /> </DataTemplate> <esri:Map x:Name="Map"> <esri:ArcGISTiledMapServiceLayer ID="BaseLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" /> <esri:ElementLayer> <esri:ElementLayer.Children> <ItemsControl ItemTemplate="{StaticResource example1}" ItemsSource="{Binding Path=_BordersforDisplay, Mode=OneWay}" /> </esri:ElementLayer.Children> </esri:ElementLayer> </esri:Map>
public ObservableCollection<BorderItems> _BordersforDisplay = new ObservableCollection<BorderItems>(); public class BorderItems { public string _name { get; set; } public Envelope _envelope { get; set; } }
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <esri:Envelope x:Key="MyEnvelope" XMin="-117" YMin="34" XMax="-117" YMax="34"/> </Grid.Resources> <esri:Map x:Name="MyMap"> <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer"/> <esri:ElementLayer> <esri:ElementLayer.Children> <!--Clickable button--> <Button x:Name="RedlandsButton" Width="20" Height="20" Content="X" esri:ElementLayer.Envelope="{Binding Source={StaticResource MyEnvelope}}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </esri:ElementLayer.Children> </esri:ElementLayer> </esri:Map> </Grid>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.