User-defined symbol in ArcGIS API for Silverlight is called in C #

Source: Internet
Author: User

User-defined symbol in ArcGIS API for Silverlight is called in C #

1. Create the Help class, where the Application.loadcomponent parameter/tel.jsyd.fileimport;component/themes/symbol.xaml is the custom Symbol location

 Public classSymbolhelper {StaticSymbolhelper () {ResourceDictionary rd=NewResourceDictionary (); Application.loadcomponent (Rd,NewUri ("/tel.jsyd.fileimport;component/themes/symbol.xaml", urikind.relative));        Application.Current.Resources.MergedDictionaries.Add (RD); }         Public StaticSymbol Getcommonsymbol (stringkey) {            if(Application.Current.Resources.Contains (key)) {ObjectSymbol =Application.current.resources[key]; returnSymbol asSymbol; }            return NULL; }}
View Code

2. Custom symbol

 <ResourceDictionaryxmlns= "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:fillsymbolx:name= "Currentprojectsymbol"BorderBrush= "Green"borderthickness= "2">        <Esrisb:FillSymbol.Fill>            <SolidColorBrushColor= "Green"Opacity= "0" />        </Esrisb:FillSymbol.Fill>    </Esrisb:fillsymbol>    <Esrisb:fillsymbolx:key= "Currentprojectflickingsymbol">        <esrisb:FillSymbol.ControlTemplate>            <ControlTemplateXMLNS:VSM= "Clr-namespace:system.windows;assembly=system.windows">                <Grid>                    <vsm:VisualStateManager.VisualStateGroups>                        <Vsm:visualstategroupx:name= "CommonStates">                            <vsm:visualstatex:name= "MouseOver">                                <Storyboard>                                    <DoubleAnimationBeginTime= "0"Storyboard.TargetName= "Element"Storyboard.TargetProperty= "(shape.opacity)" to= "0.75"Duration= "00:00:01"RepeatBehavior= "Forever"/>                                </Storyboard>                            </vsm:visualstate>                            <vsm:visualstatex:name= "Normal">                                <Storyboard>                                    <DoubleAnimationBeginTime= "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>                    <Pathx:name= "Element"Fill= "Green"Opacity= "0.15"Stroke= "Green"strokethickness= "2"></Path>                </Grid>            </ControlTemplate>        </esrisb:FillSymbol.ControlTemplate>    </Esrisb:fillsymbol></ResourceDictionary>
View Code

Called in 3.c#

if (this. isplotcurrent)                 this. Plot.Graphic.Symbol = Symbolhelper.getcommonsymbol ("currentprojectsymbol");
View Code

User-defined symbol in ArcGIS API for Silverlight is called in C #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.