<?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 reference the controls in a FeatureLayer? in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-reference-the-controls-in-a-featurelayer/m-p/561179#M14458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For the first question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The control inside your map tip is null because it only part of the template.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let's try the following SDK sample: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerMapTips" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerMapTips&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;FeatureLayer.MapTip was defined in XAML (I simply added the code in red):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;Border CornerRadius="10" BorderBrush="#FF222957" BorderThickness="3" Margin="0,0,15,15"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Border.Background&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;GradientStop Color="#FFD1DFF2"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;GradientStop Color="#FF0088FF" Offset="0.946"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/LinearGradientBrush&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Border.Background&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Border.Effect&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Border.Effect&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Margin="7"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock &lt;SPAN style="color:&amp;quot;Red&amp;quot;;"&gt;x:Name="MyCityName"&amp;nbsp; Loaded="TextBlock_Loaded" &lt;/SPAN&gt; Text="{Binding [CITY_NAME]}" FontWeight="Bold" Foreground="Black"&amp;nbsp; /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="Population: " Foreground="Black" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="{Binding [POP1990]}" Foreground="Black" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt;
&amp;lt;/Border&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can think of two ways you can access the in code. Since you know the template, you can cast the elements until you get to the control of interest or simply add a Loaded event on the control.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
{
 InitializeComponent();
 FeatureLayer layer = this.MyMap.Layers["CitiesFeatureLayer"] as FeatureLayer;
 var mapTip = layer.MapTip;
 if (this.MyCityName == null)
 {
&amp;nbsp; var name = (((mapTip as Border).Child as StackPanel).Children[0] as TextBlock).Name;
&amp;nbsp; System.Diagnostics.Debug.WriteLine("This is one way of accessing this control '{0}'", name);
 }
}

private void TextBlock_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
 TextBlock tb = sender as TextBlock;
 if (this.MyCityName == null)
&amp;nbsp; System.Diagnostics.Debug.WriteLine("Another way of accessing this control '{0}'", tb.Name);
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the second question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is by design. If URL should change, you need to replace the FeatureLayer with a new instance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 00:13:07 GMT</pubDate>
    <dc:creator>JenniferNery</dc:creator>
    <dc:date>2021-12-12T00:13:07Z</dc:date>
    <item>
      <title>How to reference the controls in a FeatureLayer?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-reference-the-controls-in-a-featurelayer/m-p/561178#M14457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First question: I have controls enclosed in the maptip of one FeatureLayer in xaml, and I want to reference these controls (such as HyperlinkButton) in the code by their Name. However, these control is null in the C# code (e.g., this.hyperlinkButton.NavigateUri , and hyperlinkButton is null with a runtime error). Is there certain way to reference these controls enclosed by the maptip?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Second question, it seems that the FeatureLayer's associated URL can't be changed in code once initialized. Is there any way to work around this limitation?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Apr 2011 19:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-reference-the-controls-in-a-featurelayer/m-p/561178#M14457</guid>
      <dc:creator>weiliang</dc:creator>
      <dc:date>2011-04-06T19:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference the controls in a FeatureLayer?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-reference-the-controls-in-a-featurelayer/m-p/561179#M14458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For the first question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The control inside your map tip is null because it only part of the template.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let's try the following SDK sample: &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerMapTips" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerMapTips&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;FeatureLayer.MapTip was defined in XAML (I simply added the code in red):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;Border CornerRadius="10" BorderBrush="#FF222957" BorderThickness="3" Margin="0,0,15,15"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Border.Background&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;GradientStop Color="#FFD1DFF2"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;GradientStop Color="#FF0088FF" Offset="0.946"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/LinearGradientBrush&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Border.Background&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Border.Effect&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Border.Effect&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Margin="7"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock &lt;SPAN style="color:&amp;quot;Red&amp;quot;;"&gt;x:Name="MyCityName"&amp;nbsp; Loaded="TextBlock_Loaded" &lt;/SPAN&gt; Text="{Binding [CITY_NAME]}" FontWeight="Bold" Foreground="Black"&amp;nbsp; /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="Population: " Foreground="Black" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Text="{Binding [POP1990]}" Foreground="Black" /&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt;
&amp;lt;/Border&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can think of two ways you can access the in code. Since you know the template, you can cast the elements until you get to the control of interest or simply add a Loaded event on the control.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
{
 InitializeComponent();
 FeatureLayer layer = this.MyMap.Layers["CitiesFeatureLayer"] as FeatureLayer;
 var mapTip = layer.MapTip;
 if (this.MyCityName == null)
 {
&amp;nbsp; var name = (((mapTip as Border).Child as StackPanel).Children[0] as TextBlock).Name;
&amp;nbsp; System.Diagnostics.Debug.WriteLine("This is one way of accessing this control '{0}'", name);
 }
}

private void TextBlock_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
 TextBlock tb = sender as TextBlock;
 if (this.MyCityName == null)
&amp;nbsp; System.Diagnostics.Debug.WriteLine("Another way of accessing this control '{0}'", tb.Name);
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the second question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is by design. If URL should change, you need to replace the FeatureLayer with a new instance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:13:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-reference-the-controls-in-a-featurelayer/m-p/561179#M14458</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-12T00:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference the controls in a FeatureLayer?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-reference-the-controls-in-a-featurelayer/m-p/561180#M14459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks for your kindly help, Jennifer. You guys are really helpful and knowledgeable!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Appreciate it very very much.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 18:43:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-reference-the-controls-in-a-featurelayer/m-p/561180#M14459</guid>
      <dc:creator>weiliang</dc:creator>
      <dc:date>2011-04-07T18:43:24Z</dc:date>
    </item>
  </channel>
</rss>

