Search code examples
wpfxamllowercase

How to convert parts of a header to subscript in XAML?


In the following line I am having trouble with converting the number 2 in the header to subscript:

<telerik:GridViewDataColumn Header="H2O" Width="50" DataMemberBinding="{Binding SSE, Mode=OneWay}" IsReadOnly="True" />

How can i do this in xaml?

I know there is a lot of examples out there but i couldnt get anything to work in my case.


Solution

  • Put TextBlock in your Header and concatenate text from 3 element where one is Run with BaselineAlignment="Subscript"

    <telerik:GridViewDataColumn Width="50" DataMemberBinding="{Binding SSE, Mode=OneWay}" IsReadOnly="True">
        <telerik:GridViewDataColumn.Header>
            <TextBlock>
                H<Run BaselineAlignment="Subscript" FontSize="10">2</Run>O
            </TextBlock>
        </telerik:GridViewDataColumn.Header>
    </telerik:GridViewDataColumn>