Page 1 of 1

Support for BaseAlignment for Inline elements

Posted: 11 May 2020, 14:46
by Joren
Hey,

Is there any support planned for BaseAlignment for Inline elements? (https://docs.microsoft.com/en-us/dotnet ... etcore-3.1)

We have a system in place that parses text and inserts icons and styling elements into the text. For icons inside a textblock, we use an InlineUIContainer with an image inside. However we have no control over how this image is positioned vertically. The default seems to follow the BaseLine, which doesn't look correct, especially when using different fonts. In our case Center or even Bottom would be the best case for us.

Attached an image that shows various values for BaseAlignment. Test Xaml below that mimics the output of the textparser (and is used in the image).
<StackPanel Orientation="Vertical" Background="DarkGray">
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="Top"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="Center"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="Bottom"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="Baseline"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="TextTop"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="TextBottom"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="Subscript"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
  <TextBlock>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
      <InlineUIContainer BaselineAlignment="Superscript"><Rectangle Fill="Orange" Width="20" Height="20"/></InlineUIContainer>
      <Span FontSize="20">
        <Run Text="test test"/>
     </Span>
  </TextBlock>
</StackPanel>
So yeah, is this something that is on the planning?

Re: Support for BaseAlignment for Inline elements

Posted: 12 May 2020, 01:39
by jsantos
Hi, thanks for the detailed information. Could you please create a ticket about this feature? We should have this implemented.

Re: Support for BaseAlignment for Inline elements

Posted: 12 May 2020, 11:38
by Joren
Thanks for your reply! Looking forward to this feature! Created #0001684

Re: Support for BaseAlignment for Inline elements

Posted: 12 May 2020, 12:49
by jsantos
Thanks for reporting!