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

Proposal: Make Icon of NavigationViewItem templatable #3101

Open
JustinXinLiu opened this issue Aug 11, 2020 · 5 comments
Open

Proposal: Make Icon of NavigationViewItem templatable #3101

JustinXinLiu opened this issue Aug 11, 2020 · 5 comments
Assignees
Labels
area-NavigationView NavView control feature proposal New feature proposal team-Controls Issue for the Controls team

Comments

@JustinXinLiu
Copy link

Proposal: Make Icon of NavigationViewItem templatable

Summary

Make Icon a type of object that can take any element, and add an IconTemplate property that allows for full customization. The max width of the Icon element should respect the value of CompactPaneLength.

Rationale

  • The current Icon property only accepts elements of type IconElement, which limits its usage.

Scope

Capability Priority
This proposal will allow developers to display any type of elements they want in the Icon area. Must
@JustinXinLiu JustinXinLiu added the feature proposal New feature proposal label Aug 11, 2020
@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Aug 11, 2020
@Felix-Dev
Copy link
Contributor

Felix-Dev commented Aug 13, 2020

One specific example where this would be helpful is developers wanting to show a PersonPicture element as the leftmost element of a NavigationViewItem (see here and here for examples).

Due to the current restrictions of the NavigationViewItem.Icon API developers have to use the NavigationViewItem.Content API instead. If they want to show a content string next to the PdersonPicture, they will have to do all the work for that:

<NavigationViewItem>
    <NavigationViewItem.Content>
        <StackPanel Orientation="Horizontal">
            <PersonPicture Width="20" Height="20" />
            <TextBlock Text="Account" Margin="10,0,0,0" />
        </StackPanel>       
    </NavigationViewItem.Content>
</NavigationViewItem>

image

It would be better if developers could just do this instead:

<NavigationViewItem Content="Account">
    <NavigationViewItem.Icon>
        <PersonPicture Width="20" Height="20" />
    </NavigationViewItem.Icon>
</NavigationViewItem>

@MarcoEnxuto
Copy link

MarcoEnxuto commented Aug 13, 2020

Exactly. I read this post earlier, i found this would be the closest to my question #3116 Thanks again for your time @Felix-Dev

@StephenLPeters StephenLPeters added area-NavigationView NavView control team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Aug 13, 2020
@ad1Dima
Copy link
Contributor

ad1Dima commented Aug 29, 2020

I think this is better than #1488

@Javier118
Copy link

Hello:
you could add Svg support for icons in NavigationViewItem in this winUi3 version.

@ad1Dima
Copy link
Contributor

ad1Dima commented Oct 12, 2020

you could add Svg support for icons in NavigationViewItem in this winUi3 version.

@Javier118 In UWP ImageSource supports SVG files. If WinUI3 version of ImageSource doesn't support it, you'd better to make new proposal for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NavigationView NavView control feature proposal New feature proposal team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

8 participants