I want to bind an UltraGrid to a generic list of strings using List<string> (c# generic class).
I've set up a BindingSource.DataSource to my List<string> object, but when I hook it up and run my program, the UltraGrid shows a single column bound to the Length property showing the Lengths of my strings instead of showing me the actual list of string data.
If I set a System.Windows.Forms.Listbox or ComboBox to use the same BindingSource, I get the expected list of strings shown.
Why can't an UltraGrid do the same thing? I couldn't find any help on this seemingly simple thing.
It is certainly possible that this was a bug in v8.2. Are you using the latest service release?
I am testing with the oldest currently-supported version, which is v9.2.
It's also conceivable that Microsoft changed something in the BindingManager or BindingSource that broke this for VS2010. I was running VS2008 when I tested it the first time around.
So I tried it again today using VS2010, and v9.2 and it still seems to work just fine for me. My gird displays a single column with the header "Value", and each cell in the grid contains an int, just like it should.
So my guess is that this was a bug in v8.2. Try getting the latest service release and see if that helps.
How to get the latest service release - Infragistics Community
Hmmm i've copy paste your code in vs.net and it doesn't work, here's my code: public partial class Form1 : Form { public Form1() { InitializeComponent(); }
public class MyList : List<int> {
}
private void Form1_Load(object sender, EventArgs e) { //List<int> list = new List<int>(); MyList list = new MyList(); list.Add(1); list.Add(2); list.Add(3);
BindingSource bindingSource = new BindingSource(list, null); this.ultraGrid1.DataSource = bindingSource; } }
By the way, im still using 8.2 (Which im not sure why since the admin guy install this one and install our key which is supposed to work for 8.3 (maybe the keys are backward compatible not sure about this). Also we are using vs.net 2010 (This is a .net 4.0 project), although i don't think this could cause any issue...
Hi,
The BindingSource should not make any difference. If simply using a BindingSource is causing the grid not to pick up the correct fields for a list, then that would be a bug in the grid.
I tried this out with a BindingSource and it still works fine for me, though.
private void Form1_Load(object sender, EventArgs e) { //List<int> list = new List<int>(); MyList list = new MyList(); list.Add(1); list.Add(2); list.Add(3); BindingSource bindingSource = new BindingSource(list, null); this.ultraGrid1.DataSource = bindingSource; } public class MyList : List<int> { }
About the BindingSource, it has some issues that turn IsBindingSuspended = true. Sometimes, if you get to this point, you can't turn it to be false and your binding won't work. I had this case when I binded EntitySet that its HasLoadedOrAssignedValues was false. Check if you bind before you fill the data.
You're right, i've just checked, and it seems a BindingSource issue, our grid is binding thru a binding source 99% of the time, so it looks like it was a problem related to the grid but it looks more related to the bindingsource, since the grid is retrieving it's properties thru this component!
Well this solved this case then, thanks alot! Sorry for loosing your time, we should have test that before even hitting this site!