Click here to Skip to main content
13,092,862 members (74,315 online)
Rate this:
 
Please Sign up or sign in to vote.
Hello!

I've created datagrid with combobox (reading data from DB), but need to fix some problems, maybe someone of you can help me ;)

First of all, I used grouping in dataGrid (group by name Wzór#), and everytime I want to add new element, it shows on the bottom:
http://i45.tinypic.com/2l8yarp.png[^]
Is it possible, to create something like "new group" with this only (the new one) item? For example like:
Wzór 1
Wzór1 niebieski 22 1 1 1
Wzór1 czerwony 23 1 1 1
Wzór 2
Wzór 2 czarny 55 1 1 1
Add new item
ComboBox ComBox ComboBox TextBox TextBox TextBox (which are exactly same as marked in picture). I mean somethink like that:
http://i45.tinypic.com/2s0ms90.png[^]

Second problem i found is that, when Im adding new item, and changing anything in ComboBox1,2 or 3 and then when im begining edit any textbox, all values from combobox dissapear - any way to fix it?


Here is source code (Actually its not very complicated, i have 3 methods with fill combobox1, combobox2 and combobox3 from database, then after button click im creating new Product item which im adding to list):

wzoryCount = wzoryCB.Items.Count;
           List<Produkt> Produkty = new List<Produkt>();
          // for (int i = 0; i < wzoryCount; i++)
           //{

               Produkt p = new Produkt { wzor = "", kolor = "", cena = 0, rozmiar = "", indeks = "", kod = "" };
               Produkty.Add(p);
          // }

           dataGrid1.ItemsSource = Produkty;
           ListCollectionView collection = new ListCollectionView(Produkty);
           collection.GroupDescriptions.Add(new PropertyGroupDescription("wzor"));
           dataGrid1.ItemsSource = collection;


I guess, i need to do something in beginEdit method for datagrid, but when i put there messagebox, it doesnt appear when im changing anything in combobox, but do when im changing textbox.

Thanks for any help!
Posted 4-Dec-12 1:41am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100