<?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: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536013#M13740</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="plain" name="code"&gt; &amp;lt;esri:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" AutoGeneratingColumn="MyDataGrid_AutoGeneratingColumn" &amp;nbsp;&amp;nbsp;&amp;nbsp; Map="{Binding ElementName=MyMap}" &amp;nbsp;&amp;nbsp;&amp;nbsp; GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[California]}" /&amp;gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private void MyDataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) {&amp;nbsp; switch (e.PropertyName)&amp;nbsp; { &amp;nbsp; case "OBJECTID": &amp;nbsp; case "AREA": &amp;nbsp; e.Column.Visibility = Visibility.Collapsed; &amp;nbsp; break;&amp;nbsp; } }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just wire up the AutoGeneratingColumn event and when each column gets created check the e.PropertyName for the attribute name you don't want then hide the column.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Feb 2012 22:18:49 GMT</pubDate>
    <dc:creator>ChristopherHill</dc:creator>
    <dc:date>2012-02-03T22:18:49Z</dc:date>
    <item>
      <title>How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536006#M13733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is my situation: I can set the binding of FeatureDataGrid to a GraphicsLayer but I don't want to show all the fields from the GraphicsLayer, I'm wondering if there is a way I can control which columns (fields) to display in the FeatureDataGrid. The easiest way may be specifying the OutFields in a query; but it is not the option for my case since I need the query includes some fields not necessary needed in the FeatureDataGrid. Is it possible? Either XAML or code-behind doesn't matter. Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2012 20:49:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536006#M13733</guid>
      <dc:creator>JianChen</dc:creator>
      <dc:date>2012-01-30T20:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536007#M13734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are using GraphicsLayer, FeatureDataGrid.Columns will be generated based on GraphicsLayer.Graphics.Attributes. If you want Query results to exclude some fields, then don't add them to your GraphicsLayer.Graphics.Attributes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var f in args.FeatureSet.Features)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var g = new Graphic() { Geometry = Geometry.Clone(f.Geometry) };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var a in f.Attributes)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(a.Key != "FieldToExclude")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.Attributes[a.Key] = a.Value;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l.Graphics.Add(g);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:16:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536007#M13734</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-11T23:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536008#M13735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you are using GraphicsLayer, FeatureDataGrid.Columns will be generated based on GraphicsLayer.Graphics.Attributes. If you want Query results to exclude some fields, then don't add them to your GraphicsLayer.Graphics.Attributes.&lt;BR /&gt;&lt;BR /&gt;Something like this:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var f in args.FeatureSet.Features)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var g = new Graphic() { Geometry = Geometry.Clone(f.Geometry) };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var a in f.Attributes)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(a.Key != "FieldToExclude")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.Attributes[a.Key] = a.Value;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l.Graphics.Add(g);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; Hey Jennifer, thanks for your reply! But what I need is select less fields to display in FeatureDataGrid than those retained in the GraphicsLayer.Graphics.Attributes (a result from a query). For example, I may chose all fields return by a query but just display a very few in the FeatureDataGrid. Is this possible? Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:16:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536008#M13735</guid>
      <dc:creator>JianChen</dc:creator>
      <dc:date>2021-12-11T23:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536009#M13736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;up, up, up...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 12:15:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536009#M13736</guid>
      <dc:creator>JianChen</dc:creator>
      <dc:date>2012-02-03T12:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536010#M13737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To answer your question, since FDG.Columns is dependent on GraphicsLayer.Graphics.Attributes, you should not add all fields returned by query to your graphic.Attributes. There could be more fields you can exclude here. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively, simply use query.OutFields to show only fields you want returned in the FDG.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var f in args.FeatureSet.Features)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var g = new Graphic() { Geometry = Geometry.Clone(f.Geometry) };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var a in f.Attributes)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(a.Key != "FieldToExclude")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.Attributes[a.Key] = a.Value;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l.Graphics.Add(g);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:35:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536010#M13737</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T16:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536011#M13738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; To answer your question, since&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;FDG.Columns is dependent on GraphicsLayer.Graphics.Attributes&lt;/SPAN&gt;, you should not add all fields returned by query to your graphic.Attributes. There could be more fields you can exclude here.&amp;nbsp;&amp;nbsp; &lt;BR /&gt;Alternatively, simply use query.OutFields to show only fields you want returned in the FDG.&amp;nbsp; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var f in args.FeatureSet.Features)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var g = new Graphic() { Geometry = Geometry.Clone(f.Geometry) };
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var a in f.Attributes)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;if(a.Key != "FieldToExclude")&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.Attributes[a.Key] = a.Value;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l.Graphics.Add(g);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Jennifer! But I'm not sure we are talking about the same thing. I think your code is about how to select fields to GraphicsLayer. You can use either graphic.Attributes or more simply use OutFields of a query. I'm fine with whatever fields being selected to GraphicsLayer. What I want to do is just display a subset of fields available in GraphicsLayer to FeatureDataGrid. In another world, there are some fields are valuable to be returned by the GraphicsLayer, but I may not want to show them in the FeatureDataGrid. For example, I may have fields like [ID], [Project_Name], [Source_File], [Link] in the GraphicsLayer but I just want to display [Project_Name] and [Source_File] fields in FeatureDataGrid (of course, the FeatureDataGrid is binding with the GraphicsLayer); is it possible? I need keep the [Link] field in the GraphicsLayer to make a HyperlinkButton but I do not want to display it in FeatureDataGrid. What do you think? Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536011#M13738</guid>
      <dc:creator>JianChen</dc:creator>
      <dc:date>2021-12-11T23:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536012#M13739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think we are talking about the same thing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; You want your query to show all fields, I get that. For this reason, you don't want to limit query.OutFields. So the results that are returned will be everything. Since FDG is bound to a GraphicsLayer and determines its columns based on Graphics.Attributes, what you control is what you add to graphic.Attributes. If you need to access other fields that you did not want displayed in FDG, maybe you can use another GraphicCollection to save FeatureSet.Features.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 20:25:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536012#M13739</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2012-02-03T20:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536013#M13740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="plain" name="code"&gt; &amp;lt;esri:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" AutoGeneratingColumn="MyDataGrid_AutoGeneratingColumn" &amp;nbsp;&amp;nbsp;&amp;nbsp; Map="{Binding ElementName=MyMap}" &amp;nbsp;&amp;nbsp;&amp;nbsp; GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[California]}" /&amp;gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private void MyDataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) {&amp;nbsp; switch (e.PropertyName)&amp;nbsp; { &amp;nbsp; case "OBJECTID": &amp;nbsp; case "AREA": &amp;nbsp; e.Column.Visibility = Visibility.Collapsed; &amp;nbsp; break;&amp;nbsp; } }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just wire up the AutoGeneratingColumn event and when each column gets created check the e.PropertyName for the attribute name you don't want then hide the column.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 22:18:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536013#M13740</guid>
      <dc:creator>ChristopherHill</dc:creator>
      <dc:date>2012-02-03T22:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind selected columns to a FeatureDataGrid from a GraphicsLayer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536014#M13741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 &amp;lt;esri:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" &lt;STRONG&gt;AutoGeneratingColumn="MyDataGrid_AutoGeneratingColumn"&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Map="{Binding ElementName=MyMap}"
&amp;nbsp;&amp;nbsp;&amp;nbsp; GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[California]}" /&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
private void MyDataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
 switch (e.PropertyName)
 {
&amp;nbsp; case "OBJECTID":
&amp;nbsp; case "AREA":
&amp;nbsp; e.Column.Visibility = Visibility.Collapsed;
&amp;nbsp; break;
 }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Just wire up the AutoGeneratingColumn event and when each column gets created check the e.PropertyName for the attribute name you don't want then hide the column.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Chris! This is exactly what I'm looking for!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:17:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-bind-selected-columns-to-a-featuredatagrid/m-p/536014#M13741</guid>
      <dc:creator>JianChen</dc:creator>
      <dc:date>2021-12-11T23:17:03Z</dc:date>
    </item>
  </channel>
</rss>

