Skip to content

Conversation

@punker76
Copy link
Collaborator

@punker76 punker76 commented Oct 3, 2024

Add support for BitmapImage or ImageSource which doesn't come from a Uri, via the existing IconSource property. With this we can use the image extension from https://github.com/MahApps/MahApps.Metro.IconPacks but also many other ways.

<tb:TaskbarIcon
    xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
    IconSource="{iconPacks:CooliconsImage Kind=Alarm, Brush=Chartreuse}">
</tb:TaskbarIcon>

2024-10-03_23h16_14

Add also support for a FrameworkElement as Icon source with the new property IconFrameworkElementSource.

<Grid>
    <Grid.Resources>
        <Grid x:Key="Icon" HorizontalAlignment="Center" VerticalAlignment="Center">
            <StackPanel Orientation="Horizontal">
                <TextBlock FontFamily="Cascadia Code" Text="4" Foreground="Chartreuse" />
                <TextBlock FontFamily="Cascadia Code" Margin="2 0" Text="2" Foreground="Tomato" />
            </StackPanel>
        </Grid>
    </Grid.Resources>

    <tb:TaskbarIcon
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
        IconFrameworkElementSource="{StaticResource Icon}"
    </tb:TaskbarIcon>
</Grid>

2024-10-04_13h12_24

Most of the source and idea is from @Lakritzator and this PR

Closes #24
Closes #71

@punker76 punker76 added the Fix label Oct 3, 2024
@punker76 punker76 added this to the 2.0.0 milestone Oct 3, 2024
@punker76 punker76 added the Enhancement New feature or request label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icons won't show when not using pack URIs

2 participants