Hello everyone! I hope this video has helped solve your questions and issues. This video is shared because a solution has been found for the question/problem. I create videos for questions that have solutions. If you have any other issues, feel free to reach out to me on Instagram: / ky.emrah
Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!FluentAvaloniaUI NavigationItem Icon
I'm developing a software in C# using Avalonia (It's the first time I've used it and I still have some difficulty).
I added the FluentAvaloniaUI nuget package for the controls and LucideAvalonia for the icons.
FluentAvaloniaUI
LucideAvalonia
navigationview binding works perfectly
ui:NavigationView MenuItemsSource="{Binding Items}"
ui:NavigationView.MenuItemTemplate
DataTemplate DataType="models:MainMenuItem"
ui:NavigationViewItem Content="{Binding Title}" IconSource="{Binding Icon}"/
/DataTemplate
/ui:NavigationView.MenuItemTemplate
/ui:NavigationView
ui:NavigationView MenuItemsSource="{Binding Items}"
ui:NavigationView.MenuItemTemplate
DataTemplate DataType="models:MainMenuItem"
ui:NavigationViewItem Content="{Binding Title}" IconSource="{Binding Icon}"/
/DataTemplate
/ui:NavigationView.MenuItemTemplate
/ui:NavigationView
this is the MainMenuItem model (I have an observable list in the viewmodel initialized in the constructor)
i would like to change the Icon type from string to LucideIconNames (Lucide icons enumerator)
public class MainMenuItem
{
public string Title { get; init; }
public string Icon { get; init; }
public Control View { get; init; }
}
public class MainMenuItem
{
public string Title { get; init; }
public string Icon { get; init; }
public Control View { get; init; }
}
but I'm not crazy about icons, so I would like to use the LucideAvalonia icons.
however the icon control of the NavigationViewItem is FluentAvalonia.UI.Controls.IconSource and I have difficulty changing it.
This is what i tryied in the UserControl.Styles, but obviously it doesn't work
Style Selector="uip|NavigationViewItemPresenter /template/ ContentPresenter#Icon"
Setter Property="Content"
Template
lucideAvalonia:Lucide Icon="House" StrokeBrush="SaddleBrown" /
/Template
/Setter
/Style
Style Selector="uip|NavigationViewItemPresenter /template/ ContentPresenter#Icon"
Setter Property="Content"
Template
lucideAvalonia:Lucide Icon="House" StrokeBrush="SaddleBrown" /
/Template
/Setter
/Style
Can anyone help me? even just with some hints.
Tags: c#,avaloniaui,avaloniaSource of the question:
https://stackoverflow.com/questions/7...
Question and source license information:
https://meta.stackexchange.com/help/l...
https://stackoverflow.com/