Click here to Skip to main content
15,894,460 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Data binding from a List to a Grid Pin
fjparisIII25-Jun-09 7:39
fjparisIII25-Jun-09 7:39 
GeneralRe: Data binding from a List to a Grid Pin
Pete O'Hanlon25-Jun-09 9:07
mvePete O'Hanlon25-Jun-09 9:07 
GeneralRe: Data binding from a List to a Grid Pin
fjparisIII25-Jun-09 9:29
fjparisIII25-Jun-09 9:29 
AnswerRe: Data binding from a List to a Grid Pin
Mark Salsbery25-Jun-09 7:23
Mark Salsbery25-Jun-09 7:23 
GeneralRe: Data binding from a List to a Grid Pin
fjparisIII25-Jun-09 7:40
fjparisIII25-Jun-09 7:40 
GeneralRe: Data binding from a List to a Grid Pin
Mark Salsbery25-Jun-09 7:46
Mark Salsbery25-Jun-09 7:46 
GeneralRe: Data binding from a List to a Grid Pin
fjparisIII25-Jun-09 8:33
fjparisIII25-Jun-09 8:33 
AnswerRe: Data binding from a List to a Grid (Everything works now) [modified] Pin
fjparisIII25-Jun-09 12:19
fjparisIII25-Jun-09 12:19 
I've got it all working now, exactly the way I want it. But things got solved in unexpected ways. I couldn't support updating the ListView in XAML if I wanted to replace the values in it multiple times in the same instance of the containing window. I had to initially set ItemsSource to null and Clear() the ListView, and only after setting all the values in the ItemsSource could I bind the data to the control through a simple assignment statement in code-behind.

This solved all my problems! so Mark Salsbery was on the right track when he advised me not to use XAML for the data binding. Maybe there's a way of assigning it in XAML but in this case, I don't know what it is. And where XAML is supposed to be so much more concise than code behind, in this case it is horrendously more complicated! I don't have to worry about "RelativeSource", "AncestorType", "Path", or any of that other BS in XAML. I just prepare my data source and do a one line assignment when it's done, like this:

metadataGrid.ItemsSource = PhotoMetadataList;

Voila! Mission accomplished! What could be simpler? PhotoMetaDataList is local to the window instance and I don't have to worry about binding to something in Application.Current, which was about as ugly as you can get. Each window instance has its own data source and everything works perfectly!

My apologies for not following up on all the posters who gave me fine suggestions, but as the saying goes, if it ain't broken, don't fix it! Thre's valuable suggestions in this thread that will come in handy in the future. And BTW, my problems had absolutely nothing to do with the 3rd party control I'm using, which is just about the spiffiest control in the universe. All my problems were with understanding the basics of pure WPF data binding. No wonder the 3rd party tech support was impatient with me.

Look up Matthew MacDonald's suggestion on page 608 for a replacement to the Windows Forms' DataGridView to find out what control I'm actually using. Unfortunately the book is out of date in suggesting that you can get the standard edition for free. However, it was correct information when I bought the book and I jumped at the chance to get it free! It will currently set you back $300, and thousands if you want the Professional edition. They must have had an army putting this thing together.

modified on Thursday, June 25, 2009 6:28 PM

QuestionWPF Slider project Pin
fgimenez24-Jun-09 8:14
fgimenez24-Jun-09 8:14 
AnswerRe: WPF Slider project Pin
Christian Graus24-Jun-09 15:26
protectorChristian Graus24-Jun-09 15:26 
GeneralRe: WPF Slider project Pin
fgimenez29-Jun-09 2:49
fgimenez29-Jun-09 2:49 
QuestionSilverlight2Chat Pin
deep7624-Jun-09 4:59
deep7624-Jun-09 4:59 
AnswerRe: Silverlight2Chat Pin
Mark Salsbery24-Jun-09 7:35
Mark Salsbery24-Jun-09 7:35 
GeneralRe: Silverlight2Chat Pin
deep7624-Jun-09 7:41
deep7624-Jun-09 7:41 
GeneralRe: Silverlight2Chat Pin
Mark Salsbery24-Jun-09 7:49
Mark Salsbery24-Jun-09 7:49 
GeneralRe: Silverlight2Chat Pin
deep7624-Jun-09 8:04
deep7624-Jun-09 8:04 
GeneralRe: Silverlight2Chat Pin
Mark Salsbery24-Jun-09 8:25
Mark Salsbery24-Jun-09 8:25 
GeneralRe: Silverlight2Chat Pin
deep7624-Jun-09 8:37
deep7624-Jun-09 8:37 
GeneralRe: Silverlight2Chat Pin
Mark Salsbery24-Jun-09 9:00
Mark Salsbery24-Jun-09 9:00 
GeneralRe: Silverlight2Chat Pin
deep7624-Jun-09 9:52
deep7624-Jun-09 9:52 
QuestionRe: Silverlight2Chat Pin
Mark Salsbery24-Jun-09 12:06
Mark Salsbery24-Jun-09 12:06 
AnswerRe: Silverlight2Chat Pin
deep7624-Jun-09 14:35
deep7624-Jun-09 14:35 
GeneralRe: Silverlight2Chat Pin
Mark Salsbery24-Jun-09 14:46
Mark Salsbery24-Jun-09 14:46 
GeneralRe: Silverlight2Chat Pin
deep7624-Jun-09 15:03
deep7624-Jun-09 15:03 
GeneralRe: Silverlight2Chat Pin
Mark Salsbery24-Jun-09 18:02
Mark Salsbery24-Jun-09 18:02 

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.