Exporting all content of ListView as Png - c#

I'm building an app that contains a kanban board which I would like to export as a PNG image. The board consists of a ListView of the card status' (To-do, doing, etc ) and each one of those is ListView containing the cards of the same status.
I'm already able to export the board as an image using a RenderTargetBitmap, however, the output will have the content that's in view. Instead, I want to have an image containing all the cards.
I honestly don't think it's that simple since only the visible cards are rendered on the page in the first place but I want to know if there's a different approach to this problem.
This is how an exported board would look at the moment

Exporting all content of ListView as Png
Currently, UWP has no such api to get long screenshot. I'm afraid you can't approach with RenderTargetBitmap class.
And we can imagine, if we could scale current view, and make all content show in the current window, then we could get the complete screenshot. So we could try to place above all in ScrollViewer and set it ZoomMode as enable. Just call ChangeView method to give it a appropriate ZoomFactor value to display all the content in visible place .
<ScrollViewer ZoomMode="Enabled" >
<Grid>
<ListView>
Please note this way will disable the listview's ui virtualization. and if we scaled scrollviewer, the effective pixels of the current windows will be lower.
And you do want this feature, please feel free post your requirement with windows feedback hub.

Related

Using a canvas on top of an image to show visuals relating to image properties read of a list box

We have images created off a a high resolution scanner for showing defects on glass products. Our C# application is used by clients to manage defects. Many customers are having difficulties translating the image properties like actual length provided. I am working with a base image with a canvas on top. I also have a grid with a list of properties which when selected, I want to show a visual on how to translate the selection by say, drawing a line on the canvas in a manner that depicts the translation.
It turns out that the requirement was misconstrued and what was needed was creating simulations on separate images that I had to create and load. Next time I will try to think outside the box.

Continous rolling of images from top to bottom in a image control in wpf c#

Good Morning. Image sliding from top to bottom is the known question only. But i tried with earlier answers, in that there is no continuity( when one image is sliding down another must enter from top ).
I tried with few slidings but not fruitful in continuity maintaining for a series of images in one image control only. As the work i have to prepate tick-tack kind game with 9 image controls individually sliding a series of images. When a image is selected sliding should stop and win conditions are horizontal or vertical or crosswise image equals.
Can someone help me with this. Thank you very much in advance.
Thanks,
Jagadeesh
I got the answer as for continuous rolling of images, two image controls in a container needs to be taken and with BeginTime difference they needs to be slided one by one and then with timer support this behaviour needs to be repeated. For not showing the images outside of image control borders, a scroll control needs to be attached to the container. If scroll control is not there while sliding they will appear above and below the borders of image control.

Is it possible to access underlying Xamarin UI elements using SkiaSharp?

In a cross platform Xamarin.Forms application, I would like to add a SKCanvas on top of other UI elements to allow the user to draw e.g. on images. I know it is possible to load an image directly into an SKCanvas, but images are not the only application I need.
A perfect solution would be able to load the underlying content of the page, including all of its UI elements into the Canvas/Surface, so that the user can then draw on it and save the drawing + underlying content into an image (probably using the snapshot method?).
Is this possible?
I didn't find a way to do this exactly as planned originally, but ended up doing a workaround that satisfied the requirements at the time.
I added a transparent canvas on top of my content, such that the underlying content would be shown through the canvas, but anything on the canvas would always be drawn on top. The drawings were saved and transmitted separately from the content and re-drawn when needed. On demand, when the user would need to export both together for a snapshot/share/export function, I then loaded the underlying content as image into the canvas and exported it together with the drawings from the canvas into a new image.

How to display images on top of each other using C# (Forms or WPF)?

I need to display images on top of each other. This can either be a composite\layered image or separate images. This will typically be a larger image with smaller images on top. With the composite\layered approach the smaller images would each need to be a separate (and accessible) layer. With the separate images approach the smaller images are on top with a transparent background. With either approach the smaller images must be accessible i.e. can be moved (dragged) or deleted. The app needs to display these images together (as if it was one image) and keep track of the coordinates (position) of the smaller images.
The current (proof-of-concept) solution has a PictureBox control that displays the large image and a treeview. Nodes are dragged from the treeview to the picture box and rendered using the graphics DrawString or DrawImage methods – these draw the smaller images. The problem is that once the smaller image is drawn I cannot get back to it as a separate graphics object. The picture box “sees” it as part of the current image.
I need to do this in C# (WinForms or WPF). And the image type must be a common and open format i.e. not proprietary. Preferably no 3rd party controls.
Any suggestions\guidance?
WPF would be the technology of my choice for this project.
Drag & Drop way nicer, without flickering, better concept
Rendering directly on HW, way smoother for image manipulation
General idea of the implementation:
MVVM pattern
ViewModel holding your layer information
ItemsControl bound to the collection of Small overlay Images holding a DataTemplate which visualizes the images thour custom UserControl based on a Thumb (for drag & drop functionality) displayes the small images on top.
Easy to add functionality to drag, edit, hide each small image seperately.
The problem is that once the smaller image is drawn I cannot get back
to it as a separate graphics object. The picture box “sees” it as part
of the current image.
That behaviour is perfectly normal. GDI drawing does not work with objects. To do what you are asking, you need to track any event that can cause a change in the final image and when such an event occur, you need to draw the whole image from the begining, including the first image (assigning the background image, I guess).
May be create picture box per image. The transparent background will give the effect of single image.

Showing thumbnail of selected images in a desktop application using C Sharp

I have a desktop application in C sharp, in which I have to show selected images in thumbnail view ( the view will be some thing like the attached image). The selected image can be deselected using x (cross) button shown on image top. Can someone suggest me how this can be accomplished. I have seen this accomplished in ASP .net. But I have to accomplish this in C#. Any clue will be greatly welcomed.
Regards,
You can generate the thumbnails from the Image class in .Net (Image.GetThumbnailImage). As far as the layout you are showing here, you could use a FlowLayoutPanel, or some other type of panel (or roll your own) that would dynamically add the images to your form. From there you can highlight around the image and add your X control button in the OnPaint, just keep track of which are selected and which aren't via some container class (add the images to something like a HashSet (.Net 3.5 or higher) so that you can quickly add/remove them from the collection, and iterate it in the OnPaint.
My advise will be to create a custom control (or user control) that will encapsulate image thumbnail & its name. It will highlight & show cross when focused/hovered. Cross can be as simple as another image overlaid on thumbnail (showing/hiding in mouse over event). Then you just needs to create and lay out multiple instances of control in whatever manner you want.

Categories