WPF наложение иконок с 3 цифрами

Я пытаюсь поместить 3 числа в наложенной иконке на панели задач

Мне было интересно, если бы не было способа сделать лучше с точки зрения размера, чтобы хорошо читать цифры, когда есть 3 цифры (боюсь, это нечитаемо) Можно ли сделать лучше?

<Window x:Class="EpiTuile.MainWindow"
    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"
    xmlns:local="clr-namespace:EpiTuile"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525" Icon="icons8-notification-50.png">
<Window.TaskbarItemInfo>
    <TaskbarItemInfo />
</Window.TaskbarItemInfo>
<Window.Resources>
    <DataTemplate x:Key="OverlayIcon">
        <Grid Width="40" Height="40">
            <Ellipse Fill="White"
                    Stroke="Green"
                    StrokeThickness="2"/>
            <TextBlock Text="{Binding}"
                    TextAlignment="Center"
                    Foreground="Black"
                    FontWeight="Regular"
                    Height="22"
                    VerticalAlignment="Center"
                    FontSize="20">
                <TextBlock.Effect>
                    <DropShadowEffect ShadowDepth="0" />
                </TextBlock.Effect>
            </TextBlock>
        </Grid>
    </DataTemplate>
</Window.Resources>
<Grid>
    <TextBlock Height="23"
            HorizontalAlignment="Left"
            Margin="22,71,0,0"
            x:Name="textBlock1"
            Text="Count"
            VerticalAlignment="Top" />
    <TextBox Height="23"
            HorizontalAlignment="Left"
            Margin="92,68,0,0"
            x:Name="EnteredCount"
            VerticalAlignment="Top"
            Width="120" />
    <Button Content="Update"
        Height="23"
        HorizontalAlignment="Left"
        Margin="92,105,0,0"
        x:Name="UpdateCount"
        VerticalAlignment="Top"
        Width="75" Click="UpdateCount_Click" />
    <Image x:Name="icons8_notification_50_png" Margin="414,247,53,22" Source="icons8-notification-50.png" Stretch="Fill"/>
</Grid>

код моей кнопки: private void UpdateCount_Click(отправитель объекта, RoutedEventArgs e) { int iconWidth = 40; int iconHeight = 40;

        string countText = EnteredCount.Text.Trim();

        RenderTargetBitmap bmp =
            new RenderTargetBitmap(iconWidth, iconHeight, 96, 96, PixelFormats.Default);

        ContentControl root = new ContentControl();

        root.ContentTemplate = ((DataTemplate)Resources["OverlayIcon"]);
        root.Content = countText;

        root.Arrange(new Rect(0, 0, iconWidth, iconHeight));

        bmp.Render(root);

        TaskbarItemInfo.Overlay = (ImageSource)bmp;
    }

заранее спасибо

0 ответов

Другие вопросы по тегам