Note: This API is now obsolete. Please use the ScaleLine control in the ESRI.ArcGIS.Client.Toolkit namespace.
Gets or sets the Map Control that the ScaleBar Control is associated with.
XAML | Copy Code |
---|---|
<esri:ScaleBar Name="ScaleBar1" Map="{Binding ElementName=Map1}" /> |
C# | Copy Code |
---|---|
//Create a new ScaleBar Control and add it to the LayoutRoot (a Grid in the XAML) ESRI.ArcGIS.Client.ScaleBar ScaleBar1 = new ESRI.ArcGIS.Client.ScaleBar(); LayoutRoot.Children.Add(ScaleBar1); //Associate the ScaleBar with Map Control ScaleBar1.Map = Map1; |
VB.NET | Copy Code |
---|---|
'Create a new ScaleBar Control and add it to the LayoutRoot (a Grid in the XAML) Dim ScaleBar1 As New ESRI.ArcGIS.Client.ScaleBar LayoutRoot.Children.Add(ScaleBar1) 'Associate the ScaleBar with Map Control ScaleBar1.Map = Map1 |
It is required that the ScaleBar Control be associated with a Map Control in order to display in an application. If the ScaleBar.Map Property is not set correctly, the application may compile but the ScaleBar will not be visible. The ScaleBar.Map property can be set in XAML or the code-behind files.
For most circumstances setting the Map property is all that is needed to perform a OneTime bind between the Map and ScaleBar Controls. This OneTime binding will make it so that as the Map's extent is changed, the ScaleBar will adjust accordingly. If more granular control is needed to have a Property on the ScaleBar Control change dynamically, it is possible to use traditional binding in the code-behind via the MapProperty.
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family