<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Adding Graphic.Attributes in XAML in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712485#M18326</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to get away from querying a service and load stuff fast.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Nov 2010 18:54:09 GMT</pubDate>
    <dc:creator>DanielWalton</dc:creator>
    <dc:date>2010-11-11T18:54:09Z</dc:date>
    <item>
      <title>Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712479#M18320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to add graphics to my map in XAML using this syntax:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; [HTML]&amp;lt;esri:GraphicsLayer ID="Shapes"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:Graphic&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:Graphic.Attributes&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sys:String x:Key="Name"&amp;gt;Graphic 0&amp;lt;/sys:String&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:Graphic.Attributes&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:Graphic.Geometry&amp;gt;....&amp;lt;/esri:Graphic.Geometry&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:Graphic&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;/esri:GraphicsLayer&amp;gt;[/HTML]I get a runtime exception (I assume because Attributes is read-only). Is there a way to add attributes with XAML?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 15:22:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712479#M18320</guid>
      <dc:creator>DanielWalton</dc:creator>
      <dc:date>2010-11-11T15:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712480#M18321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are using SL4, the only way I could think of about doing this is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;TextBox&amp;nbsp; Width="50"&amp;nbsp; Text="{Binding [STATE_NAME], Mode=TwoWay}" DataContext="{Binding ElementName=MyMap, Path=Layers[MyGraphics].Graphics[0].Attributes}"/&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where MyMap is the name of my map, MyGraphics is the ID of my Layer, and Graphics[0] is expected to exist.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the sample, I placed breakpoint on MouseLeftButtonDown to inspect the Attributes. You can also do a MessageBox.Show() on e.Graphic.Attributes["STATE"] to see that it matches your TextBox. It's not a pretty solution because each TextBox would have to represent a field for one of the graphics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; &amp;lt;Grid x:Name="LayoutRoot" Background="White"&amp;gt;

&amp;nbsp; &amp;lt;Grid.Resources&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;esri:SimpleMarkerSymbol x:Key="RedMarkerSymbol" Color="Red" Size="12" Style="Circle" /&amp;gt;
&amp;nbsp; &amp;lt;/Grid.Resources&amp;gt;

&amp;nbsp; &amp;lt;esri:Map x:Name="MyMap" Background="White"&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer ID="PhysicalTiledLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/NPS_Physical_World_2D/MapServer"/&amp;gt;

&amp;nbsp;&amp;nbsp; &amp;lt;esri:GraphicsLayer ID="MyGraphics" MouseLeftButtonDown="GraphicsLayer_MouseLeftButtonDown"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:GraphicsLayer.Graphics &amp;gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:Graphic Symbol="{StaticResource RedMarkerSymbol}" &amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:MapPoint X="-140.9" Y="63.391" /&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:Graphic&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:GraphicsLayer.Graphics&amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/esri:GraphicsLayer&amp;gt;
&amp;nbsp; &amp;lt;/esri:Map&amp;gt;
&amp;nbsp; &amp;lt;StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" &amp;gt;
&amp;nbsp;&amp;nbsp; &amp;lt;TextBox&amp;nbsp; Width="50"&amp;nbsp; Text="{Binding [STATE_NAME], Mode=TwoWay}" DataContext="{Binding ElementName=MyMap, Path=Layers[MyGraphics].Graphics[0].Attributes}"/&amp;gt;
&amp;nbsp; &amp;lt;/StackPanel&amp;gt;
 
 &amp;lt;/Grid&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:31:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712480#M18321</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T06:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712481#M18322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My goal is to 'hard-code' some features with attributes into my app. I am generating the XAML dynamically from a FeatureService dataset, then when (if) I can get it working, I will remove the FeatureService and just have the graphics. If I can't add the attributes with XAML, is there a way to store JSON messages and trick the FeatureService into reading them when it loads?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 17:42:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712481#M18322</guid>
      <dc:creator>DanielWalton</dc:creator>
      <dc:date>2010-11-11T17:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712482#M18323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You don't want to update the attributes in code-behind? (i.e. graphic.Attributes["STATE"] = "California")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 18:15:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712482#M18323</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2010-11-11T18:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712483#M18324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No, this is just a one-off operation to capture the geometry and attributes of a certain set of features, then hard-code both into my app.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 18:18:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712483#M18324</guid>
      <dc:creator>DanielWalton</dc:creator>
      <dc:date>2010-11-11T18:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712484#M18325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I dont know if this would solve your problem but what you can do is query the FeatureService and in the QueryTask_ExecuteCompleted update a GraphicsCollection (In the sample-code below, use the same instance as MyGraphicCollection).&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 &amp;lt;Grid.Resources&amp;gt;
&amp;nbsp; &amp;lt;esri:GraphicCollection x:Key="MyGraphicCollection"/&amp;gt;
&amp;lt;!--more code goes here --&amp;gt;
 &amp;lt;/Grid.Resources&amp;gt;
&amp;lt;!--more code goes here --&amp;gt;
 &amp;lt;esri:GraphicsLayer ID="MyGraphicsLayer" 
&amp;nbsp;&amp;nbsp; Graphics="{Binding Source={StaticResource MyGraphicCollection}, Path=Graphics}" Renderer="{StaticResource MyRenderer}"/&amp;gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:31:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712484#M18325</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T06:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712485#M18326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to get away from querying a service and load stuff fast.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 18:54:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712485#M18326</guid>
      <dc:creator>DanielWalton</dc:creator>
      <dc:date>2010-11-11T18:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712486#M18327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One possible option is you to use an XML format to store graphics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You will find sample code to serialize/deserialize graphics here: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/8774-save-layer-to-xml-file"&gt;http://forums.arcgis.com/threads/8774-save-layer-to-xml-file&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Nov 2010 20:10:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712486#M18327</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2010-11-11T20:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Graphic.Attributes in XAML</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712487#M18328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perfect. Thanks Dominique!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 15:59:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-graphic-attributes-in-xaml/m-p/712487#M18328</guid>
      <dc:creator>DanielWalton</dc:creator>
      <dc:date>2010-11-12T15:59:14Z</dc:date>
    </item>
  </channel>
</rss>

