Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomatically Remove Hyperlink Buttons from ListBox
    primarykey
    data
    text
    <p>I have worked through the answer provided <a href="https://stackoverflow.com/questions/1025011/add-hyperlink-to-automatically-generated-xml-in-silverlight-c">here</a>. I have been able to create a list of automatically generated Hyperlink buttons in a ListBox. The goal is that, when a different user is typed into the box and the button is clicked, they old artists are removed (assuming it's a valid username) and replaced with the artists from the new last.fm user. However, now this line does not work:</p> <pre><code>ArtistsList.Items.Clear(); </code></pre> <p>Is this only for text? If so, does anybody know another way to remove the hyperlink buttons once the Go! button has been clicked again? I'll provide what I believe to be the pertinent page.xaml.cs code if that will help.</p> <pre><code> if (uname.Text != String.Empty &amp;&amp; uname.Text != "Try Another One!") { App app = (App)Application.Current; app.UserName = uname.Text; String getTopArtists = "http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&amp;user=" + app.UserName + "&amp;api_key=d2d620af554a60f228faed8d502c4936"; WebClient web = new WebClient(); WebClient client = new WebClient(); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCompleted); client.DownloadStringAsync(new Uri(getTopArtists)); } </code></pre> <p>This is what the HyperlinkButton looks like in the page.xaml code:</p> <pre><code>&lt;ListBox FontFamily="Calibri" HorizontalAlignment="Center" VerticalAlignment="Center" Width="200" Height="200" Margin="50,140,50,50" x:Name="ArtistsList" Foreground="Crimson"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel&gt; &lt;HyperlinkButton Content="{Binding Name}" NavigateUri="{Binding Amazon}" TargetName="_blank" Width="173.5" Foreground="Crimson"&gt;&lt;/HyperlinkButton&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; </code></pre> <p>I believe this is all of the necessary code to answer the question. If not, I can provide more.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload