I have an UltraGrid with a cell that displays an image which dynamically updates based on the bound value. To bind the data, I create a custom object and put it in a Binding List. I am using an UltraData Source to define the schema, and then I set the data binding by:
UltraGrid.SetDataBinding(myBindingList, null, true);
Then I assign a ValueList containing the images to the grid like this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e){
ValueList valueList = e.Layout.ValueLists.Add("Images");
ValueListItem vli = valueList.ValueListItems.Add("Active"); vli.Appearance.Image = imageList1.Images["Active"]; vli = valueList.ValueListItems.Add("Inactive"); vli.Appearance.Image = imageList1.Images["Inactive"]; e.Layout.Bands[0].Columns[0].ValueList = valueList;}
The problem is that when the underlying data changes, the image does not always repaint, however by invalidating the area (such as Mouse Over) the image then changes. Much of the time this works as expected, it is only occaisionally that the image does not change when it should.
Is there a step I am missing?
Thanks!
Bill
Hi Bill,
This sounds like a bug to me. Especially if it works sometimes and not others. What version of the grid are you using? Do you have the latest Hot Fix? If not, I recommend that you download it and see if that helps.
If that doesn't help, see if you can duplicate this issue in a small sample project and Submit an incident to Infragistics Developer Support so they can check it out.
Infragistics2.Win.UltraWinGrid.v7.3.dll version 7.3.20073.38
I tried a different approach by using the ValueBasedAppearance on the column. And this works fine except for one problem: I can't get the Image only to appear, the text appears as well. Is there a way to get the image only to appear?
ConditionValueAppearance app = new ConditionValueAppearance();
Infragistics.Win.Appearance appearanceActive = new Infragistics.Win.Appearance();appearanceActive.Image = imageList1.Images["Active"];
Infragistics.Win.Appearance appearanceInactive = new Infragistics.Win.Appearance();appearanceInactive.Image = imageList1.Images["Inactive"];
app.Add(new OperatorCondition(ConditionOperator.Equals, "Active"), appearanceActive);app.Add(new OperatorCondition(ConditionOperator.Equals, "Inactive"), appearanceInactive);
e.Layout.Bands[0].Columns[0].ValueBasedAppearance = app;