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 1108103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:01:51+00:00 2026-05-17T02:01:51+00:00

I have a listbox and as ItemsSource I give it an IList . In

  • 0

I have a listbox and as ItemsSource I give it an IList .

In this object exists another object with name {User} and I am trying to Bind the property {Username} onto a textBlock.

I tried something like this but with no luck

<TextBlock x:Name="usernamtTBL" Text="{Binding 'User.Username'}"/>

This is the full XAML code of listbox

<ListBox Height="275" x:Name="NewsFeedLB" Canvas.Left="8" Canvas.Top="8" Width="427" Background="White">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Canvas Height="57" Width="265" d:DesignWidth="265" d:DesignHeight="155">
                <Border BorderBrush="Black" BorderThickness="1" Height="35" Canvas.Left="8" Canvas.Top="8" Width="48">
                    <Image x:Name="thumbIMG" Margin="7"/>
                </Border>
                <TextBlock x:Name="usernamtTBL" Text="{Binding 'User.Username'}" Height="12" Canvas.Left="71" TextWrapping="Wrap" Canvas.Top="8" Width="180"/>
                <TextBlock x:Name="statusTBL" Text="{Binding 'Text'}" Height="12" Canvas.Left="71" TextWrapping="Wrap" Canvas.Top="24" Width="180"/>
            </Canvas>                       
        </DataTemplate>         
    </ListBox.ItemTemplate> 
</ListBox> 

and this is from codebehind

private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e) {
    var newsFeedWcfClient = new NewsFeedWCFClient();
    newsFeedWcfClient.GetNewsFeedItemsCompleted += new EventHandler<GetNewsFeedItemsCompletedEventArgs>(newsFeedWcfClient_GetNewsFeedItemsCompleted);
    newsFeedWcfClient.GetNewsFeedItemsAsync();
}

void newsFeedWcfClient_GetNewsFeedItemsCompleted(object sender, GetNewsFeedItemsCompletedEventArgs e) {
    var source = (IList<NewsFeed>)e.Result;
    NewsFeedLB.ItemsSource = source;
}

Could someone help me solve this issue?

Thanks

  • 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-17T02:01:51+00:00Added an answer on May 17, 2026 at 2:01 am

    Does your NewsFeed object have a public ‘get’ on it so that the value can be bound to? I reproduced your code as shown below (except I simply set the source to an ObservableCollection and didn’t call a service) and it worked.

    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
    
            ObservableCollection<NewsFeed> source = new ObservableCollection<NewsFeed>() { new NewsFeed() { Text = "This is a test", User = new User(){Username="Test Name"} } };
            NewsFeedLB.ItemsSource = source;
        }
    }
    
    public class NewsFeed
    {
        public string Text { get; set; }
        public User User { get; set; }
    }
    
    public class User
    {
        public string Username { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListBox that I bind to an ItemsSource, like this: var foos
[Original] I have a ListBox which has its ItemsSource (this is done in the
I have some control like <ListBox ItemsSource={Binding tests, UpdateSourceTrigger=PropertyChanged} ItemTemplate={StaticResource TestTemplate} /> When user
I have a listbox defined in XAML as: <ListBox x:Name=directoryList MinHeight=100 Grid.Row=0 ItemsSource={Binding Path=SelectedDirectories}/>
I have a listbox on a page: <select id=user_list name=user_list size=21 style=width:200px;> <option value=1>User
I have a Listbox with its ItemsSource property databound to a collection of objects.
I have a ListBox which hold a set of objects (linked via ItemsSource bind
I have listbox in my wp7 app like this <ListBox Name=lstSelectedNumber Height=50 MaxHeight=120 VerticalAlignment=Top
can someone give the C# equivalent of this xamle code? <ListBox Width=400 Margin=10 ItemsSource={Binding
I have some records inside an ObservableCollection. void proxy_AddPayNowOrderCompleted(object sender, AddPayNowOrderCompletedEventArgs e) { listBox1.ItemsSource

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.