Hi,
I have a custom creation filter on ultralistview to load image on demand. when item is fully visible its image will load.,
it works good but in thumbnail view if just 1 px of item is out of scope it does not load image.
is there any way to determine partially viewed items or one more line before and one more line after from viewed items at least.
here a part of my custom creation filter...
Public Sub AfterCreateChildElements(parent As UIElement) Implements IUIElementCreationFilter.AfterCreateChildElements
If TypeOf parent Is UltraListViewItemUIElement Then
Dim item As UltraListViewItemUIElement = DirectCast(parent, UltraListViewItemUIElement)
If item.Item.Appearance.Image Is Nothing AndAlso item.IsFullyVisible Then
item.Item.Appearance.Image = Me.GetThumbnail(item.Item.SubItems("FilePath").Value.ToString())
End If
End Sub
Public Function BeforeCreateChildElements(parent As UIElement) As Boolean Implements IUIElementCreationFilter.BeforeCreateChildElements
Return False
End Function
Hello Abdurrahmanoguz,
Yes, you can achieve this. Each item UIElement is nested in UltraListViewItemContainerUIElement. One possible solution could be to check the rectangle of item UIElement against the one of the container UIElement. You can use code like this:
Dim containerElement = item.ParentDim margin As Integer = 1Dim isTopCut = containerElement.Rect.Top - item.Rect.Top < marginDim isLeftCut = containerElement.Rect.Left - item.Rect.Left < marginDim isRightCut = containerElement.Rect.Right - item.Rect.Right < marginDim isBottomCut = containerElement.Rect.Bottom - item.Rect.Bottom < marginDim isFullyVisible = isTopCut OrElse isLeftCut OrElse isRightCut OrElse isBottomCut
Please let me know if you have any additional questions.
thanks your attention but containerElement contains all element so its rectangle bigger than visible part of screen like 700x2200 or may be bigger. my viewed area is 700x500 or like that.
Hi Abdurrahmanoguz,
I tested this behavior with each View style of UltraListView. ContainerUIElement had not such a big width in any of my tests. Attached is the sample I tested this behavior with.
Please check my sample and let me know if you are facing the same issue.
If the project does not work correctly, this indicates either an issue possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using Infragistics for Windows Forms 2016 volume 2 with latest service release. So could you please let me know the exact version of Infragistics components, which you are using?
If the project does show the product feature working correctly, this indicates a possible issue in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Alternatively, if this sample project is not an accurate demonstration of what you are trying to do, please feel free to modify it and send it back.
Looking forward to your reply.
thanks mike, although your sample is not suitable for the Project but your hint and advise is good. i solve it.
have a nice day!m
Dim itemElement As UltraListViewItemUIElement = TryCast(parent.GetDescendant(GetType(UltraListViewItemUIElement)), UltraListViewItemUIElement)
If itemElement IsNot Nothing AndAlso itemElement.Item IsNot Nothing AndAlso itemElement.Item.Appearance.Image Is Nothing AndAlso itemElement.IsFullyVisible Then
itemElement.Item.Appearance.Image = Me.GetThumbnail(itemElement.Item.SubItems("FilePath").Value.ToString())
RaiseEvent ImageLoaded(itemElement.Item)
ElseIf TypeOf parent Is UltraListViewIconicImageAreaUIElement Then
Dim imageElement As ImageUIElement = TryCast(parent.GetDescendant(GetType(ImageUIElement)), ImageUIElement)
Dim controlElement As UltraListViewUIElement = TryCast(imageElement.ControlElement.GetDescendant(GetType(UltraListViewUIElement)), UltraListViewUIElement)
If imageElement IsNot Nothing Then
Dim rect As Rectangle = parent.Rect
'THIS PART, I FOUND PARTIALLY VISIBLE UIELEMENTS TO LOAD IMAGES
If controlElement IsNot Nothing Then
If rect.IntersectsWith(controlElement.Rect) Then
If imageElement.Parent IsNot Nothing AndAlso imageElement.Parent.Parent IsNot Nothing AndAlso TypeOf imageElement.Parent.Parent Is UltraListViewItemUIElement Then
Dim itemElement As UltraListViewItemUIElement = TryCast(imageElement.Parent.Parent.GetDescendant(GetType(UltraListViewItemUIElement)), UltraListViewItemUIElement)
If itemElement IsNot Nothing AndAlso itemElement.Item IsNot Nothing AndAlso itemElement.Item.Appearance.Image Is Nothing Then
rect.Inflate(-4, -4)
imageElement.Rect = rect
imageElement.Scaled = True
I am sending you same sample, this time in VB. I added the same Creation Filters as you did. When I debug the size of the container UIElement it never returns such big width. Please check my sample and let me know if you face this issue with it. Alsoр let me know which is the version you are using.
One more thing. If you cannot determine the most right end with container UIElement you may try to do this with scrollbar UIElements. Add these lines in your creation filter to get the most right part of the container
Dim controlElement As UltraListViewUIElement = itemElement.ControlElementDim scrollBarElement = DirectCast(controlElement.GetDescendant(GetType(ScrollBarUIElement)), ScrollBarUIElement) Dim mostRightSide As Integer = 0If scrollBarElement.Orientation = Orientation.Horizontal Then mostRightSide = scrollBarElement.Rect.RightElse mostRightSide = scrollBarElement.Rect.LeftEnd If
Hi Milko,
your example works good on MouseEnterElement event. but i need to use it in a custom creation filter on AfterCreateChildElements event. because end-user look nothing until they are on the element.
as i wrote before i have custom creation filter to load image when they are fully visible (without waiting Mouse or keyboard interaction). so your example works fine on MouseEnterElement event but not in my custom filter class.
in this event containerElement gives a big rectanle (i think client area of list view) but i need viewed part...
i am using VS 2010 with infragistics 15.1.20193 winforms
Dim itemElement As UltraListViewItemUIElement = DirectCast(parent, UltraListViewItemUIElement)
If itemElement IsNot Nothing AndAlso
itemElement.Item IsNot Nothing AndAlso
itemElement.Item.Appearance.Image Is Nothing AndAlso
itemElement.IsFullyVisible Then
Dim containerElement As UIElement = itemElement.Parent
Dim margin As Integer = 1