xaml - How do I make an asterisk line up with surrounding text in WPF? -


I am trying to create an asterisk line with text / graphics rather than above.

I thought there would be a solution to implement a negative baseline offset, but it does not have any effect.

Here is the document for TextBlock. Basel Offset Properties:

Property Price Type: System. Double

The amount by which each line of the text is offset from the baseline, double the free pixels in the device. NN indicates that an optimal baseline offset is automatically calculated from the current font attributes. The default is double. Nan

Remarks

The baseline is the imaginary horizontal line with the base of each character> the line of text is aligned.

Sample markup:

  & lt; TextBlock Name = "Reader Indicator" Grid. Column = "0" vertical alignment = "center" fontweit = "bold" fontSize = "24" baseline offset = "-10" text = "*" />  

Question:

  1. Why is not the baseline offset for me? Am I using it incorrectly or is there a bug in this framework?

  2. How can I go below the asterisk without using margin (which will make the top of the text block, < / Div>

    As far as I know TextBlock.BaselineOffset only TextBlock In any other TextBlock :

      TextBlock> some text  Gt; & lt; / TextBlock & gt;   

    Adjustment BaseLineOffset to move vertical in relation to "some text" Note that BaseLineOffset is indicated by Double.NaN is different from 0 and you probably need a positive offset to avoid the star .

    But as you have indicated in your comment using BaseLineOffset that this is not a good solution, the problem is that the asterisk glyph is not according to your liking. I can suggest that you switch to your own glyph made in WPF with proper placement and put them next to the text by using something like StackPanel next to the line .


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -