Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populate Combobox from data?? COME ON!!
Message
Information générale
Forum:
ASP.NET
Catégorie:
Silverlight
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01524187
Message ID:
01524313
Vues:
62
>>>>As someone coming into silverlight programming from the ASP.NET world (and many earlier worlds), I'm absolutely astounded as to how completely broken and not-ready for BETA the combobox in Silverlight is when trying to populate it from any data source.
>>>>
>>>>I've literally spent days trying to get a combobox in a datagrid to populate the items from a RIA domaindatasource or any other method of getting data from my entity framework (using domaindatasource) objects.
>>>>
>>>>I've read so many contradictory/fragmented/error filled/incomplete blogs and other articles on the web that I could just hurl.
>>>>
>>>>I've yet to get it to populate (then I have to tackle setting selected item which appears more broken).
>>>>
>>>>This is supposed to be silverlight 4. IMHO it hasn't reached an alpha release for a 1.0 version yet.
>>>>
>>>>If anyone has a clear cut, COMPLETE and ACCURATE example of doing this I'd love to see it.
>>>
>>>Hmm..... no answers.
>>>
>>>Well, I'm more WPF than Silverlight, but they are usually similar enough that I might be able to help walk you through this.
>>>
>>>There are generally 2 ways to go on this, and I understand the frustration, it is not very straight forward. One is a static data source set earlier in the resources section of the XAML.
>>>
>>>This blog looks like it might help:
>>>
>>>http://weblogs.asp.net/dwahlin/archive/2009/08/20/creating-a-silverlight-datacontext-proxy-to-simplify-data-binding-in-nested-controls.aspx
>>>
>>>The less common way is to add the items to a collection on the items that are used to populate the DataGrid.
>>>
>>>If that link doesn't help, show me your XAML and I'll see if I can find what the hangup is.
>>
>>I've managed to populate the items collection using a shared datasource as a staticresource, and using the combobox extensions to make a comboboxdatasource. I've got the selectedvalue binding properly so I can save choices I make with the combobox.
>>
>>Problem now is I can't set the initial value properly. In the datagrid, my textblock in the columntemplate shows the correct value from the datagrid's datasource, but the combobox in the edittemplate always starts off blank. If I click on it I have my items populated and I can select one and save the data, but the next time I go to edit that cell the combobox will be blank again.
>>
>>I see various blogs talking about using a valueconverter (nice confusing pile of code) to remedy this, but it hasn't made any sense to me yet.
>>
>>This just amazes me that this is the state of affairs for a version 4 software release.
>>
>>One of our other developers simply never uses a combobox in a datagrid - he always edits outside of the datagrid.
>
>In fairness, a lot of VFP developers took the same approach. I still love Jim Booth's description of grids: "The devil's own control."

Grids in VFP actually worked as advertised though, and they had a very good feature set. Time to figure them out really wasn't all that bad.

The ComboBox in Silverlight (and WPF has much of the same problems) is amazingly hard to work with if it is contained in a databound container (read that: DataGrid). It is poorly designed and not documented in any useful way.It appears that users have to come up with their individual complicated hacks (usually using third party tools) to try to make the ComboBox act like it does in any other language.

Another nail in the Microsoft coffin IMHO.
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform