+ [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,
Thank you for your feedback. I am glad to hear that my suggestion helps you.
Thank you for using Infragistics Components.
OK I got you sample code working in my application.
Thanks for all the help
Its greatly appreciated.
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;