lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.04k stars 667 forks source link

Icon is not working #1083

Closed tmdakm closed 1 month ago

tmdakm commented 1 month ago

Describe the bug

I added a button and a navigationviewitem in Dark theme window, and set their icon to "Home24", but it's not working. Light theme too ui:SymblolIcon is working.

To Reproduce

create new window and add

        <ui:NavigationView PaneDisplayMode="LeftFluent" IsPaneVisible="True">
            <ui:NavigationView.MenuItems>
                <ui:NavigationViewItem Content="Home" Icon="Home24"/>
            </ui:NavigationView.MenuItems>
        </ui:NavigationView>
        <ui:Button Icon="Home24" Content="Home" Margin="79,10,0,0" VerticalAlignment="Top"/>

to its xaml file.

Expected behavior

I can see icons in window

Screenshots

image

OS version

Windows 11

.NET version

.netframework 4.7.2

WPF-UI NuGet version

3.0.4 and 3.0.3

Additional context

No response

tmdakm commented 1 month ago

this is xaml file of the window:

<Window
        x:Class="LMC.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
        xmlns:controls="clr-namespace:Wpf.Ui.Controls;assembly=Wpf.Ui"
        xmlns:local="clr-namespace:LMC"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid Background="#FF1D1D1D">
        <ui:NavigationView PaneDisplayMode="LeftFluent" IsPaneVisible="True">
            <ui:NavigationView.MenuItems>
                <ui:NavigationViewItem Content="Home" Icon="Home24"/>
            </ui:NavigationView.MenuItems>
        </ui:NavigationView>
        <ui:Button Icon="Home24" Content="Home" Margin="79,10,0,0" VerticalAlignment="Top"/>
    </Grid>
</Window>
Fabi commented 1 month ago

Not only that. I think the whole navigation is broken? Icons not working and selecting items also does not work?

pomianowski commented 1 month ago

The Icon property of the NavigationViewItem requires IconElement, not the symbol name.

<ui:NavigationViewItem
  Content="Dashboard"
  NavigationCacheMode="Enabled"
  TargetPageType="{x:Type pages:DashboardPage}">
  <ui:NavigationViewItem.Icon>
    <ui:SymbolIcon Symbol="Home24" />
  </ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>