Hi
I have a databound XamGrid with a text column. Depending on the values of the data, I need to display an icon together with the text in some rows, but just the text in other rows. I nearly have it working by handling the cellControlAttached event using the following code:
Private Sub grdListing_CellControlAttached(sender As Object, e As Infragistics.Controls.Grids.CellControlAttachedEventArgs)
If e.Cell.Column.Key = "HoursRemaining" Then
If e.Cell.Row.Data Is Nothing = False Then
If CType(e.Cell.Row.Data, SchedulePeriod).IsLocked = 1 Then
Dim strImage As String = "/MEX;component/Images/Buttons/Lock.png"
Dim strControlText As String = "" _
& "" _
& ""
e.Cell.Control.ContentTemplate = MEXGridBindingManager.CreateEditorTemplate(strControlText)
End If
End Sub
Public Shared Function CreateEditorTemplate(pControlXAML As String) As DataTemplate
Dim EditorTemp As New StringBuilder
EditorTemp.Append("<DataTemplate ")
EditorTemp.Append("xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' ")
EditorTemp.Append("xmlns:ig='http://schemas.infragistics.com/xaml' ")
EditorTemp.Append("xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' ")
EditorTemp.Append("xmlns:local = 'clr-namespace:MEX;assembly=MEX'>")
EditorTemp.Append(pControlXAML)
EditorTemp.Append("</DataTemplate>")
Return CType(XamlReader.Load(EditorTemp.ToString()), DataTemplate)
End Function
This appears to work at first - one row shows the icon and the text, the rest of the rows show the text only and this is correct. However, each time I scroll up or down, the icon gets added to more and more rows, seemingly at random. The data hasn't changed so the icon shouldn't be added to any more rows.
Hello,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thank you for your post. I have been looking into and suggest you see this sample from our Feature Browser:
https://es.infragistics.com/samples/silverlight/grid/#/conditional-formatting-rules
where it is shown how to use the Conditional Formatting of the XamGrid, which will help you to achieve your goal. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.