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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:42:51+00:00 2026-05-30T17:42:51+00:00

I am trying to bind a listbox from 2 tables. These 2 tables are

  • 0

I am trying to bind a listbox from 2 tables. These 2 tables are related.

(windows phone project)

XAML:

<ListBox Name="LstOrders" ItemsSource="{Binding}" Margin="12,11,12,12" toolkit:TiltEffect.IsTiltEnabled="True" Height="643">
<ListBox.ItemTemplate>

    <DataTemplate>
                                    <StackPanel Margin="0">
                                        <TextBlock Text="{Binding refe}"
                                           Tag="{Binding idOrder}"
                                           Margin="0,0,0,0"
                                           FontSize="{StaticResource PhoneFontSizeExtraLarge}" 
                                           FontFamily="{StaticResource PhoneFontFamilySemiLight}"/>
                                        <TextBlock Text="{Binding tipo}"
                                           Margin="0,0,0,0"
                                           Foreground="{StaticResource PhoneSubtleBrush}"
                                           FontSize="{StaticResource PhoneFontSizeNormal}"/>
                                        <TextBlock Text="{Binding country}"
                                           Margin="0,0,0,0"
                                           Foreground="{StaticResource PhoneSubtleBrush}"
                                           FontSize="{StaticResource PhoneFontSizeNormal}"
                                           FontFamily="{StaticResource PhoneFontFamilySemiBold}" />
                                    </StackPanel>
                                </DataTemplate>
 </ListBox.ItemTemplate>
</ListBox>

C#

EXAMPLE

using (ordersDBDataContext miDataContext = new ordersDBDataContext("Data Source='isostore:/mydatabase.sdf'"))
                {    
                    var _lista = from p in miDataContext.orders
                                     join t in miDataContext.tipos on p.idTipo equals t.idTipo 
                                     orderby p.refe
                                     where p.idCliente == _idCli
                                          select new 
                                          {
                                              p.refe, p.country,p.idOrder,t.tipo

                                          };

                    this.LstOrders.ItemsSource = _lista;                   
                }

RESULT

No display any data.What is wrong?

iF i doing this I can see that _lista contains correct data:

foreach (var rr in _lista)
{
       MessageBox.Show(rr.tipo);
}
  • 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-30T17:42:52+00:00Added an answer on May 30, 2026 at 5:42 pm

    You are disposing your DataContext (correctly), but this means when the _lista query is executed the DataContext will no longer be valid and there will be an exception. WPF unhelpfully swallows exceptions in certain circumstances so you probably aren’t seeing the exception.

    The solution is to use:

    this.LstOrders.ItemsSource = _lista.ToList();
    

    and also to either remove ItemsSource={Binding} from your xaml or alternatively leave the binding in and use

    this.LstOrders.DataContext = _lista.ToList(); 
    

    Also, see Silverlight 4 Data Binding with anonymous types which may be relevant to your problem.

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

Sidebar

Related Questions

I'm trying to bind two ListBox es: <ListBox SelectionChanged=lbApplications_SelectionChanged ItemsSource={Binding Path=Applications, UpdateSourceTrigger=PropertyChanged, Mode=OneWay} />
I'm trying to bind a collection to a ListBox using only XAML. It kind
I am trying to bind the ConnectionStringsSettingsCollection from my app.config file to a ListBox
I'm trying to implement pinch/stretch zooming on a ListBox: <ListBox Grid.Row=1 ManipulationCompleted=ListBox_ManipulationCompleted ItemsSource={Binding Paras}>
I am building a Windows Phone App, and I am trying to bind the
I am trying to bind a dictionary as a DataSource to a ListBox. The
I'm trying to bind a ListBox's SelectedItem data to a property. The following code
I’m trying to bind a list of items to a ListBox in WPF. The
I am trying to bind a property ObservableCollection<ObservableCollection<Location>> to a ListBox with ItemTemplate of
Im trying to bind a list of images to a Listbox, but all I

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.