ArcGIS API For Silverlight 中 用户自定义Symbol在C#中调用
2020-12-13 14:36
标签:style blog http io color os ar for sp 1.创建帮助类,其中,Application.LoadComponent的参数/Tel.Jsyd.FileImport;component/Themes/Symbol.xaml,是自定义Symbol所在位置 2.自定义Symbol 3.C#中调用 ArcGIS API For Silverlight 中 用户自定义Symbol在C#中调用 标签:style blog http io color os ar for sp 原文地址:http://www.cnblogs.com/jmllc/p/4064450.htmlArcGIS API For Silverlight 中 用户自定义Symbol在C#中调用
public class SymbolHelper
{
static SymbolHelper()
{
ResourceDictionary rd = new ResourceDictionary();
Application.LoadComponent(rd, new Uri("/Tel.Jsyd.FileImport;component/Themes/Symbol.xaml", UriKind.Relative));
Application.Current.Resources.MergedDictionaries.Add(rd);
}
public static Symbol GetCommonSymbol(string key)
{
if (Application.Current.Resources.Contains(key))
{
object symbol = Application.Current.Resources[key];
return symbol as Symbol;
}
return null;
}
}
ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esrisb="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client">
esrisb:FillSymbol x:Name="CurrentProjectSymbol" BorderBrush="Green" BorderThickness="2">
esrisb:FillSymbol.Fill>
SolidColorBrush Color="Green" Opacity="0" />
esrisb:FillSymbol.Fill>
esrisb:FillSymbol>
esrisb:FillSymbol x:Key="CurrentProjectFlickingSymbol">
esrisb:FillSymbol.ControlTemplate>
ControlTemplate xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
Grid>
vsm:VisualStateManager.VisualStateGroups>
vsm:VisualStateGroup x:Name="CommonStates">
vsm:VisualState x:Name="MouseOver">
Storyboard>
DoubleAnimation BeginTime="0" Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.Opacity)" To="0.75" Duration="00:00:01" RepeatBehavior="Forever"/>
Storyboard>
vsm:VisualState>
vsm:VisualState x:Name="Normal">
Storyboard>
DoubleAnimation BeginTime="0" Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.Opacity)" To="0.75" Duration="00:00:02" RepeatBehavior="Forever"/>
Storyboard>
vsm:VisualState>
vsm:VisualStateGroup>
vsm:VisualStateManager.VisualStateGroups>
Path x:Name="Element" Fill="Green" Opacity="0.15" Stroke="Green" StrokeThickness="2">Path>
Grid>
ControlTemplate>
esrisb:FillSymbol.ControlTemplate>
esrisb:FillSymbol>
ResourceDictionary>
if (this.isPlotCurrent)
this.Plot.Graphic.Symbol = SymbolHelper.GetCommonSymbol("CurrentProjectSymbol");
下一篇:动态加载JS代码
文章标题:ArcGIS API For Silverlight 中 用户自定义Symbol在C#中调用
文章链接:http://soscw.com/essay/34261.html