flowdocument

What is the best substitute for FlowDocument in Silverlight?

旧城冷巷雨未停 提交于 2019-11-29 14:32:17
I'm porting an application from WPF to Silverlight and was saddened to read of the lack of FlowDocument support. What is the best way in Silverlight then to display text with markup? I just need the basics, e.g. bold italic hyperlink colors font sizes Added: I don't mean a RichTextBox (as in the Vectorlight demo ) but a way to format text on the application surface itself , like I can do with FlowDocument in WPF: (source: deviantsart.com ) In Silverlight 3 Vectorlight's Free RichTextBox can do a pretty good job of what you need using HTML. In Silverlight 4 you have the option of using the

WPF FlowDocument - Absolute Character Position

て烟熏妆下的殇ゞ 提交于 2019-11-29 13:29:13
问题 I have a WPF RichTextBox that I am typing some text into and then parsing the whole of the text to do processing on. During this parse, I have the absolute character positions of the start and end of each word. I would like to use these character positions to apply formatting to certain words. However, I have discovered that the FlowDocument uses TextPointer instances to mark positions in the document. I have found that I can create a TextRange by constructing it with start and end pointers.

Finding all Images in a FlowDocument

假如想象 提交于 2019-11-29 11:08:49
Since I am pretty new to WPF FlowDocuments I would like to ask if the code below is correct. It is supposed to return all Images contained in a FlowDocument as List: List<Image> FindAllImagesInParagraph(Paragraph paragraph) { List<Image> result = null; foreach (var inline in paragraph.Inlines) { var inlineUIContainer = inline as InlineUIContainer; if (inlineUIContainer != null) { var image = inlineUIContainer.Child as Image; if (image != null) { if (result == null) result = new List<Image>(); result.Add(image); } } } return result; } private List<Image> FindAllImagesInDocument(FlowDocument

C# FlowDocument to HTML conversion

岁酱吖の 提交于 2019-11-29 09:38:02
问题 Basically, I have a RichTextBox and I want to convert the formatted contents of it to HTML so it can be sent as an email. The method I am currently using does not give any formatting at all: string message = new TextRange(messageTextBox.Document.ContentStart, messageTextBox.Document.ContentEnd).Text; So I searched around and found this, however, it is over 5 years old and in the comments an MSFT user has commented saying that it is no longer supported - "This sample has been removed from our

How to print directly, without Print Dialog in WPF?

让人想犯罪 __ 提交于 2019-11-29 07:16:06
问题 I just want to know how I can print a flow document without showing Print Dialog in WPF. Thanks for help… 回答1: You can use the PrintDialog class without showing the dialog (without calling ShowModal) 回答2: This is one of the ways you can change default printer or change other settings: using System.Printing; //add reference to System.Printing Assembly //if you want to modify PrintTicket, also add //reference to ReachFramework.dll (part of .net install) ... var dlg = new PrintDialog(); dlg

WPF Table Column Sizes

自作多情 提交于 2019-11-29 02:52:19
问题 I'm rendering a Table in a WPF FlowDocument using code-behind. But, I've been unable to find an example that shows how to make the table use only the space needed based on content. Instead the table takes up all available width, which I don't want, nor do I want to have to specify a exact pixel sizes. I'm clearly missing something simple, anyone see it? var fd = new FlowDocument(); Table t = new Table(); t.BorderBrush = Brushes.Black; t.BorderThickness = new Thickness(2); // I thought this

Why is this flowdocument table always printing 2 columns

半世苍凉 提交于 2019-11-28 21:28:05
I have a ListView in my WPF app that is bound to a collection of tasks to perform (A to-do list). I want the user to be able to print their list and have created the following code based on the MSDN guidelines. (This my first foray into printing) public FlowDocument GetPrintDocument() { FlowDocument flowDoc = new FlowDocument(); Table table = new Table(); int numColumns = 3; flowDoc.Blocks.Add(table); for(int x=0;x<numColumns;x++) { table.Columns.Add(new TableColumn()); } GridLengthConverter glc = new GridLengthConverter(); table.Columns[0].Width = (GridLength)glc.ConvertFromString("300");

Printing BlockUIContainer to XpsDocument/FixedDocument

无人久伴 提交于 2019-11-28 20:54:17
Question How do you print a FlowDocument that have BlockUIContainer ? How can I force a Measure/Update/Arrange on a FlowDocument? Background I have a generated FlowDocument with paragraphs of text with a few Rectangle elements filled DrawingBrushes from a resource dictionary and BlockUIContainer with custom controls. The document renders correctly when viewed in any of the FlowDocument* controls HOWEVER when the document is converted to a FixedDocument/XpsDocument, none of the Rectangle or BlockUIContainer elements render. I'm almost certain it is because the control has not been measured

How can I get a FlowDocument Hyperlink to launch browser and go to URL in a WPF app?

孤街浪徒 提交于 2019-11-28 10:02:24
The following code in a WPF app creates a hyperlink that looks and acts like a hyperlink, but doesn't do anything when clicked. What do I have to change so that when I click it, it opens the default browser and goes to the specified URL? alt text http://www.deviantsart.com/upload/4fbnq2.png XAML: <Window x:Class="TestLink238492.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel Margin="10"> <ContentControl x:Name="MainArea"/> </StackPanel> </Window> Code Behind:

Handle all Hyperlinks MouseEnter event in a loaded loose Flowdocument

心已入冬 提交于 2019-11-28 09:08:29
问题 I'm new to WPF, working on my first project. I've been stuck in this problem for a week so I'm trying to find some help here. I have a FlowDocumentReader inside my app, wich loads several FlowDocuments (independent files as loose xaml files). I need to handle the MouseEnter event for all the Hyperlinks in the loaded document but I cannot set MouseEnter="myHandler" in XAML as theese are loose XAML files. Is there any way to parse de FlowDocument and set the handlers when loading it? Any other