Blessed Geek
Blessed Geek

Reputation: 21664

How to overlay Segoe MDL2 Assets glyphs for use in WPF TreeViewItem.Header?

I just read about overlaying glyphs. I am trying it out. This is the simplified xaml portion to compose the TreeViewItem.Header

<TreeViewItem.Header>
  <StackPanel Orientation="Horizontal">
    <TextBlock Name="icon" FontFamily="Segoe MDL2 Assets"
       Text="&#xED0D;" Foreground="Blue" Background="cyan" />
    <TextBlock Name="title"/>
  </StackPanel>
</TreeViewItem.Header>

It produces a header containing glyph ED0D like this:
enter image description here

However, I would like to overlay ED0C enter image description here onto glyph ED0D.

What avenues are available to me to perform such overlay to be used in the TreeViewItem.Header?

Upvotes: 0

Views: 377

Answers (1)

Clemens
Clemens

Reputation: 128067

Put two TextBlocks on top of each other:

<StackPanel Orientation="Horizontal">
    <Grid TextElement.FontFamily="Segoe MDL2 Assets">
        <TextBlock Text="&#xED0C;" Foreground="Cyan"/>
        <TextBlock Text="&#xED0D;" Foreground="Blue"/>
    </Grid>

   <TextBlock x:Name="title"/>
</StackPanel>

Result:

enter image description here

Upvotes: 3

Related Questions