Skip to content

NavigationView IconSource #698

@Dxd4

Description

@Dxd4

Is your feature request related to a specific issue? Please describe it.
I don't understand: what are the available ways to change the icon size in a NavigationViewItem?

Describe your desired solution
I would like to be able to control IconSource parameters (especially size).

Describe the alternatives you considered
I tried:

  1. Changing the FontSize in the source data
  2. Creating my own Item content (this broke the layout of the elements, especially when expanding the panel)
  3. Applying styles (ViewBox IconBox Height, when changed in DevTools, produces the desired result, but the style setter doesn't change it for some reason)

Additional Context
NavigationPage:
public abstract class NavigationPage : NavigationPageBase
{
public string Name { get; set; } = string.Empty;
public IconSource Icon { get; set; }
public string ToolTip { get; set; } = string.Empty;
public bool IsFooter { get; set; } = false;
public abstract Type ViewModelType { get; }
}

ViewModel:
Pages =
[
new Common.Separator(),
new NavigationPage { Name = "Product", Icon = new SymbolIconSource { Symbol = Symbol.CalculatorFilled, Foreground=Brushes.ForestGreen, FontSize=32}, ToolTip = "Test tooltip"},
];
View:
<ui:NavigationView x:Name="nvMain"
PaneDisplayMode="LeftCompact"
MenuItemsSource="{Binding Pages}"
SelectedItem="{Binding SelectedPage}"
CompactPaneLength="64">
ui:NavigationView.MenuItemTemplateSelector
vmc:MenuItemTemplateSelector

<ui:NavigationViewItem IconSource="{Binding Icon}" Height="48" ToolTip.Tip="{Binding ToolTip}" Cursor="Hand" >

</ui:NavigationViewItem>

vmc:MenuItemTemplateSelector.SeparatorTemplate

<ui:NavigationViewItemSeparator />

</vmc:MenuItemTemplateSelector.SeparatorTemplate>
</vmc:MenuItemTemplateSelector>
</ui:NavigationView.MenuItemTemplateSelector>

ui:NavigationView.Content



</ui:NavigationView.Content>

</ui:NavigationView>

Thanks in advance for any replies (ideally with links to the information I need to research)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions