你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
问题
文章
话题
登录
注册
Howto: 使用templates修改legend控件的颜色和字体
文章编号 :
38761
软件:
ArcGIS API for Microsoft Silverlight/WPF 10
操作系统:
N/A
1 个回复
易智瑞技术支持
赞同来自:
摘要:
Legend控件是在ArcGIS API for Microsoft Silverlight/WPF 2.1新增的控件,在ESRI.ArcGIS.Client.Toolkit动态库下。Legend控件显示了地图中图层和符号的内容。
Legend控件可以通过修改template进行客户化,包括颜色和字体。
内容:
下面的步骤演示了怎样修改颜色和字体。
1 Code in Xaml: <UserControl x:Class="ArcGISSilverlightSDK.MainPage"
xmlns="
http://schemas.microsoft.com/w ... ot%3B
xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="
http://schemas.esri.com/arcgis ... gt%3B
<Grid x:Name="LayoutRoot" >
<esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000">
<esri:ArcGISTiledMapServiceLayer ID="Street Map"
Url="
http://services.arcgisonline.c ... gt%3B
<esri:ArcGISDynamicMapServiceLayer ID="United States" Opacity="0.6"
Url="
http://sampleserver1.arcgisonl ... gt%3B
<esri:FeatureLayer ID="Points of Interest"
Url="
http://sampleserver3.arcgisonl ... ot%3B
/>
</esri:Map>
<Border Background="#77919191" BorderThickness="1" CornerRadius="5"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="20" Padding="5" BorderBrush="Black" >
<!--Legend control-->
<esri:Legend Map="{Binding ElementName=MyMap}"
LayerIDs="Points of Interest,United States"
LayerItemsMode="Tree"
Background="Black">
<!--Style of layer-->
<esri:Legend.MapLayerTemplate>
<DataTemplate>
<ContentControl Content="{Binding Label}"
FontFamily="Times New Roman"
FontWeight="Bold"
FontSize="20"
Foreground="Red">
</ContentControl>
</DataTemplate>
</esri:Legend.MapLayerTemplate>
<!--Style of sub layer-->
<esri:Legend.LayerTemplate>
<DataTemplate>
<ContentControl Content="{Binding Label}"
FontFamily="Verdana"
FontWeight="Bold"
FontSize="16"
Foreground="Yellow">
</ContentControl>
</DataTemplate>
</esri:Legend.LayerTemplate>
<!--Style of legend item-->
<esri:Legend.LegendItemTemplate >
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImageSource}"></Image>
<ContentControl Content="{Binding Label}"
FontFamily="Arial Black"
FontSize="12"
FontStyle="Italic"
Foreground="White">
</ContentControl>
</StackPanel>
</DataTemplate>
</esri:Legend.LegendItemTemplate>
</esri:Legend>
</Border>
</Grid>
</UserControl>
Code behind C#:
using System.Windows.Controls;
namespace ArcGISSilverlightSDK
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}
2 结果
创建时间:2011-03-18
最近更新: 2011-04-01
【
原文链接
】
http://support.esrichina.com.c ... .html
要回复问题请先
登录
或
注册
发起人
易智瑞技术支持
相关问题
如何优雅的使用ArcGIS知乎?
苹果系统下可以使用arcgis 吗?
Arcgis的地位不可撼动,那有必要掌握使用其他GIS软件吗
请问arcmap如何使用多线程?
在Visual studio 2015 中使用 Arcgis API for JavaScript v3.16 如何实现代码智能提示?
arcgis runtime for andriod 100.1 如何使用eclipse开发
如何使用脚本或其他方法,将图层属性中属性域原值内容替换为属性域描述?
使用ArcGIS Desktop10.2版本,如何设置图例横着放且label在正下方?
为什么arcgis runtime for .net去掉了很多在WPF中存在的基本地图控件?
请问一下,有使用Indoors的大佬么,可以分享一下怎么下载的么
ArcGIS API for js 4.0 BUG (四)官网Legend->layerInfos->title无效
问题状态
最新活动:
2015-12-01 22:29
浏览:
2228
关注:
1
人
1 个回复
易智瑞技术支持
赞同来自:
Legend控件可以通过修改template进行客户化,包括颜色和字体。
内容:
下面的步骤演示了怎样修改颜色和字体。
1 Code in Xaml: <UserControl x:Class="ArcGISSilverlightSDK.MainPage"
xmlns="http://schemas.microsoft.com/w ... ot%3B
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="http://schemas.esri.com/arcgis ... gt%3B
<Grid x:Name="LayoutRoot" >
<esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000">
<esri:ArcGISTiledMapServiceLayer ID="Street Map"
Url="http://services.arcgisonline.c ... gt%3B
<esri:ArcGISDynamicMapServiceLayer ID="United States" Opacity="0.6"
Url="http://sampleserver1.arcgisonl ... gt%3B
<esri:FeatureLayer ID="Points of Interest"
Url="http://sampleserver3.arcgisonl ... ot%3B />
</esri:Map>
<Border Background="#77919191" BorderThickness="1" CornerRadius="5"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="20" Padding="5" BorderBrush="Black" >
<!--Legend control-->
<esri:Legend Map="{Binding ElementName=MyMap}"
LayerIDs="Points of Interest,United States"
LayerItemsMode="Tree"
Background="Black">
<!--Style of layer-->
<esri:Legend.MapLayerTemplate>
<DataTemplate>
<ContentControl Content="{Binding Label}"
FontFamily="Times New Roman"
FontWeight="Bold"
FontSize="20"
Foreground="Red">
</ContentControl>
</DataTemplate>
</esri:Legend.MapLayerTemplate>
<!--Style of sub layer-->
<esri:Legend.LayerTemplate>
<DataTemplate>
<ContentControl Content="{Binding Label}"
FontFamily="Verdana"
FontWeight="Bold"
FontSize="16"
Foreground="Yellow">
</ContentControl>
</DataTemplate>
</esri:Legend.LayerTemplate>
<!--Style of legend item-->
<esri:Legend.LegendItemTemplate >
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImageSource}"></Image>
<ContentControl Content="{Binding Label}"
FontFamily="Arial Black"
FontSize="12"
FontStyle="Italic"
Foreground="White">
</ContentControl>
</StackPanel>
</DataTemplate>
</esri:Legend.LegendItemTemplate>
</esri:Legend>
</Border>
</Grid>
</UserControl>
Code behind C#:
using System.Windows.Controls;
namespace ArcGISSilverlightSDK
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}
2 结果
创建时间:2011-03-18
最近更新: 2011-04-01
【原文链接】
http://support.esrichina.com.c ... .html
要回复问题请先登录或注册