amwx / fluentavalonia Goto Github PK
View Code? Open in Web Editor NEWControl library focused on fluent design and bringing more WinUI controls into Avalonia
License: MIT License
Control library focused on fluent design and bringing more WinUI controls into Avalonia
License: MIT License
Hi, I recently stumbled upon this repository and am eager to test it. Do you have a nuget package available to easily add this library to other projects? If not, I'd be happy to manage a dev package a nuget for you instead.
Hello,
I noticed there's a nice new window style in the demo application matching the Fluent UI UWP example app.
While I know I can copy the style into my own project it might be a nice addition to the library to have this available publicly.
I looked at the code and it seems like it falls back gracefully to a default window style in non-Windows platforms, so I think it would be a simple change to make it public :)
There's currently no datagrid styles. Because of that, the avalonia default fluent theme must be specified before v2 themes before datagrid can renderer.
There is also a chance switching themes would crash when datagrid is populated in this way. It doesn't occur with only fluent v1 specified.
Exception;
at Avalonia.Data.BindingValue`1.FromUntyped(Object value) in /_/src/Avalonia.Base/Data/BindingValue.cs:line 250
at Avalonia.Styling.PropertySetterBindingInstance`1.Inner.OnNext(Object value) in /_/src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs:line 191
at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value) in /_/src/Avalonia.Base/Reactive/LightweightObservableBase.cs:line 138
at Avalonia.StyledElement.NotifyResourcesChanged(ResourcesChangedEventArgs e, Boolean propagate) in /_/src/Avalonia.Styling/StyledElement.cs:line 843
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.Controls.Primitives.TemplatedControl.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Controls/Primitives/TemplatedControl.cs:line 298
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.Controls.Primitives.TemplatedControl.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Controls/Primitives/TemplatedControl.cs:line 298
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.StyledElement.NotifyChildResourcesChanged(ResourcesChangedEventArgs e) in /_/src/Avalonia.Styling/StyledElement.cs:line 536
at Avalonia.Utilities.WeakSubscriptionManager.Subscription`1.OnEvent(Object sender, T eventArgs) in /_/src/Avalonia.Base/Utilities/WeakSubscriptionManager.cs:line 184
at Avalonia.Controls.ResourceDictionary.Avalonia.Controls.IResourceProvider.RemoveOwner(IResourceHost owner) in /_/src/Avalonia.Styling/Controls/ResourceDictionary.cs:line 174
at Avalonia.Styling.Styles.Avalonia.Controls.IResourceProvider.RemoveOwner(IResourceHost owner) in /_/src/Avalonia.Styling/Styling/Styles.cs:line 253
at FluentAvalonia.Styling.FluentAvaloniaTheme.set_RequestedTheme(String value)
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 152
at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 101
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 122
at Avalonia.Controls.Button.OnClick() in /_/src/Avalonia.Controls/Button.cs:line 307
at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 145
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 148
at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 101
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 122
at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers) in /_/src/Avalonia.Input/MouseDevice.cs:line 303
at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) in /_/src/Avalonia.Input/MouseDevice.cs:line 149
at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Input/InputManager.cs:line 34
at Avalonia.X11.X11Window.<ScheduleInput>b__120_0() in /_/src/Avalonia.X11/X11Window.cs:line 718
at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 169
at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 245
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 105```
Great job you have done! Love it!
MenuItems are loaded according to the other Issue i filed. Thanks for the help with that!.
The problem is that if I load them with a "Initialized += MainWindow_Loaded;" event, there are no items showing up in the NavigationView. Only if I load them directly in the constructor.
This is working, even if sometimes the last Item does not show any Content until clicking back and forward on the items.
`public MainViewModel(INavigationLookupDataService navigationLookupDataService)
{
_navigationLookupDataService = navigationLookupDataService;
MenuItems = new ObservableCollection<LookupItem>();
LoadNavigationLookupAsync();
}`
This is not working, no MenuItems are showing up:
`public MainWindow()
{
var container = ((App)Application.Current).Container;
ViewModel = (MainViewModel?) ActivatorUtilities.GetServiceOrCreateInstance(container, typeof(MainViewModel));
Initialized += MainWindow_Loaded;
AvaloniaXamlLoader.Load(this);
#if DEBUG
this.AttachDevTools();
#endif
}
private async void MainWindow_Loaded(object? sender, EventArgs e)
{
await ViewModel.LoadAsync();
}`
`public MainViewModel(INavigationLookupDataService navigationLookupDataService)
{
_navigationLookupDataService = navigationLookupDataService;
MenuItems = new ObservableCollection<LookupItem>();
//LoadNavigationLookupAsync();
}
public async Task LoadAsync()
{
await LoadNavigationLookupAsync(); // Fires, I have checked!
}`
I have a CommandBar designed as follows:
<ui:CommandBar HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0,40,0,0" DefaultLabelPosition="Right">
<ui:CommandBar.Content>
<TextBlock Margin="6,12,6,0" Text="{Binding Status}"/>
</ui:CommandBar.Content>
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarSeparator />
<ui:CommandBarButton Label="Select Save Folder" Icon="OpenLocal"/>
<ui:CommandBarButton Label="Download Video" Icon="Download"/>
<ui:CommandBarSeparator />
<ui:CommandBarButton Label="Back" Icon="Back"/>
<ui:CommandBarButton Label="Forward" Icon="Forward"/>
<ui:CommandBarButton Label="Refresh" Icon="Refresh"/>
<ui:CommandBarButton Label="Home" Icon="Home"/>
<ui:CommandBarSeparator />
<ui:CommandBarButton Label="Settings" Icon="Settings" Command="{Binding SettingsCommand}"/>
</ui:CommandBar.PrimaryCommands>
</ui:CommandBar>
When the application is running, the CommandBar looks normal:
However, if the window is resized smaller and the command overflow to the secondary commands menu, the commands then become out of order as so:
Hi @amwx
I like the demo app very much as it is really helpful 👍 . While playing around I was wondering if syntax highlighting and copy-support would be good.
I tried out some things and found that AvaloniaEdit might be helpful:
See: https://github.com/AvaloniaUI/AvaloniaEdit
I have a branch for this here: https://github.com/timunie/FluentAvalonia/tree/feature/ImproveDemoApp
If you like this idea I can work on the branch more and send a PR.
Happy coding
Tim
Hello,
I used the updated styles to refresh the look of my Avalonia app, and it is awesome.
However, my Avalonia NumericUpDown
is not rendered, and in addition, some HorizontalAlignment="Right"
are not working anymore.
Before / After of my little Avalonia App :
Any clue about these issues ?
Thank you in advance
Call of this method (Win32Interop.GetThemeColorRef) causes crash on Win7. It is not possible to get an accent color on Win7. As a hotfix, you can set GetUserAccentColor="false" to let the application run on Win 7. But then the accent color on Windows 10 is not applied.
Hi,
I'm having a simple DataGrid with a ContextMenu for rows, but using FluentAvalonia is breaking the displaying of the ContextMenu. It doesn't display anymore.
`
<Application.DataTemplates>
local:ViewLocator/
</Application.DataTemplates>
<Application.Styles>
<!--
Default for Avalonia
(Requested to allow ContextMenu to work on DataGrid)
But including the avalonia style bellow break the Expander header color for example.
-->
<!--<FluentTheme Mode="Light"/>
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>-->
<!-- FluentUI for Avalonia -->
<sty:FluentAvaloniaTheme/>
</Application.Styles>
If I want the ContextMenu to be displayed with a right click, I have to uncomment the Avalonia Styles in the App.axaml, but it requires to select a theme which is done automatically by FluentAvalonia. Then, if I let the both declarations, it breaks other visual aspects (Expander header foreground for example).
I have no idea what could prevent the ContextMenu to be displayed looking at the DataGrid styles definitions.
Thanks for your help.
I have attached the project sample.
AvaloniaApplication2.zip
Tested on kubuntu 21.04.
Steps to reproduce:
dotnet new avalonia.mvvm -o MyApp
1.1.2
to .csproj
and corresponding minimal lines to App.axaml
:<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp"
x:Class="MyApp.App"
xmlns:sty="using:FluentAvalonia.Styling"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:uip="using:FluentAvalonia.UI.Controls.Primitives"
>
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
<Application.Styles>
<FluentTheme Mode="Dark"/>
<sty:FluentAvaloniaTheme ControlsVersion="2" RequestedTheme="Dark" />
</Application.Styles>
</Application>
MainWindow.axaml
's textbox with the following grid:<Grid ColumnDefinitions="Auto,*,Auto">
<ToggleSwitch Grid.Column="0" Content="Left switch"/>
<ToggleSwitch Grid.Column="2" HorizontalAlignment="Right" Content="Right switch"/>
</Grid>
Results without/with FluentAvalonia:
Describe the bug
In Avalonia there was a change which breaks the style for CalendarDatePicker. The DropDown needs to use TemplateBinding
for additional properties now.
Screenshots
See AvaloniaUI/Avalonia#7162
Desktop (please complete the following information):
Additional context
See AvaloniaUI/Avalonia#7162 and AvaloniaUI/Avalonia#7194 for more Info
I'll post a PR for fixing this.
Happy coding
Tim
Just pulled the repo and getting this when trying to run the sample app (using Rider 2021.1.3):
System.InvalidOperationException: The Styles already has a owner.
at Avalonia.Styling.Styles.Avalonia.Controls.IResourceProvider.AddOwner(IResourceHost owner) in /_/src/Avalonia.Styling/Styling/Styles.cs:line 230
at FluentAvalonia.Styling.FluentAvaloniaTheme.Avalonia.Controls.IResourceProvider.AddOwner(IResourceHost owner) in F:\source\temp\FluentAvalonia\FluentAvalonia\Styling\Core\FluentAvaloniaTheme.cs:line 220
at Avalonia.Styling.Styles.<OnCollectionChanged>g__Add|52_1(IList items) in /_/src/Avalonia.Styling/Styling/Styles.cs:line 289
at Avalonia.Styling.Styles.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Styling/Styling/Styles.cs:line 318
at Avalonia.Collections.AvaloniaList`1.NotifyAdd(T item, Int32 index) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 680
at Avalonia.Collections.AvaloniaList`1.Add(T item) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 205
at Avalonia.Styling.Styles.Add(IStyle item) in /_/src/Avalonia.Styling/Styling/Styles.cs:line 201
at FluentAvaloniaSamples.App.!XamlIlPopulate(IServiceProvider , App ) in F:\source\temp\FluentAvalonia\FluentAvaloniaSamples\App.axaml:line 22
at FluentAvaloniaSamples.App.!XamlIlPopulateTrampoline(App )
at FluentAvaloniaSamples.App.Initialize() in F:\source\temp\FluentAvalonia\FluentAvaloniaSamples\App.axaml.cs:line 13
at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 310
at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime) in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 179
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 147
at FluentAvaloniaSamples.Program.Main(String[] args) in F:\source\temp\FluentAvalonia\FluentAvaloniaSamples\Program.cs:line 12
Not sure what this could be related to
I re-built the Segoe Fluent font using the Fluent UI System icons that are open source. I notice you are using Fluent UI System fonts and Unicode points as well with this project for the SymbolIcon.
Would you like to switch to use the replacement font created here?
https://github.com/robloo/SymbolIconManager/blob/main/Fonts/WinSymbols3.ttf
https://github.com/robloo/SymbolIconManager
Aside from being smaller in size and only 1 file, it would standardize all the Unicode points with WinUI upstream and align the glyphs for the most part with Fluent version 2 (the same ones you are using now since Segoe Fluent and Fluent UI System Icons are very similar).
The goal here is for every non-Microsoft XAML framework to use the same Segoe Fluent font replacement. Anyone can contribute mappings to share with others as well:
https://github.com/robloo/SymbolIconManager/blob/main/Source/Data/Mappings/SegoeFluent.json
https://github.com/robloo/SymbolIconManager/blob/main/Docs/IconMapping.md
I know that FluentAvalonia follows the WinUI design pattern, but would it still be possible to make an animation like in Material Design?
Source:
Material.Avalonia
Please check DMs on telegram!
When selecting MenuItems back and forward an error occurs.
I have also tried using code behind and Bindings instead of CompiledBindings, same result.
IDE: Rider
Manjaro
This nuget package (unofficial)
This is how my Test Project set it up.
XAML:
`
<Window.Resources>
<DataTemplate x:Key="NaviItemTemplate" x:DataType="controls:NavigationViewItem">
<controls:NavigationViewItem MenuItems="{CompiledBinding MenuItems}"
Content="{CompiledBinding Name}"
Tag="{CompiledBinding Tag}" />
</DataTemplate>
</Window.Resources>
<controls:NavigationView Name="NavView"
MenuItemTemplate="{StaticResource NaviItemTemplate}"
MenuItems="{CompiledBinding MenuItems}"
SelectedItem="{CompiledBinding SelectedItem, Mode=TwoWay}">
<controls:Frame Name="ContentFrame" Margin="5" />
</controls:NavigationView>
C#:
`
public MainViewModel()
{
MenuItems = new ObservableCollection();
// Static list with dummy data
var projects = ProjectLookupDataService.GetProjectLookup();
var symbol = new SymbolIcon {Symbol = Symbol.Home};
MenuItems.Clear();
foreach (var project in projects)
{
MenuItems.Add(new NavigationViewItem
{
Name = project.DisplayMember,
Icon = symbol,
Tag = project.Id,
MenuItems = GetSystemNamesByProjectId(project.Id)
});
}
}
private ObservableCollection GetSystemNamesByProjectId(int projectId)
{
var systemNameList = SystemNameLookupDataService.GetSystemNameLookup();
var systemNames = systemNameList.Where(p => p.ProjectId == projectId);
var items = new ObservableCollection();
var symbol = new SymbolIcon {Symbol = Symbol.Home};
foreach (var systemName in systemNames)
{
items.Add(new NavigationViewItem
{
Name = systemName.DisplayMember,
Icon = symbol,
Tag = systemName.Id,
MenuItems = GetDrawingsBySystemNameId(systemName.Id)
});
}
return items;
}
private ObservableCollection<NavigationViewItem> GetDrawingsBySystemNameId(int systemNameId)
{
var drawingList = DrawingLookupDataService.GetDrawingLookup();
var drawings = drawingList.Where(p => p.SystemNameId == systemNameId);
var items = new ObservableCollection<NavigationViewItem>();
var symbol = new SymbolIcon {Symbol = Symbol.Home};
foreach (var drawing in drawings)
{
items.Add(new NavigationViewItem
{
Name = drawing.DisplayMember,
Icon = symbol,
Tag = drawing.Id,
MenuItems = new ObservableCollection<NavigationViewItem>()
});
}
return items;
}
`
Error Message:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List1.get_Item(Int32 index) at FluentAvalonia.UI.Controls.IndexPath.GetAt(Int32 index) at FluentAvalonia.UI.Controls.NavigationView.FindLowestLevelContainerToDisplaySelectionIndicator() at FluentAvalonia.UI.Controls.NavigationView.ShowHideChildrenItemsRepeater(NavigationViewItem nvi) at FluentAvalonia.UI.Controls.NavigationView.OnNavigationViewItemExpandedPropertyChanged(AvaloniaPropertyChangedEventArgs args) at System.Reactive.AnonymousObserver
1.OnNextCore(T value) in //Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67
at System.Reactive.ObserverBase1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 34 at Avalonia.Reactive.LightweightObservableBase
1.PublishNext(T value) in //src/Avalonia.Base/Reactive/LightweightObservableBase.cs:line 138
at Avalonia.Reactive.AvaloniaPropertyChangedObservable.PropertyChanged(Object sender, AvaloniaPropertyChangedEventArgs e) in //src/Avalonia.Base/Reactive/AvaloniaPropertyChangedObservable.cs:line 42
at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaPropertyChangedEventArgs1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 720 at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty
1 property, Optional1 oldValue, BindingValue
1 newValue, BindingPriority priority) in //src/Avalonia.Base/AvaloniaObject.cs:line 632
at Avalonia.AvaloniaObject.SetAndRaise[T](AvaloniaProperty1 property, T& field, T value) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 662 at FluentAvalonia.UI.Controls.NavigationViewItem.set_IsExpanded(Boolean value) at FluentAvalonia.UI.Controls.NavigationView.ChangeIsExpandedNavigationViewItem(NavigationViewItem nvi, Boolean isExpanded) at FluentAvalonia.UI.Controls.NavigationView.ToggleIsExpandedNavigationViewItem(NavigationViewItem nvi) at FluentAvalonia.UI.Controls.NavigationView.OnNavigationViewItemInvoked(NavigationViewItem nvi) at FluentAvalonia.UI.Controls.NavigationView.OnNavigationViewItemTapped(Object sender, RoutedEventArgs e) at Avalonia.Interactivity.Interactive.<AddHandler>g__InvokeAdapter|4_0[TEventArgs](Delegate baseHandler, Object sender, RoutedEventArgs args) in /_/src/Avalonia.Interactivity/Interactive.cs:line 60 at Avalonia.Interactivity.Interactive.<>c__4
1.b__4_1(Delegate baseHandler, Object sender, RoutedEventArgs args) in //src/Avalonia.Interactivity/Interactive.cs:line 66
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in //src/Avalonia.Interactivity/EventRoute.cs:line 167
at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in //src/Avalonia.Interactivity/EventRoute.cs:line 101
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in //src/Avalonia.Interactivity/Interactive.cs:line 120
at Avalonia.Input.Gestures.PointerReleased(RoutedEventArgs ev) in //src/Avalonia.Input/Gestures.cs:line 109
at System.Reactive.AnonymousObserver1.OnNextCore(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67 at System.Reactive.ObserverBase
1.OnNext(T value) in //Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 34
at System.Reactive.Subjects.Subject1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 147 at Avalonia.Interactivity.RoutedEvent.InvokeRouteFinished(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/RoutedEvent.cs:line 104 at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 102 at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 120 at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers) in /_/src/Avalonia.Input/MouseDevice.cs:line 306 at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) in /_/src/Avalonia.Input/MouseDevice.cs:line 173 at Avalonia.Input.MouseDevice.ProcessRawEvent(RawInputEventArgs e) in /_/src/Avalonia.Input/MouseDevice.cs:line 86 at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Input/InputManager.cs:line 35 at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e) in /_/src/Avalonia.Controls/TopLevel.cs:line 476 at Avalonia.X11.X11Window.<ScheduleInput>b__120_0() in /_/src/Avalonia.X11/X11Window.cs:line 719 at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 166 at Avalonia.Threading.JobRunner.RunJobs(Nullable
1 priority) in //src/Avalonia.Base/Threading/JobRunner.cs:line 37
at Avalonia.Threading.Dispatcher.RunJobs() in //src/Avalonia.Base/Threading/Dispatcher.cs:line 69
at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) in //src/Avalonia.X11/X11PlatformThreading.cs:line 199
at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in //src/Avalonia.X11/X11PlatformThreading.cs:line 245
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in //src/Avalonia.Base/Threading/Dispatcher.cs:line 61
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in //src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 107
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 134
at SomeApp.UI.Program.Main(String[] args) in SomeApp/SomeApp.UI/Program.cs:line 18
When I set the NavigationView.FooterMenuItems property
When run, an exception occurs at https://github.com/amwx/FluentAvalonia/blob/master/FluentAvalonia/UI/Controls/NavigationView/NavigationView.cs#L816.
Why the code comments :
https://github.com/amwx/FluentAvalonia/blob/master/FluentAvalonia/UI/Controls/NavigationView/NavigationView.cs#L804
After I uncomment it, there is no problem
By default the accent color on Windows is blue and on Linux it's a purple-ish color. Is there a way we can change the accent color used throughout the application?
So first, awesome work @amwx!! It's great to see someone take this up and it's sorely needed for those of us committed to WinUI but looking at Avalonia for future ports (it's the most stable macOS/Linux desktop option on the market).
I know the Avalonia Core team has reached out to you but wonder if you can share the strategy for this library? As I see it several of these core controls should end up in Avalonia UI itself (perhaps not with the latest styles). This project would still likely be needed to:
Controls that are prime candidates for Avalonia inclusion in my option are:
For the buttons (SplitButton/ToggleSplitButton, etc.) I was planning to port those over myself. However, you have done the vast majority of the work including Flyouts, awesome! Do you have any concerns if I use your code and try to get these into Avalonia itself? Obviously, I'll need to adjust the styles, but most of the code-behind will likely be copy-pasted verbatim. I would only double check with latest WinUI.
Really can't understand why (hope I didn't miss any new flag), but was able to repro it in a small project.
Since version 1.1.5, all animations are very laggy/stuck, it's solved after some time.
Here's the repro solution -
FluentAvaloniaAnimationBug1.1.5.zip
Or code here -
App.xaml
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styling="clr-namespace:FluentAvalonia.Styling;assembly=FluentAvalonia"
x:Class="Avalonia.NETCoreApp2.App">
<Application.Styles>
<styling:FluentAvaloniaTheme
RequestedTheme="Light" />
</Application.Styles>
</Application>
MainWindow.xaml
<Window xmlns="https://github.com/avaloniaui"
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"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Avalonia.NETCoreApp2.MainWindow"
Title="Avalonia.NETCoreApp2">
<ProgressBar IsIndeterminate="True" Width="100" Foreground="Red"/>
</Window>
Csproj
<PackageReference Include="FluentAvaloniaUI" Version="1.1.6" />
It is using ProgressBar
, run it, the ProgressBar
will not move at all.
Change the FluentAvaloniaUI
package to 1.1.3
or below to see the animation being fixed.
The select item is not shown in the textbox of the editable combo box while textbox is focused. It appears while you have the mouse pressed down on the item or while another input control is focused
Could we see the Expander control ported from WinUI?
https://docs.microsoft.com/en-us/windows/apps/design/controls/expander
The font family of the default font released in windows 11 is Segoe UI Variable
and not Segoe UI Variable Text
. This prevents non avalonia controls that try to use the same font to fail if it picks the font family from the window class.
See description at: AvaloniaUI/Avalonia#6633
I believe it might be related to this library as using ControlsVersion="1"
seems to not be as blurry as Version 2
Hi, I'm trying to create a custom Dialog that extends a ContentDialog. My xaml and c# are below:
<ui:ContentDialog x:Class="NickvisionApp.Views.WelcomeDialog"
xmlns="https://github.com/avaloniaui"
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="using:FluentAvalonia.UI.Controls"
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="400"
Title="Welcome" PrimaryButtonText="Finish" CloseButtonText="Close" DefaultButton="Close"
Width="600" Height="400">
<StackPanel>
</StackPanel>
</ui:ContentDialog>
using Avalonia.Markup.Xaml;
using FluentAvalonia.UI.Controls;
namespace NickvisionApp.Views
{
public class WelcomeDialog : ContentDialog
{
public WelcomeDialog()
{
AvaloniaXamlLoader.Load(this);
}
}
}
Microsoft with new WinUI has created a new TabView
that replaces TabControl
(https://docs.microsoft.com/en-us/windows/apps/design/controls/tab-view) The old TabControl
is known as a Pivot
(https://docs.microsoft.com/en-us/windows/apps/design/controls/pivot)
Could we see these updated controls in this library?
Very nice Controls!
ComboBox is ported from WinUI too right?
What happened to DisplayMemberPath, SelectedValue & SelectedValuePath ???
Do you have implemented something similar?
Hi,
Using a NavigationView, every time I navigate from page to page, each page loose its visual tree state.
If for example, on page one, you have scrolled down to the page, when you get back to it, the visual state is restored as if it was the first time displayed.
Is there a workaround for that, or is a planned feature ?
Best Regards,
François
The placeholder text of a combo box is only shown when the cursor hovers over the combo box.
Without mouse cursor hovering:
Here is my XAML:
<ComboBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="8,154,0,0" Width="320" PlaceholderText="Select file format"/>
(Snipping Tool does not show the mouse cursor in screenshots)
Numberbox does not update the bound property when the value changes, even if TwoWay mode is set for it. This occurs for both autoproperties and full properties.
@amwx Could you investigate this?
When using Tab to navigate, and a content dialog is next to be tested for tabstop, it throws an exception.
at Avalonia.Input.KeyboardNavigation.GetIsTabStop(InputElement element) in /_/src/Avalonia.Input/KeyboardNavigation.cs:line 102
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 128
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at Avalonia.Input.Navigation.TabNavigation.GetFocusableDescendants(IInputElement element, NavigationDirection direction)+MoveNext() in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 126
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 253
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetFirstInNextContainer(IInputElement element, IInputElement container, NavigationDirection direction) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 263
at Avalonia.Input.Navigation.TabNavigation.GetNextInTabOrder(IInputElement element, NavigationDirection direction, Boolean outsideElement) in /_/src/Avalonia.Input/Navigation/TabNavigation.cs:line 54
at Avalonia.Input.KeyboardNavigationHandler.GetNext(IInputElement element, NavigationDirection direction) in /_/src/Avalonia.Input/KeyboardNavigationHandler.cs:line 78
at Avalonia.Input.KeyboardNavigationHandler.Move(IInputElement element, NavigationDirection direction, KeyModifiers keyModifiers) in /_/src/Avalonia.Input/KeyboardNavigationHandler.cs:line 99
at Avalonia.Input.KeyboardNavigationHandler.OnKeyDown(Object sender, KeyEventArgs e) in /_/src/Avalonia.Input/KeyboardNavigationHandler.cs:line 123
at Avalonia.Interactivity.Interactive.<AddHandler>g__InvokeAdapter|4_0[TEventArgs](Delegate baseHandler, Object sender, RoutedEventArgs args) in /_/src/Avalonia.Interactivity/Interactive.cs:line 62
at Avalonia.Interactivity.Interactive.<>c__4`1.<AddHandler>b__4_1(Delegate baseHandler, Object sender, RoutedEventArgs args) in /_/src/Avalonia.Interactivity/Interactive.cs:line 68
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 167
at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 101
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 122
at Avalonia.Input.KeyboardDevice.ProcessRawEvent(RawInputEventArgs e) in /_/src/Avalonia.Input/KeyboardDevice.cs:line 229
at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Input/InputManager.cs:line 35
at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e) in /_/src/Avalonia.Controls/TopLevel.cs:line 476
at Avalonia.X11.X11Window.<ScheduleInput>b__120_0() in /_/src/Avalonia.X11/X11Window.cs:line 719
at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 166
at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
at Avalonia.Threading.Dispatcher.RunJobs() in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 69
at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 199
at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 245
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 116
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 148
at FluentAvaloniaSamples.Program.Main(String[] args) in /home/aa/personal/FluentAvalonia/FluentAvaloniaSamples/Program.cs:line 12```
Calling RemoveOwner on FluentAvaloniaTheme does not unset the Owner property, making it impossible to hot swap the base theme to another.
Hello again,
Is there a way we can add a header to a textbox control similarly to WinUI. There is already the watermark feature but no header. Maybe like a textbox helper where we could do:
<TextBox ... ui:TextBoxHelper.Header="Name"/>
Hello,
It's possible to have more buttons than Primary, Secondary or Close?
Can I have a button with a custom command? An example is to have several buttons on the Dialog that will change what is happening in the dialog.
I thought that I could use a Custom UserControl with as many buttons as I want, but, I have to define the button any way.
Is this possible?
best regards
Paulo Aboim Pinto
This is more of a question than an issue.
With UWP / WINUI you can send a parameter "ContentFrame.Navigate(Type, parameter)" and receive it through "OnNavigatedto(NavigationEventArgs e)". Have you implemented something similar?
Hi @amwx
I have a ContentDialog
which has a UserControl
as content. I would like to perform the closing action when the user hits Enter
, but only if the password box has focus and has any text. This is not so easy at the moment
StyledProperties
called CancelOnEscape [bool]
and DefaultOnEnter [bool]
and handle these in the KeyDown
or KeyUp
-EventHide()
which accepts a close reason, like Hide(ContentDialogResult result)
which closes the dialog and returns the given resultWhich solution do you like best? I would be happy to provide the needed PR.
Happy coding
Tim
I'm testing out the current V1.1.0 release and I love it, really amazing work!
However, I just had some suggestions/improvements for the CommandBar
. Here is my xaml for reference:
<ui:CommandBar HorizontalAlignment="Stretch" VerticalAlignment="Top" DefaultLabelPosition="Right">
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarButton Label="Add" Icon="Add"/>
</ui:CommandBar.PrimaryCommands>
<ui:CommandBar.SecondaryCommands>
<ui:CommandBarButton Label="Open" Icon="Open"/>
</ui:CommandBar.SecondaryCommands>
</ui:CommandBar>
The first thing is when the label is displayed to the right, the text is off-centered of the icon, as you can see below:
Another request, is to have the CommandBar
use the same background (or at least a darker color to show it is a bar of some sort) as the NavigationView
and MenuBar
:
Regarding this, ^, is there a DynamicResource
brush or something I can set for the background that would match the same brush used as the background of the NavigationView
and MenuBar
?
Libraries should target netstandard so that they can be used anywhere.
Great Control! and I know this is still BETA.... ;-)
Right now when click to show a page with a SlideNavigationTransitionEffect.FromTop animation I see for a split second the page I just clicked before it slides in.
FYI: I see if with all 4 slide direction animations
lmk if you need video of the problem in action.
Is it possible to add fade in time to it already as that might fix the problem?
thx!
Steve
It seems as there is an issue drawing the border around the list of a ComboBox:
However, this ComboBox seems to be fine:
Here is my XAML:
<ui:ContentDialog xmlns="https://github.com/avaloniaui"
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="using:FluentAvalonia.UI.Controls"
xmlns:uip="using:FluentAvalonia.UI.Controls.Primitives"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
mc:Ignorable="d" x:Class="NickvisionApp.Views.SettingsDialogView"
Name="SettingsDialog" Title="{Binding Title}"
CloseButtonText="Close" DefaultButton="Close" CloseButtonCommand="{Binding CloseCommand}">
<ui:ContentDialog.Resources>
<x:Double x:Key="ContentDialogMaxWidth">600</x:Double>
<x:Double x:Key="ContentDialogMaxHeight">600</x:Double>
</ui:ContentDialog.Resources>
<ui:ContentDialog.Styles>
<Style Selector="ui|ContentDialog /template/ Grid#DialogSpace">
<Setter Property="Width" Value="440"/>
<Setter Property="Height" Value="500" />
</Style>
</ui:ContentDialog.Styles>
<StackPanel>
<TextBlock Text="Theme" Margin="0,0,0,2"/>
<ComboBox Width="200" Items="{Binding Themes}"/>
<TextBlock Text="Accent Color" Margin="0,10,0,2"/>
<ComboBox Width="200" Items="{Binding AccentColors}"/>
</StackPanel>
</ui:ContentDialog>
Would you be able to port the CommandBar from WinUI? And maybe the TabbedCommandBar?
Can we update this project to .net 5?
I'm able to create a regular InfoBar no issues <ui:InfoBar Name="InfoBar" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" IsOpen="True" Title="Test" Message="Test" IsClosable="False"/>
and it defaults to using the Information severity. When I go to change the severity, for example, Severity="Warning"
I get a NullReferenceException (this also happens if I try "Error" or anything else).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.