Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 228255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:40:00+00:00 2026-05-11T19:40:00+00:00

I have the following content in a Window ( removed unnecessary sections ): XAML:

  • 0

I have the following content in a Window (removed unnecessary sections):

XAML:

<Style x:Key="itemstyle" TargetType="{x:Type ContentPresenter}">
        <EventSetter Event="MouseLeftButtonDown" Handler="HandleItemClick"/>
</Style>

<ItemsControl ItemsSource="{Binding ArtistList}" Margin="10" Name="artist_list" ItemContainerStyle="{StaticResource itemstyle}" >
    <ItemsControl.ItemTemplate>
        <DataTemplate>
                <TextBlock Text="{Binding ID}" Foreground="White"/>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

<Controls:RSSViewer x:Name="rssControl" />

C# (Code Behind):

private void HandleItemClick(object sender, MouseButtonEventArgs e)
{
    var selectedArtist = ((ContentPresenter) sender).Content as Artist;
    rssControl.SourceUrl = "http://agnt666laptop:28666/rss.aspx?artistid=" + selectedArtist.ID;
}

Now what I want to do is convert the above mixture of xaml and C# to something that is purely and solely xaml, to take advantage of WPF’s DataBinding model.

I think that it requires something like an Event trigger and combination of data binding with the selected item of the itemscontrol element or something like that, but I’m not sure on how to go about it.

Can anyone guide me to how I can convert the above solution to remove the procedural code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:40:00+00:00Added an answer on May 11, 2026 at 7:40 pm

    If you are using .NET 3.5SP1, you can probably use the new StringFormat binding markup extension to do it. See here for examples of binding with StringFormat.

    If .NET 3.5SP1 is not an option, then you’ll probably have to create your own ValueConverter. Bind the value of the SourceUrl property to the selected artist’s ID, and then in your converter return the same string that you’re using in the C# sample above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following text: --------------030805090908050805080502 Content-Type: image/jpeg Content-Transfer-Encoding: base64 Content-ID: <part16.07030906.00090703@highcontrast.ro> /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAA /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAA
I have the following XAML below for the main window in my WPF application,
Say that I have the following piece of XAML: <Window> <StackPanel Orientation=Horizontal> <Label>Phone:</Label> <TextBlock
Let's say I have the following content: Lorem Ipsum is simply dummy text of
Having read around it appears this should be possible. I have the following content
I have the following HTML5 content: <section contenteditable=true id=editable class=ui-selectee ui-selected> <span>something</span> <span>something</span> <span>something</span>
I have the following Dictionary content : [0] {75, SimpleObject} [1] {56, SimpleObject} [2]
Say I have the following text ..(content)............. <A HREF=http://foo.com/content >blah blah blah </A> ...(continue
I have the following scenario jQuery('#content').fadeOut('slow',function(){ jQuery('#content').load(detail.php?product=+imgID+&category=+cat); jQuery('#content').fadeIn('fast'); }); My problem however is that
I have a xPage with following content: <xe:restService id=restService preventDojoStore=false> <xe:this.service> <xe:viewJsonService viewName=vwChartData contentType=text/json>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.