Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for different types of ImageSource #115

Merged
merged 2 commits into from
Oct 4, 2024
Merged

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
@punker76 punker76 force-pushed the feature/iconsource branch from 4b90618 to 3bc80c0 Compare October 4, 2024 11:47
@punker76 punker76 merged commit 984e3fa into develop Oct 4, 2024
1 check passed
@punker76 punker76 deleted the feature/iconsource branch October 4, 2024 11:52
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
1 participant