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:
01524281
Vues:
61
>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.

The procedure is the same as for any ItemsControl:
Set the ItemsSource to an IEnumerable.
Set the DisplayMemberPath to the text to be displayed
Set the SelectedItem to the relevant object in the IEnumerable.

>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.

Binding to a DomainDataSource in code:
   public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            DomainDataSource dds = new DomainDataSource();
            dds.DomainContext = new CustomerDomainContext();
            dds.QueryName = "GetCustomers";
            dds.Load();
            cbox.ItemsSource = dds.Data;
            cbox.DisplayMemberPath = "CustName";
         }
    }
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform