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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:23:26+00:00 2026-05-25T02:23:26+00:00

This is very simple linq and I am just beginning with it. I have

  • 0

This is very simple linq and I am just beginning with it. I have traced the problem down to one of 3 sources but am not sure how to fix it. So here is the code, and I will explain the problem below it.

XAML Binding:

<ListBox Name="lstJobs" ItemsSource="{Binding Path=Title}" DockPanel.Dock="Top"
                MinWidth="150" MinHeight="200" MaxHeight="250"
                ScrollViewer.VerticalScrollBarVisibility="Visible"
                SelectionChanged="lstJobs_SelectionChanged" />

C# Code Behind (Window loaded event):

TMDataContext TMDataBase = new TMDataContext();

lstJobs.ItemsSource = from j in TMDataBase.JobDetails
                      select j;

Result:

enter image description here

Problem:
I know the connection is working because there are only 3 records in the JobDtail table.

Back in college we learned that classes output their name if the ToString method is not overloaded to force it to do something else. The problem is that I dont want to modify the classes generated by L2S because they are automatically generated and any modifications will be lost later. I will be making changes so this and making changes to auto generated code is redundant.

Before doing the L2S, I had the database built, and a bunch of “entity” classes all pre designed using inheritance which I had to delete because they caused conflicts with the L2S classes. The L2S autogenerated classes are far to meessy for me and I would like to be able to replace their properties, constructors, and add methods. Or at least rename or extend them somewhere neater where I can re implement my inheritance structure.

The methodology I am using is simple. A set of classes for the UI. A set of “Control” classes to handle the business logic, and a set of “Entity” classes to interface with the DB. But the whole L2S automated class generation is getting in my way of this by replacing my entity classes.

Anyway, My first problem is I want to display the Job Title (one field form the Job Details table) in the list box for each record. When the selection is changed in the listbox, the relevant record will be accessed and will fill in a bunch of text boxes that will allow the user to edit that record.

Any help with this would be really appreicated. Thanks in advance.

  • 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-25T02:23:27+00:00Added an answer on May 25, 2026 at 2:23 am

    Your C# code behind is overriding your XAML binding. Currently it is just calling ToString on your objects because it doesn’t know which propery to display. In your XAML, you either need to specify the DisplayMemberPath/ValueMemberPath or use a DataTemplate, or in your LINQ just project a list of strings:

    lstJobs.ItemsSource = from j in TMDataBase.JobDetails 
                          select j.Title;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very simple problem...but weird results. Im just trying to fill a drop down list
I was making this very simple lex program (just an introductory program). But on
I have a very simple grouping and aggregation problem in LINQ to SQL that
I have this very simple jQuery function: $(.milestone-in-tree).live({ mouseenter: function() { setTimeout( $.ajax({ type:
I have this very simple br2nl function that I use to take a string
I have this very simple example that I am using to learn structs in
I have this very simple sql statement: SELECT max_dose FROM psychotropes WHERE (patient_meds.psychotrope =
I have this very simple C++ class: class Tree { public: Node *head; };
I'm very new to linq so this should be pretty easy to answer, but
I have a problem with a simple class. One property of my class is

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.