Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Images not appearing in WinGrid column using ValueBasedAppearance or ValueList
posted

Hi,

I found this post (http://es.infragistics.com/community/forums/t/17549.aspx) and attempted to implement it.  I have a boolean value column that I want to show a conditional image for, but I cannot get it to work.

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.

Private Sub AddBooleanIconToColumn(column As UltraGridColumn, trueIcon As Bitmap, falseIcon As Bitmap)

Dim trueCond As New Infragistics.Win.OperatorCondition(Infragistics.Win.ConditionOperator.Equals, True)
Dim falseCond As New Infragistics.Win.OperatorCondition(Infragistics.Win.ConditionOperator.Equals, False)

Dim trueApp As New Infragistics.Win.Appearance() With {
.Image = trueIcon,
.ImageVAlign = Infragistics.Win.VAlign.Middle,
.ImageHAlign = Infragistics.Win.HAlign.Left,
.BackColor = Color.Blue
}
Dim falseApp As New Infragistics.Win.Appearance() With {
.Image = falseIcon,
.ImageVAlign = Infragistics.Win.VAlign.Middle,
.ImageHAlign = Infragistics.Win.HAlign.Left
}
column.AllowRowFiltering = DefaultableBoolean.True
column.ValueBasedAppearance = New Infragistics.Win.ConditionValueAppearance(New Infragistics.Win.ICondition() {trueCond, falseCond}, New Infragistics.Win.Appearance() {trueApp, falseApp})


End Sub

Thanks for your help!

Parents
No Data
Reply
  • 23930
    Verified Answer
    Offline posted

    Hi Robert,

    Thank you for contacting Infragistics Developer Support.

    The code you have posted with the ValueList should work, except that you are adding the True ValueListItem twice to the Hazardous ValueList and you don’t add it to the Team ValueList. Other than that it seems fine. If that doesn’t fix the issue, make sure that you haven’t explicitly set the Style of the column to something like CheckBox. Also make sure that the images are properly loaded and that no exception is thrown.

    I have attached my sample which uses your code and works fine. Please modify it so it reproduces your issue and I will be glad to continue investigating your issue.

    I am looking forward to your reply.

    WG_AddImageBasedOnValue.zip
Children