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

TitleBar Icon is missing #1345

Open
KnoerleMan opened this issue Feb 11, 2025 · 1 comment
Open

TitleBar Icon is missing #1345

KnoerleMan opened this issue Feb 11, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@KnoerleMan
Copy link

KnoerleMan commented Feb 11, 2025

Describe the bug

For me the Icon of the TitleBar is not shown when running the latest MVVM sample project.

I had to adjust the code from this:

<ui:TitleBar
            Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}"
            Grid.Row="0"
            Icon="pack://application:,,,/Assets/applicationIcon-256.png" />

To this:

<ui:TitleBar
            Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}"
            Grid.Row="0">
            <ui:TitleBar.Icon>
                <ui:ImageIcon>
                    <ui:ImageIcon.Source>
                        <BitmapImage UriSource="pack://application:,,,/Assets/applicationIcon-256.png" />
                    </ui:ImageIcon.Source>
                </ui:ImageIcon>
            </ui:TitleBar.Icon>
        </ui:TitleBar>

To make it work.

Does the samples need to be adjusted or am I doing something wrong?

Thanks in advance!

Regards,
Manuel

To Reproduce

Build and run the latest MVVM sample project.

Expected behavior

The window of the MVVM sample project displays the application icon in the title bar.

Screenshots

No response

OS version

Windows 10

.NET version

net8.0-windows

WPF-UI NuGet version

4.0.0

Additional context

No response

@KnoerleMan KnoerleMan added the bug Something isn't working label Feb 11, 2025
@chucker
Copy link
Collaborator

chucker commented Feb 16, 2025

Looks like this worked in 2.1.0 and broke in 3.0.0. I think this change was (sort of) intentional. In 2.x, Icon is an ImageSource, which is why you can directly assign a URL. In 3.0 and beyond, it's an IconElement, which is intended for things like Icon="{ui:SymbolIcon Symbol=Star24}".

@pomianowski do we want IconElementConverter to support taking a URL that will get passed to ImageSource instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants