简体   繁体   English

将 ListView 的所有内容导出为 Png

[英]Exporting all content of ListView as Png

I'm building an app that contains a kanban board which I would like to export as a PNG image.我正在构建一个包含看板的应用程序,我想将其导出为 PNG 图像。 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.该板由卡片状态(待办事项、正在做等)的 ListView 组成,每一个都是包含相同状态卡片的 ListView。 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.我已经能够使用 RenderTargetBitmap 将板导出为图像,但是,output 将具有可见的内容。 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将 ListView 的所有内容导出为 Png

Currently, UWP has no such api to get long screenshot.目前,UWP 没有这样的 api 以获得长截图。 I'm afraid you can't approach with RenderTargetBitmap class.恐怕您无法使用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.并且我们可以想象,如果我们可以缩放当前视图,让所有内容都显示在当前 window 中,那么我们就可以得到完整的截图。 So we could try to place above all in ScrollViewer and set it ZoomMode as enable.所以我们可以尝试首先将其放置在ScrollViewer中并将其 ZoomMode 设置为启用。 Just call ChangeView method to give it a appropriate ZoomFactor value to display all the content in visible place.只需调用ChangeView方法给它一个适当的 ZoomFactor 值,以在可见的地方显示所有内容。

<ScrollViewer ZoomMode="Enabled" >
    <Grid>
        <ListView>
           

Please note this way will disable the listview's ui virtualization.请注意,这种方式将禁用列表视图的 ui 虚拟化。 and if we scaled scrollviewer, the effective pixels of the current windows will be lower.如果我们缩放scrollviewer,当前windows的有效像素会更低。

And you do want this feature, please feel free post your requirement with windows feedback hub.如果您确实需要此功能,请随时使用 windows 反馈中心发布您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM