Bonjour,

Je voudrais savoir si c'est possible de mieux afficher un icone contenant 3 chiffres superposés sur un icone de la barre des taches:

MainWindows xaml:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
<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="EpiTuile" Height="350" Width="525" Icon="icons8-notification-50.png" Closing="Window_Closing" Loaded="Window_Loaded" >
    <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>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="488*"/>
            <ColumnDefinition Width="29*"/>
        </Grid.ColumnDefinitions>
        <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,23.842,22" Source="icons8-notification-50.png" Stretch="Fill"/>
    </Grid>
</Window>
Code pour afficher le nombre en superposition de l'icone dans la barre des taches
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
private void DisplayNumberAlert(string NumberAlert)
        {
            int _iconWidth = 40;
            int _iconHeight = 40;
 
            string _countText = NumberAlert;
 
            RenderTargetBitmap _bmp =
                new RenderTargetBitmap(_iconWidth, _iconHeight, 96, 96, PixelFormats.Default);
 
            ContentControl _root = new ContentControl
            {
                ContentTemplate = ((DataTemplate)Resources["OverlayIcon"]),
                Content = _countText,
            };
            _root.Arrange(new Rect(0, 0, _iconWidth, _iconHeight));
 
            _bmp.Render(_root);
 
            TaskbarItemInfo.Overlay = (ImageSource)_bmp;
        }
Auriez-vous une idée pour rendre l'affichage plus lisible ?

D'avance merci