<?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: Syntax to set FeatureLayer outfields in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10814#M214</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for sharing us this use case. We are considering on accommodating it in future versions of our API. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, FeatureDataForm does not update its layout when layer OutFields parameter changes. Current workaround is to set the FeatureLayer OutFields before setting FeatureDataForm's FeatureLayer property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 featureLayer.OutFields = new OutFields() { "address" }; //update to OutFields ("*" or subset of fields)
 MyFeatureDataForm.FeatureLayer = featureLayer;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 20:27:36 GMT</pubDate>
    <dc:creator>JenniferNery</dc:creator>
    <dc:date>2021-12-10T20:27:36Z</dc:date>
    <item>
      <title>Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10807#M207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can someone clue me in on how to set FeatureLayer outfields programmatically? Something like&lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp; FeatureLayer featureLayer = sender as FeatureLayer;
&amp;nbsp;&amp;nbsp; featureLayer.OutFields = "*" ; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 13:44:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10807#M207</guid>
      <dc:creator>DonFreeman</dc:creator>
      <dc:date>2011-02-14T13:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10808#M208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The following are acceptable syntax for setting OutFields in code-behind, you can use one or the other as long as OutFields was not previously set to null.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
FeatureLayer l = new FeatureLayer() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/MapServer/0" };
l.OutFields = new OutFields() { "incident_number", "description" }; //1- new instance with field names
l.OutFields.Add("*");//or 2- add field name or '*' to existing instance
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:27:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10808#M208</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-10T20:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10809#M209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jenn - &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was close to that but just couldn't quite get there. Now I have &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; private void AllAvailableFeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs args)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; FeatureLayer featureLayer = sender as FeatureLayer;
&amp;nbsp;&amp;nbsp; if (WebContext.Current.User.IsInRole("Administrator"))
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.OutFields.Add("*") ; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;which I expected would add all of the fields to the FeatureDataForm if the user is an Administrator, but this doesn't work. Do I need to remove the original outfields or requery first?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:27:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10809#M209</guid>
      <dc:creator>DonFreeman</dc:creator>
      <dc:date>2021-12-10T20:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10810#M210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ideally, you will set OutFields before the layer gets Initialized and UpdateCompleted. If you will be showing all fields "*", it should be sufficient to do this upfront when you create the FeatureLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you intend to change OutFields at runtime? Like maybe fewer fields showing in FeatureDataForm initially and then later have all fields show? I'm not sure what you are attempting to do here. If any of the query parameters on the layer changes (like Where, OutFields), you will need to call Update() for these changes to take effect.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 17:26:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10810#M210</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-02-14T17:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10811#M211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jenn -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to show some fields to the casual user but ALL fields to the Administrator. So in the xaml outfields is set to the smaller set. But in the code behind I test for Administrator and expand the outfields set. I tried issuing &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;featureLayer.OutFields.Add("*") ; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.Update() ;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;but then NONE of the fields were visible in the featureDataForm.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:27:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10811#M211</guid>
      <dc:creator>DonFreeman</dc:creator>
      <dc:date>2021-12-10T20:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10812#M212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you can perform the check if user is Admin early on and set OutFields to all or select fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
FeatureLayer l = new FeatureLayer()
{
 Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/MapServer/0"
};
if (user is Admin) //TODO: check if user is Admin
 l.OutFields = new OutFields() { "*" };
else
 l.OutFields = new OutFields() { "incident_number", "description" };
MyMap.Layers.Add(l);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:27:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10812#M212</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-10T20:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10813#M213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would probably have to do that on page load or something like it early on. But what if the user was already on the page before he/she decided to login? Non Administrators are not required to login.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Feb 2011 20:21:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10813#M213</guid>
      <dc:creator>DonFreeman</dc:creator>
      <dc:date>2011-02-14T20:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10814#M214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for sharing us this use case. We are considering on accommodating it in future versions of our API. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, FeatureDataForm does not update its layout when layer OutFields parameter changes. Current workaround is to set the FeatureLayer OutFields before setting FeatureDataForm's FeatureLayer property.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 featureLayer.OutFields = new OutFields() { "address" }; //update to OutFields ("*" or subset of fields)
 MyFeatureDataForm.FeatureLayer = featureLayer;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:27:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10814#M214</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-10T20:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10815#M215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jenn -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess I will give up on trying to include this feature in my app. Also, the workaround you suggest does not work for some reason in my case. I already had the equivalent in my code which is:&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp; private void AllAvailableFeatureLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs args)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; FeatureLayer featureLayer = sender as FeatureLayer;
&amp;nbsp;&amp;nbsp; if (WebContext.Current.User.IsInRole("Administrator"))
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.OutFields.Add("*") ; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.Update() ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; featureLayer.SelectionCount; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.SelectedGraphics.ToList()&lt;I&gt;.UnSelect();

&amp;nbsp;&amp;nbsp; args.Graphic.Select();

&amp;nbsp;&amp;nbsp; MyFeatureDataForm.FeatureLayer = featureLayer;
&amp;nbsp;&amp;nbsp; MyFeatureDataForm.GraphicSource = args.Graphic;

&amp;nbsp;&amp;nbsp; FeatureDataFormBorder.Visibility = Visibility.Visible;
&amp;nbsp;&amp;nbsp; MyPopup.IsOpen=true;
&amp;nbsp;&amp;nbsp; }&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;If you try it you will see that the DataForm comes up blank. Oh well . . . (shrug).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10815#M215</guid>
      <dc:creator>DonFreeman</dc:creator>
      <dc:date>2021-12-10T20:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax to set FeatureLayer outfields</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10816#M216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Oh okay. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried the reverse where OutFields was initially "*" and then I changed OutFields to a subset of fields before setting MyFeatureDataForm.FeatureLayer. The workaround worked for this case.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For your case, you can do the following. Update() the layer once you have determined that the user is Admin and set FeatureLayer property on UpdateCompleted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
void featureLayer_UpdateCompleted(object sender, System.EventArgs e)
{
 FeatureLayer featureLayer = sender as FeatureLayer;
 MyFeatureDataForm.FeatureLayer = featureLayer;
}
//Do after login when user is determined to be Admin user.
private void Button_Click(object sender, RoutedEventArgs e) 
{
 FeatureLayer featureLayer = MyMap.Layers["PointLayer"] as FeatureLayer;
 featureLayer.OutFields = new OutFields() { "*" };
 featureLayer.UpdateCompleted += new System.EventHandler(featureLayer_UpdateCompleted);
 featureLayer.Update();
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:27:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/syntax-to-set-featurelayer-outfields/m-p/10816#M216</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-10T20:27:42Z</dc:date>
    </item>
  </channel>
</rss>

