Curve Texblock in XAML / W8.1 throughTemplate? - xaml

Is it possible to access the TextBlock Template to change the border and make it curved?
I tried editing the Template through Blend but with no success.
I'm trying to achieve something like this (couldn't get that given solution working):
Curve TextBlock in Windows 8
I'm trying to do this in C#/XAML - WINRT (Windows 8.1)

I don't think a TextBlock has a template you could modify. It's probably just some parameters used to tell DirectWrite what text to render and with what properties. The easiest way to solve it is when your text is constant to just break it apart into multiple single letter TextBlocks and lay them out on a path using Blend or Illustrator. If don't control what text can show up on the path - you'd have to code up the layout algorithm. Chris's link seems like a good place to start.

There isn't a clean way to do this directly in Xaml. Like Filip says, you can approach it by breaking the letters apart. That can work well for long sentences with small letters, but can be pretty chunky with large or connected letters. If you need smoother rendering then you can interop to Direct2D.
MSDN has a Direct2D animated text on a path sample which you could combine with the XAML SurfaceImageSource DirectX interop sample

Related

Xamarin Forms FontIcon Upper Bitplane XAML Escape Character

I'm trying to use MaterialDesignIcons in a Xamarin Forms Shell app. The latest version of this font encodes all of the glyphs in the upper bit planes (see this old StackOverflow question about that).
The problem I have is that I don't know how to identify the proper XAML escape sequence for upper bit plane glyphs. For example, \uf30c in C# code translates to  in XAML. But I don't know how to translate an upper bit plane value (e.g. \U000f0706) to the correct XAML escape sequence.
I thought I'd just use a binding to code instead, but this is blocked by an open bug. There's a workaround in that GitHub issue, but it doesn't seem to work for a Tab Bar Icon (which is where I'm trying to use it).
TL;DR - how to I write \U000f0706 in XAML?

How to create a Tokenizing Control for UWP as known from Outlook when using To, Cc and Bcc

There is a great article about how to write a Tokenizing Control for WPF here: Tokenizing control – convert text to tokens
But how is this accomplished in an UWP App? The Windows 10 UWP Mail client does this just fine, so I know that it is possible. But how?
Tokenizing is super useful for To/CC/BCC input areas, as we know it from Outlook and lately from the Windows 10 UWP Mail client.
I suspect that RichTextBlock or maybe RichEditBox combined with AutoSuggestBox could be part of the answer, but in the WPF example above FlowDocument is used and FlowDocumet is not supported in UWP.
I haven't looked at their code. They likely have a text input control of their own, but you could achieve a fairly similar and possibly acceptable effect by putting (Rich)TextBox and "token" elements in a WrapPanel. You won't be able to easily select all text, but you could get clickable token elements.
Otherwise - you might have a bit of work figuring out completely hand-crafted input and rendering.

How to measure text in a RichTextBox in Silverlight

I want to get the height necessary to display the full text in my RichTextBox (when the text extends beyond the set height of the control).
Reminder: Silverlight has no handy TextRenderer.MeasureText like WPF does, nor any other apparent way to measure text.
Doesn't seem like there's any way to do this. I've seen mention of people measuring text of a single font (not mixed as in my RichTextBox) by creating a TextBlock and getting it's Width. Even this doesn't work - it's perfect for some fonts and inconsistent for others.
My app is occasionally connected, so I can't call the server.
As you say, I don't think there's a good way to do this in Silverlight today. There are some functions available in the Document Toolkit by First Floor Software, however those are geared towards working with XPS documents. I'm not sure what you're trying to do, however in Silverlight 5 the RichTextBox does come with the ability to "overflow" text into multiple other RichTextBoxes when the first one cannot display all of the data. This allows you to more easily create a multi-column text layout.
Document Toolkit: http://firstfloorsoftware.com/documenttoolkit
SL5 Video: http://www.silverlight.net/learn/videos/all/silverlight-5-multi-column-linked-text/
SL5 Blog Post: http://10rem.net/blog/2011/04/13/silverlight-5-advancements-in-text

Silverlight 4 RichtTextBox - how do I get the text without the formatting?

How do I get the text out of a Silverlight 4 RichTextBox without the formatting? I know the Xaml property will give me the XAML but I just want the text.
This is a little late, but I will post anyway. There is a trick that involves selecting all the text in code and then accessing the Text propety of the TextSelection object. Like so:
myRichTextBox.SelectAll();
var plainText = myRichTextBox.Selection.Text;
I am using it in my apps and although it is not the prettiest solution, it works. Found it here:
http://forums.silverlight.net/forums/p/184560/422007.aspx
If you just want text, why not use TextBox instead?
There are various third-party components that support this kind of functionality (unfortunately paid). For example, Telerik's RadRichTextBox supports both highlighting and exporting rich text content as plain text, latter trough component called TxtFormatProvider.

XAML in WPF to tiff or eps

I am wondering if it is possible to create tiff/eps image from XAML in WPF.
We are looking for printing high resolution images from existing XAML in WPF.
Please let me know if you have any suggestions.
Depending on what exactly you're trying to do you might want to look at the xsl-fo stuff. The goal of creating printable markup is the same but fo uses xml instead of xaml. Depending on your requirements you might be able to create xsl-fo directly instead of xaml. If not, I'm pretty sure you can find xaml to svg translators (there are lots that go from svg to xaml) and I know that xsl-fo can handle svg. For the last step of taking the xsl-fo to tiff I've used the Ecrion software but I'm sure there are others by now that also do a good job. Hope that helps...