Hi there,
I'm looking for some advise on getting an image into my wingrid cell correctly. I have tried a few different things with some strange results, most likely I'm missing the point somewhere along the lines...
OK I have a grid (always a good start), a column called priority (with values like high, medium, low etc). When the grid row is initialised I find the priority cell's value. If the cell is high I want to replace the text in the cell from the word "high" to an exclaimation mark image (16x16 png).
So...
public void gridTasks_InitializeRow( sender,... e )
if ( myValue.ToLower() == "high" )
{e.Row.Band.Columns["Priority"].CellAppearance.Image = Icons.exclaimation_red;//e.Row.Band.Columns["Priority"].CellAppearance.ImageBackground = Icons.exclaimation_red;
e.Row.Band.Columns["Priority"].CellDisplayStyle = CellDisplayStyle.FullEditorDisplay;//e.Row.Band.Columns["Priority"].CellButtonAppearance.Image = Icons.exclaimation_red;
e.Row.Cells["Priority"].Value = "";}What's really strange is I can step through the debugger and see myValue is "high", every 3rd or 4th row but every row comes back with the priority column cell with the image in it. I don't think this is the best way of applying the image to a cell so is there a better way?
// e.Row.Cells["ImpactId"].Appearance = grid.DisplayLayout.Appearances["Positive"];
Cheers,John
Thanks! I have resolved this issue. Being my first time to post on the forum, I didn't know whether this old thread would be the correct place to post my question, so I had also made a new thread at http://ko.infragistics.com/community/forums/p/89937/444297.aspx where I will continue with an additional question.
Hi,
I tried this out using the same code you provided here and it's working fine for me. So my only guess is that there is something in your code that occurs after this code which is blowing away these settings. Maybe you are loading a layout into the grid after this code is executed?
I'm attaching my sample project here so you can try it on your machine just to be sure it's not a bug in you version of NetAdvantage.
Hi Mike,
I am experimenting with this code, but I am unable to get the image to show. Even the "Y"/"N" values show correctly in the grid, but the image will not. I am trying everything to get the image to show, even setting the image via CellAppearance.Image for the entire column and I am unable to get the images to show.
Dim hazardousImages As ValueList = e.Layout.ValueLists.Add("Hazardous") Dim vli As ValueListItem = hazardousImages.ValueListItems.Add(True, "Y") vli.Appearance.Image = My.Resources.hazmat vli = hazardousImages.ValueListItems.Add(False, "N") vli.Appearance.Image = Nothing
hazardousImages.DisplayStyle = ValueListDisplayStyle.Picture e.Layout.Bands(0).Columns("Hazardous").ValueList = hazardousImages e.Layout.Bands(0).Columns("Hazardous").CellActivation = Activation.NoEdit
' Create a ValueList with an image for each item. Dim teamImages As ValueList = e.Layout.ValueLists.Add("Team") vli = hazardousImages.ValueListItems.Add(True, "Y") vli.Appearance.Image = My.Resources.users2 vli = teamImages.ValueListItems.Add(False, "N") vli.Appearance.Image = Nothing
hazardousImages.DisplayStyle = ValueListDisplayStyle.Picture e.Layout.Bands(0).Columns("Team").ValueList = teamImages e.Layout.Bands(0).Columns("Team").CellActivation = Activation.NoEdit
We have also tried using a Infragistics.Win.ConditionValueAppearance and setting it to the ValueBasedAppearance for the column. In this case, we have the same results. Everything works except the image.
Dim trueCond As Infragistics.Win.ICondition = CType(New Infragistics.Win.OperatorCondition(Infragistics.Win.ConditionOperator.Equals, True), Infragistics.Win.ICondition) Dim falseCond As Infragistics.Win.ICondition = CType(New Infragistics.Win.OperatorCondition(Infragistics.Win.ConditionOperator.Equals, False), Infragistics.Win.ICondition)
Dim trueApp As New Infragistics.Win.Appearance Dim falseApp As New Infragistics.Win.Appearance
With trueApp .Image = My.Resources.hazmat .ImageVAlign = Infragistics.Win.VAlign.Middle .ImageHAlign = Infragistics.Win.HAlign.Left .BackColor = Color.Blue End With With falseApp .Image = My.Resources.users2 .ImageVAlign = Infragistics.Win.VAlign.Middle .ImageHAlign = Infragistics.Win.HAlign.Left End With
e.Layout.Bands(0).Columns("Hazardous").ValueBasedAppearance = New Infragistics.Win.ConditionValueAppearance(New Infragistics.Win.ICondition() {trueCond, falseCond}, New Infragistics.Win.Appearance() {trueApp, falseApp})
Thanks for your help.
Hi Marleen,
The filter list does not show images from the cell by default. There's no built-in functionality to do this.
What you could do is handle the BeforeRowFilterDropDown event and loop through the items in e.ValueList and set the Appearance.Image for each one based on the DataValue of the item.
Hello,
I'm having an other problem.
In stead of using a VALUELIST I like to use the ULTRADROPDOWN with multiple columns, with the display member set to a column with the property '.Appearance.Image' set.
If I fill in the property 'value' of that column, then in the grid I see the image and the value, but in the filterrow I only see the value, not the image.
If I don't fill in the property 'value', then in the grid I only see the image (that is what I want!), but no items are added to the filterrow (only blanks,nonblanks and custom are available).
Any idea how to solve this?
Thx
Marleen