Click here to Skip to main content
15,887,585 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to add the data from text box to already created list data item source Pin
Rocky2313-Apr-11 4:09
Rocky2313-Apr-11 4:09 
AnswerRe: How to add the data from text box to already created list data item source [modified] Pin
Tarun.K.S13-Apr-11 4:57
Tarun.K.S13-Apr-11 4:57 
GeneralRe: How to add the data from text box to already created list data item source Pin
Rocky2313-Apr-11 5:32
Rocky2313-Apr-11 5:32 
GeneralRe: How to add the data from text box to already created list data item source Pin
Pete O'Hanlon13-Apr-11 6:26
mvePete O'Hanlon13-Apr-11 6:26 
GeneralRe: How to add the data from text box to already created list data item source Pin
Rocky2313-Apr-11 19:12
Rocky2313-Apr-11 19:12 
GeneralRe: How to add the data from text box to already created list data item source Pin
Pete O'Hanlon13-Apr-11 21:57
mvePete O'Hanlon13-Apr-11 21:57 
GeneralRe: How to add the data from text box to already created list data item source Pin
Tarun.K.S13-Apr-11 7:46
Tarun.K.S13-Apr-11 7:46 
QuestionSorting a listbox when SortDescription won't cut it [modified] Pin
Jean-Louis Leroy12-Apr-11 23:29
Jean-Louis Leroy12-Apr-11 23:29 
Hello,

I have a listbox bound to a DataView showing rows from a table (ReportingUser) in a typed DataSet. The table has a DataRelation to another table (Reporting). Hence the (typed) row objects have a ReportingRow property that refers to the corresponding row in the related table.

Each row is displayed using text from the Reporting related table:
<ListBox Name="listBoxSelectedReporting" ItemsSource="{Binding User/User_ReportingUser}" 
             DisplayMemberPath="Row.ReportingRow.ReportingName" />

I would like to sort the listbox by ReportingName as well. I have been struggling with this for two days. None of the solutions I found via Google work. They include:

1/ Use a SortDescription. But that mechanism doesn't seem capable of following property chains, unlike DisplayMemberPath.

2/ Grab the defaultView and set the Sort property. But the mechanism is string-based and gives access to the row's columns only.

3/ Cast the defaultView to a ListCollectionView and set a custom IComparer. But the cast fails.

I also had an idea: use a partial class definition to add a new property, to be used in SortDescriptions:
partial class ReportingUserRow
{
  public string ReportingName
  {
    get
    {
      return ReportingRow.ReportingName;
    }
  }
}

Alas when I try to use it in either DisplayMemberPath or SortDescription, I get an exception that the property doesn't exist.

UPDATE: I can use my property in DisplayMemberPath like this: DisplayMemberPath="Row.ReportingName"

Which opens the question: using the debugger I see that my listbox contains a DataView that contains DataRowView objects which in turn contain a reference to a row object (of type ReportingUserRow). How does DataRowView find out what properties are available on a ReportingUserRow ? Why does it find the columns and not my extra property ?
modified on Wednesday, April 13, 2011 6:03 AM

AnswerRe: Sorting a listbox when SortDescription won't cut it Pin
SledgeHammer0113-Apr-11 13:34
SledgeHammer0113-Apr-11 13:34 
GeneralRe: Sorting a listbox when SortDescription won't cut it Pin
Jean-Louis Leroy13-Apr-11 21:06
Jean-Louis Leroy13-Apr-11 21:06 
GeneralRe: Sorting a listbox when SortDescription won't cut it Pin
SledgeHammer0114-Apr-11 5:13
SledgeHammer0114-Apr-11 5:13 
GeneralRe: Sorting a listbox when SortDescription won't cut it Pin
Jean-Louis Leroy15-Apr-11 1:11
Jean-Louis Leroy15-Apr-11 1:11 
GeneralRe: Sorting a listbox when SortDescription won't cut it Pin
SledgeHammer0115-Apr-11 4:45
SledgeHammer0115-Apr-11 4:45 
AnswerRe: Sorting a listbox when SortDescription won't cut it Pin
Jean-Louis Leroy13-Apr-11 22:09
Jean-Louis Leroy13-Apr-11 22:09 
QuestionWifi robot Pin
Solomon Emiru12-Apr-11 20:17
Solomon Emiru12-Apr-11 20:17 
AnswerRe: Wifi robot Pin
Pete O'Hanlon12-Apr-11 21:39
mvePete O'Hanlon12-Apr-11 21:39 
QuestionData Access for dummies... Pin
Johnny J.12-Apr-11 4:03
professionalJohnny J.12-Apr-11 4:03 
AnswerRe: Data Access for dummies... Pin
Ian Shlasko12-Apr-11 4:15
Ian Shlasko12-Apr-11 4:15 
GeneralRe: Data Access for dummies... Pin
Johnny J.12-Apr-11 4:20
professionalJohnny J.12-Apr-11 4:20 
GeneralRe: Data Access for dummies... Pin
Ian Shlasko12-Apr-11 4:34
Ian Shlasko12-Apr-11 4:34 
GeneralRe: Data Access for dummies... Pin
Johnny J.12-Apr-11 5:34
professionalJohnny J.12-Apr-11 5:34 
GeneralRe: Data Access for dummies... Pin
Ian Shlasko12-Apr-11 6:28
Ian Shlasko12-Apr-11 6:28 
AnswerRe: Data Access for dummies... Pin
Abhinav S12-Apr-11 4:35
Abhinav S12-Apr-11 4:35 
AnswerRe: Data Access for dummies... Pin
Vimalsoft(Pty) Ltd12-Apr-11 21:25
professionalVimalsoft(Pty) Ltd12-Apr-11 21:25 
GeneralRe: Data Access for dummies... Pin
Johnny J.12-Apr-11 21:51
professionalJohnny J.12-Apr-11 21:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.