flowdocument

creating an XPS Document from a FlowDocument and attach it on the fly

梦想与她 提交于 2019-12-09 17:17:46
问题 I have a FlowDocument that I want to convert to an XPS Document and attach it to an e-mail and send it all together. I'm using this code public static MemoryStream FlowDocumentToXPS(FlowDocument flowDocument, int width, int height) { MemoryStream stream = new MemoryStream(); using (Package package = Package.Open(stream, FileMode.Create, FileAccess.ReadWrite)) { using (XpsDocument xpsDoc = new XpsDocument(package, CompressionOption.Maximum)) { XpsSerializationManager rsm = new

How to make <UIElement> interactable or click-able in WPF UI

孤者浪人 提交于 2019-12-09 13:03:27
问题 This is my first day to design UI using WPF. I have looked up MSDN official document of Flow Document and found that I can place an UI control inside a RichTextBox . I did put a button in but found it's not interactable - I cannot click on it as it's grey. And I also tried other controls and they all displayed fine but just don't support interaction. Even a hyperlink doesn't work. I have searched over internet, the closest question ever asked is about how to make an inside hyperlink click

Detect FlowDocument Change and Scroll

≡放荡痞女 提交于 2019-12-09 12:53:36
问题 I want to detect (preferably through an event) when any content is added, changed, etc. in a FlowDocument and when it does I want to cause a FlowDocumentScrollViewer displaying the FlowDocument to automatically scroll to the end. 回答1: You can detect changes in the FlowDocument by creating a text range and monitoring it for changes. Scrolling to the bottom is more difficult because you have to find the ScrollViewer . Also for performance you don't want redo all the scrolling calculations on

Embed custom control in WPF FlowDocument

巧了我就是萌 提交于 2019-12-08 10:36:03
问题 Is there any way to embed a custom control into the flowdocument and have it correctly displayed by the FlowDocument viewers (export it to Xaml text file and open it by a viewer)? 回答1: If by custom control you mean UserControl or any custom control inherited from a WPF control, you can't: This custom control is in its own XML namespace, and requires code deployed in an assembly. Your XAML reader won't have access to it when attempting to parse the file, and won't succed. You can only use

Printing a flowdocument with dynamic data in WPF

蹲街弑〆低调 提交于 2019-12-08 03:30:33
I am trying to find a good way to print a flow document in WPF. What I want is to have a possibility to see how the document turns out as I design it, so therefore creating a pure FlowDocument as a XAML is out of the questions (as Visual Studio wont show the design view for it). So what I have done now is to create a window that contains a FlowDocument like this (some excessive parts have been removed to make the code more consise): <Window x:Class="MyNamespace.ProjectPrintout...> <Grid> <FlowDocumentReader> <FlowDocument ColumnWidth="500" Name="Document"> <!-- Header --> <Paragraph Name=

Bug in FlowDocument Table?

狂风中的少年 提交于 2019-12-07 21:18:48
问题 first of all, Width calculation of FlowDocuments TableColumns is a mess. but this is rather ridiculous: <FlowDocumentScrollViewer> <FlowDocument> <Paragraph>text that's not visible</Paragraph> <Table BorderThickness="0.7559" > <Table.Columns> <TableColumn Width="100" /> </Table.Columns> <TableRowGroup> <TableRow> <TableCell/> </TableRow> </TableRowGroup> </Table> </FlowDocument> </FlowDocumentScrollViewer> this actually shows nothing. So the table seems to mess up the whole document. If I

FlowDocument loses ClearType in child elements when placed in window with custom glass

一曲冷凌霜 提交于 2019-12-07 06:27:26
问题 So the new WPF 4 text rendering looks great, but enabling the aero glass effect on a window requires that you change the background to transparent, which of course disables ClearType rendering. Using the provided RenderOptions.ClearTypeHint=Enabled allows you to designate child elements to reenable ClearType rendering from that point in the tree. I've found a few other topics that talk about doing this for the ScrollViewer used internally inside RichTextBox and FlowDocumentScrollViewer, and

WPF/XAML: Typography.Capitals seems to have no effect

好久不见. 提交于 2019-12-07 03:21:09
问题 All of these bits of text look the same, but I am trying to get them to look different. I want small caps text. What am I missing here to get the small caps typography effect to work? To reproduce this, open Visual Studio 2008, Do File|New Project, create a new Windows|WPF application, paste the mark-up below into Window1.xaml, then run it. <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx

How can I copy WPF FlowDocument InlineUIContainer contents?

无人久伴 提交于 2019-12-07 02:15:04
问题 I have a WPF FlowDocument that has a few InlineUIContainers, these are simple InlineUIContainers, that contain a styled button with some text in the Button.Content. When I copy the text and InlineUIContainer containing the button from the FlowDocument to a TextBox, the button is not copied. It is possible to somehow convert the inline button or convert the button to text in the pasted text data. I have tried using the FlowDocument.DataObject.Copying event, but I can't seem to find any good