0

I have a UserControl:

<UserControl x:Class="livetile.smalltile"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="159" d:DesignWidth="159">

    <Canvas x:Name="LayoutRoot" Background="Black" Width="159" Height="159">
        <TextBlock x:Name="day" Text="16" Width="159" TextAlignment="Center" FontSize="100" Foreground="White"/>
        <TextBlock x:Name="dayofweek" Text="Saturday" Width="159" TextAlignment="Center" Canvas.Top="100"FontSize="30" Margin="0,0,0,25" Foreground="White"/>
    </Canvas>
</UserControl>

Which I then convert to a WriteableBitmap:

public WriteableBitmap GetBmp()
{
    this.Measure(new Size(159, 159));
    this.Arrange(new Rect(0, 0, 159, 159));

    // draw bmp
    var bmp = new WriteableBitmap(159, 159);
    bmp.Render(this, null);
    bmp.Invalidate();

    return bmp;
}

I then use this WriteableBitmap to render an JPG and save it. The problem is the image only displays the background color of the canvas, and not the text in it... How can I solve this?

Philippe Maes
  • 510
  • 9
  • 26

1 Answers1

0

Looks like it had to do with a custom font I was using for my TextBlocks.

Philippe Maes
  • 510
  • 9
  • 26