+ [Infragistics.Win.UltraWinListView.UltraListViewItemUIElement] {Infragistics.Win.UltraWinListView.UltraListViewItemUIElement} Infragistics.Win.UltraWinListView.UltraListViewItemUIElementI have an UltraListView list control. The UltraListView has a vertical scroll bar. The UltraListViewItems that have to be scrolled to have no UltraListViewItemUIElements. I need to give some those items an UltraListViewItemUIElements. Is there easy way an UltraListViewItem and UltraListViewItemUIElements even though it is not being viewed.
When I do a drag operation with selected items in a UltraListView list control only the selected item that can be viewed in the control are being dragged. This becuase the code only uses the selected items which have a UltraListViewItemUIElements created for them. Is there a simple way I can also created UltraListViewItemUIElements for those selected items whose UIElement property is null so those items will also to be displayed in the drag operation or can I be sent the source code to the UltraListViewItemUIElement.Draw method. This would be the method that overrides the UIElemem's virtual Draw method
Hello,
Element has UIElement only if this element is visible to the end customer. So what you could do is to get selected UltraListViewItems, in order to get their text and icon and to generate visual element (visual representation of those UltraListViewItems, which haven’t had UIElemets). I have made some modification of “WinListView DragDrop” sample in order to demonstrate this approach. Please run the sample and let me know if this is what you are looking for.
Please let me know if you have any further questions.
Well I got your demo code to work. I just hard coded the
styleLibraryPath vairable. I do not have any images associated with a list view item so I can not use the var img = item.Appearance.Image as Bitmap in the GetImageFromItem.
If I remove the reference the img variable in the method and just hard code with and height the text does appear in the drag operation but the text is for away from where the mouse is.
If you can modify the demo not to have any icons at all, make list view control show all its item verticaly instest of cascaded, and just move the selected list view items on the a grag operation centered on mouse during the drag that should do it.
I tried doing the above in my application in the GetImageFromItem but the text was no where to be seen.
;
Your code does not even draw a text string.
In the GetImageFromItem method I removed the reference using item.Appearance.Image and tried to just get the method to draw some text so I could see some text being drag and that did not event work. Below is the modified GetImageFromItem method. Did you test your demo code?
Bitmap GetImageFromItem(UltraListViewItem item) { var width = 200; var height = 20; var retImg = new Bitmap(width, height); var text = item.Text; var f = item.Appearance.HasFontData ? new Font(item.Appearance.FontData.Name, item.Appearance.FontData.SizeInPoints) : new Font("Tahuma", 7, FontStyle.Regular); Brush b = new SolidBrush(Color.Black); var g = Graphics.FromImage(retImg);
var location = new Point(7, 0); g.DrawString(text, f, b, new PointF(0, height)); f.Dispose(); b.Dispose(); g.Dispose(); return retImg; }
Well I found the problem. The item.Appearance.Image is null in my code. The item is list full of UltraListViewItem items. So do I neve need the line of code below?
var img = item.Appearance.Image as Bitmap;
On the line of codevar img = item.Appearance.Image as Bitmap
Show you be first creating a new Bitmap like in the previous demo and then some how to some type of copying of item.Appearance.Image in the new Bitmap.
Bitmap bmp = new Bitmap(section.Width, section.Height);
When using you the drag demo code I can not drag in debug mode because the Loader was dectected keep apperning tell me I attempted to run unmanaged code inside a DLL or image initialization function which can caude the application to hang.
All I have to do is really just drag a bitmap with text int it around. The oringal demo was great and worked find for item view item that had UIElement. Could you just add to the original code and make a second bitmap with the text of the list view items that do not have a UIElement, and combine the two bitmaps into one bitmap.
I tried doing this but the second bitmap sometime would show some tims.