├── .gitignore ├── Directory.Build.props ├── Images └── RometronAvaloniaExample.png ├── LICENSE.md ├── README.md ├── Romzetron.Avalonia.DataGrid ├── Controls │ └── DataGrid.xaml ├── Fonts │ ├── Inter-Black.ttf │ ├── Inter-Bold.ttf │ ├── Inter-ExtraBold.ttf │ ├── Inter-ExtraLight.ttf │ ├── Inter-Light.ttf │ ├── Inter-Medium.ttf │ ├── Inter-Regular.ttf │ ├── Inter-SemiBold.ttf │ └── Inter-Thin.ttf ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── Romzetron.Avalonia.DataGrid.csproj ├── RomzetronLogo.png ├── RomzetronThemeDataGrid.xaml ├── RomzetronThemeDataGrid.xaml.cs └── ThemeResources.xaml ├── Romzetron.Avalonia.Example ├── App.axaml ├── App.axaml.cs ├── Assets │ ├── Romzetron.ico │ ├── omelette.png │ ├── pizza.png │ └── veggies.png ├── Program.cs ├── Romzetron.Avalonia.Example.csproj ├── RomzetronLogo.png ├── ViewLocator.cs ├── ViewModels │ ├── DataGridViewModel.cs │ ├── MainWindowViewModel.cs │ ├── ProductViewModel.cs │ ├── SplitViewViewModel.cs │ └── ViewModelBase.cs ├── Views │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ └── Tabs │ │ ├── TabAdornerLayer.axaml │ │ ├── TabAdornerLayer.axaml.cs │ │ ├── TabAutoCompleteBox.axaml │ │ ├── TabAutoCompleteBox.axaml.cs │ │ ├── TabButton.axaml │ │ ├── TabButton.axaml.cs │ │ ├── TabButtonSpinner.axaml │ │ ├── TabButtonSpinner.axaml.cs │ │ ├── TabCalendar.axaml │ │ ├── TabCalendar.axaml.cs │ │ ├── TabCalendarDatePicker.axaml │ │ ├── TabCalendarDatePicker.axaml.cs │ │ ├── TabCarousel.axaml │ │ ├── TabCarousel.axaml.cs │ │ ├── TabCheckBox.axaml │ │ ├── TabCheckBox.axaml.cs │ │ ├── TabCircularProgress.axaml │ │ ├── TabCircularProgress.axaml.cs │ │ ├── TabComboBox.axaml │ │ ├── TabComboBox.axaml.cs │ │ ├── TabContextMenu.axaml │ │ ├── TabContextMenu.axaml.cs │ │ ├── TabDataGrid.axaml │ │ ├── TabDataGrid.axaml.cs │ │ ├── TabDateTimePicker.axaml │ │ ├── TabDateTimePicker.axaml.cs │ │ ├── TabDialogs.axaml │ │ ├── TabDialogs.axaml.cs │ │ ├── TabExpander.axaml │ │ ├── TabExpander.axaml.cs │ │ ├── TabFlyout.axaml │ │ ├── TabFlyout.axaml.cs │ │ ├── TabGridSplitter.axaml │ │ ├── TabGridSplitter.axaml.cs │ │ ├── TabHyperlinkButton.axaml │ │ ├── TabHyperlinkButton.axaml.cs │ │ ├── TabListBox.axaml │ │ ├── TabListBox.axaml.cs │ │ ├── TabNotificationCard.axaml │ │ ├── TabNotificationCard.axaml.cs │ │ ├── TabNumericUpDown.axaml │ │ ├── TabNumericUpDown.axaml.cs │ │ ├── TabProgressBar.axaml │ │ ├── TabProgressBar.axaml.cs │ │ ├── TabRadioButton.axaml │ │ ├── TabRadioButton.axaml.cs │ │ ├── TabScrollViewer.axaml │ │ ├── TabScrollViewer.axaml.cs │ │ ├── TabSlider.axaml │ │ ├── TabSlider.axaml.cs │ │ ├── TabSplitView.axaml │ │ ├── TabSplitView.axaml.cs │ │ ├── TabTabControl.axaml │ │ ├── TabTabControl.axaml.cs │ │ ├── TabTextBox.axaml │ │ ├── TabTextBox.axaml.cs │ │ ├── TabThemes.axaml │ │ ├── TabThemes.axaml.cs │ │ ├── TabToggleSwitch.axaml │ │ ├── TabToggleSwitch.axaml.cs │ │ ├── TabToolTip.axaml │ │ ├── TabToolTip.axaml.cs │ │ ├── TabTreeView.axaml │ │ └── TabTreeView.axaml.cs └── app.manifest ├── Romzetron.Avalonia.sln ├── Romzetron.Avalonia ├── ColorPalette.cs ├── ColorTheme.cs ├── Controls.xaml ├── Controls │ ├── AdornerLayer.xaml │ ├── AutoCompleteBox.xaml │ ├── Button.xaml │ ├── ButtonSpinner.xaml │ ├── Calendar.xaml │ ├── CalendarButton.xaml │ ├── CalendarDatePicker.xaml │ ├── CalendarDayButton.xaml │ ├── CalendarItem.xaml │ ├── Carousel.xaml │ ├── CheckBox.xaml │ ├── CircularProgress.axaml │ ├── CircularProgress.axaml.cs │ ├── ComboBox.xaml │ ├── ComboBoxItem.xaml │ ├── ContextMenu.xaml │ ├── DataValidationErrors.xaml │ ├── DatePicker.xaml │ ├── DateTimePickerShared.xaml │ ├── DropDownButton.xaml │ ├── EmbeddableControlRoot.xaml │ ├── Expander.xaml │ ├── FlyoutPresenter.xaml │ ├── GridSplitter.xaml │ ├── HeaderedContentControl.xaml │ ├── HyperlinkButton.xaml │ ├── ItemsControl.xaml │ ├── Label.xaml │ ├── ListBox.xaml │ ├── ListBoxItem.xaml │ ├── ManagedFileChooser.xaml │ ├── Menu.xaml │ ├── MenuFlyoutPresenter.xaml │ ├── MenuItem.xaml │ ├── MenuScrollViewer.xaml │ ├── NotificationCard.xaml │ ├── NumericUpDown.xaml │ ├── OverlayPopupHost.xaml │ ├── PathIcon.xaml │ ├── PopupRoot.xaml │ ├── ProgressBar.xaml │ ├── RadioButton.xaml │ ├── RefreshContainer.xaml │ ├── RefreshVisualizer.xaml │ ├── RepeatButton.xaml │ ├── ScrollBar.xaml │ ├── ScrollViewer.xaml │ ├── SelectableTextBlock.xaml │ ├── Separator.xaml │ ├── Slider.xaml │ ├── SplitButton.xaml │ ├── SplitView.xaml │ ├── TabControl.xaml │ ├── TabItem.xaml │ ├── TabStrip.xaml │ ├── TabStripItem.xaml │ ├── TextBox.xaml │ ├── TextSelectionHandle.xaml │ ├── ThemeVariantScope.xaml │ ├── TimePicker.xaml │ ├── TitleBar.xaml │ ├── ToggleButton.xaml │ ├── ToggleSwitch.xaml │ ├── ToolTip.xaml │ ├── TransitioningContentControl.xaml │ ├── TreeView.xaml │ ├── TreeViewItem.xaml │ ├── Window.xaml │ └── WindowNotificationManager.xaml ├── Converters │ └── ThemeConverter.cs ├── Extensions │ └── ThicknessExtensions.cs ├── Fonts │ ├── Inter-Black.ttf │ ├── Inter-Bold.ttf │ ├── Inter-ExtraBold.ttf │ ├── Inter-ExtraLight.ttf │ ├── Inter-Light.ttf │ ├── Inter-Medium.ttf │ ├── Inter-Regular.ttf │ ├── Inter-SemiBold.ttf │ └── Inter-Thin.ttf ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── BoxShadows.xaml │ ├── Color │ │ ├── ColorThemeAmber.xaml │ │ ├── ColorThemeBlue.xaml │ │ ├── ColorThemeBlueGrey.xaml │ │ ├── ColorThemeBrown.xaml │ │ ├── ColorThemeDeepOrange.xaml │ │ ├── ColorThemeDeepPurple.xaml │ │ ├── ColorThemeGreen.xaml │ │ ├── ColorThemeIndigo.xaml │ │ ├── ColorThemeOrange.xaml │ │ ├── ColorThemePink.xaml │ │ ├── ColorThemePurple.xaml │ │ ├── ColorThemeRed.xaml │ │ └── ColorThemeTeal.xaml │ └── FullPalette.xaml ├── Romzetron.Avalonia.csproj ├── RomzetronLogo.png ├── RomzetronTheme.xaml ├── RomzetronTheme.xaml.cs ├── Strings │ └── InvariantResources.xaml ├── Theme.cs └── ThemeResources.xaml └── global.json /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | 11.2.5.0 5 | 11.2.5.0 6 | 11.2.5.0 7 | Romzetron Software 8 | Copyright © 2025 Romzetron Software 9 | https://github.com/Romzetron/Romzetron.Avalonia 10 | RomzetronLogo.png 11 | avalonia, ui, theme 12 | LICENSE.md 13 | README.md 14 | enable 15 | 16 | -------------------------------------------------------------------------------- /Images/RometronAvaloniaExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Images/RometronAvaloniaExample.png -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 Romzetron Software 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-Black.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-Bold.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-ExtraBold.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-ExtraLight.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-Light.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-Medium.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-Regular.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-SemiBold.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Fonts/Inter-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/Fonts/Inter-Thin.ttf -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Metadata; 2 | 3 | [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Romzetron.Avalonia.DataGrid")] -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/README.md: -------------------------------------------------------------------------------- 1 | # Romzetron.Avalonia.DataGrid Theme Library 2 | 3 | [![GitHub License](https://img.shields.io/github/license/Romzetron/Romzetron.Avalonia)](https://github.com/Romzetron/Romzetron.Avalonia/blob/main/LICENSE.md) 4 | [![NuGet Version](https://img.shields.io/nuget/v/Romzetron.Avalonia.DataGrid)](https://www.nuget.org/packages/Romzetron.Avalonia.DataGrid) 5 | 6 | [Romzetron.Avalonia.DataGrid](https://github.com/Romzetron/Romzetron.Avalonia) is a UI theme library designed to work with the [Avalonia](https://avaloniaui.net) DataGrid control. The [Romzetron.Avalonia](https://github.com/Romzetron/Romzetron.Avalonia) library is a required prerequisite since it contains several control theme resources that the DataGrid theme uses. 7 | 8 | ## Installation 9 | 10 | The [Romzetron.Avalonia.DataGrid](https://github.com/Romzetron/Romzetron.Avalonia) theme library is available on [nuget.org](https://www.nuget.org/packages/Romzetron.Avalonia.DataGrid) and can be added to your project with using the **Nuget Package Manager** within **Visual Studio** or **Jetbrains Rider**, or with the following terminal command: 11 | 12 | ```bash 13 | dotnet add package Romzetron.Avalonia.DataGrid 14 | ``` 15 | 16 | ## Applying Theme via XAML 17 | 18 | The theme can be added to an application by modifying `App.axaml` to add `` and `` to the `` tag. The default color theme is `Blue`. 19 | 20 | ```xml 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | ``` -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/Romzetron.Avalonia.DataGrid.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Romzetron Avalonia DataGrid Theme 5 | Romzetron.Avalonia.DataGrid 6 | Romzetron.Avalonia.DataGrid 7 | DataGrid theme library for Avalonia. 8 | false 9 | true 10 | false 11 | true 12 | true 13 | 14 | 15 | 16 | 17 | True 18 | 19 | 20 | 21 | 22 | 23 | 24 | LICENSE.md 25 | 26 | 27 | README.md 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/RomzetronLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.DataGrid/RomzetronLogo.png -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/RomzetronThemeDataGrid.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Romzetron.Avalonia.DataGrid/RomzetronThemeDataGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Avalonia.Markup.Xaml; 3 | using Avalonia.Styling; 4 | 5 | namespace Romzetron.Avalonia.DataGrid; 6 | 7 | /// 8 | /// Provides styling and theming for the Romzetron.Avalonia DataGrid component. 9 | /// 10 | public class RomzetronThemeDataGrid : Styles 11 | { 12 | //================================================== 13 | // Constructor. 14 | //================================================== 15 | 16 | /// 17 | /// RomzetronThemeDataGrid is a class derived from Styles that facilitates applying 18 | /// various predefined color themes to Avalonia DataGrid controls. It provides a set of 19 | /// predefined color themes that can be easily switched. 20 | /// 21 | public RomzetronThemeDataGrid(IServiceProvider? sp = null) 22 | { 23 | AvaloniaXamlLoader.Load(sp, this); 24 | } 25 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/App.axaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | using Romzetron.Avalonia.Example.Views; 5 | 6 | namespace Romzetron.Avalonia.Example; 7 | 8 | public class App : Application 9 | { 10 | //================================================== 11 | // Initialize application. 12 | //================================================== 13 | 14 | public override void Initialize() 15 | { 16 | AvaloniaXamlLoader.Load(this); 17 | } 18 | 19 | //================================================== 20 | // Initialization complete. 21 | //================================================== 22 | 23 | public override void OnFrameworkInitializationCompleted() 24 | { 25 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 26 | desktop.MainWindow = new MainWindow(); 27 | 28 | base.OnFrameworkInitializationCompleted(); 29 | } 30 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/Assets/Romzetron.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.Example/Assets/Romzetron.ico -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/Assets/omelette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.Example/Assets/omelette.png -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/Assets/pizza.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.Example/Assets/pizza.png -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/Assets/veggies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.Example/Assets/veggies.png -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using Avalonia; 4 | using Avalonia.Dialogs; 5 | using Avalonia.ReactiveUI; 6 | 7 | namespace Romzetron.Avalonia.Example; 8 | 9 | /// 10 | /// A class containing the entry point for the Avalonia application. 11 | /// 12 | [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] 13 | internal class Program 14 | { 15 | /// 16 | /// Entry point for the application. 17 | /// 18 | /// Command-line arguments passed to the application. 19 | [STAThread] 20 | public static void Main(string[] args) 21 | { 22 | BuildAvaloniaApp() 23 | .StartWithClassicDesktopLifetime(args); 24 | } 25 | 26 | /// 27 | /// Configures and builds the Avalonia application. 28 | /// 29 | /// An instance of configured with the necessary settings for the application. 30 | public static AppBuilder BuildAvaloniaApp() 31 | { 32 | return AppBuilder.Configure() 33 | .UsePlatformDetect() 34 | .UseManagedSystemDialogs() 35 | .LogToTrace() 36 | .UseReactiveUI(); 37 | } 38 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/RomzetronLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Romzetron/Romzetron.Avalonia/caa87d8537a496a15c3e5324b561f85cfbb8256d/Romzetron.Avalonia.Example/RomzetronLogo.png -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/ViewLocator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.Templates; 4 | using Romzetron.Avalonia.Example.ViewModels; 5 | 6 | namespace Romzetron.Avalonia.Example; 7 | 8 | /// 9 | /// Represents a data template that locates and builds the appropriate view for a given view model. 10 | /// 11 | public class ViewLocator : IDataTemplate 12 | { 13 | /// 14 | /// Builds a control instance corresponding to a given ViewModel. 15 | /// 16 | /// The ViewModel instance for which to create the view. 17 | /// Returns an instance of the corresponding View or a TextBlock indicating the view was not found. 18 | public Control Build(object? data) 19 | { 20 | var name = data?.GetType().FullName!.Replace("ViewModel", "View"); 21 | var type = Type.GetType(name ?? string.Empty); 22 | 23 | if (type != null) 24 | return (Control) Activator.CreateInstance(type)!; 25 | 26 | return new TextBlock { Text = "Not Found: " + name }; 27 | } 28 | 29 | /// 30 | /// Determines whether the specified object is of type ViewModelBase. 31 | /// 32 | /// The object to check. 33 | /// True if the specified object is of type ViewModelBase; otherwise, false. 34 | public bool Match(object? data) 35 | { 36 | return data is ViewModelBase; 37 | } 38 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/ViewModels/MainWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Reflection; 3 | using System.Timers; 4 | using Avalonia; 5 | using Avalonia.Threading; 6 | using ReactiveUI; 7 | 8 | namespace Romzetron.Avalonia.Example.ViewModels; 9 | 10 | public class MainWindowViewModel : ViewModelBase 11 | { 12 | //================================================== 13 | // Private variables. 14 | //================================================== 15 | 16 | private readonly Timer _themeCycleTimer; 17 | 18 | //================================================== 19 | // Properties variables. 20 | //================================================== 21 | 22 | private ColorTheme _selectedColorTheme; 23 | private bool _runTimer; 24 | 25 | //================================================== 26 | // Properties. 27 | //================================================== 28 | 29 | public ColorTheme SelectedColorTheme 30 | { 31 | get => _selectedColorTheme; 32 | set 33 | { 34 | this.RaiseAndSetIfChanged(ref _selectedColorTheme, value); 35 | 36 | var theme = GetRomzetronAvaloniaTheme(); 37 | if (theme is not null) 38 | theme.ColorTheme = value; 39 | } 40 | } 41 | 42 | public bool RunTimer 43 | { 44 | get => _runTimer; 45 | set 46 | { 47 | if (_runTimer == value) 48 | return; 49 | 50 | this.RaiseAndSetIfChanged(ref _runTimer, value); 51 | 52 | if (_runTimer) 53 | _themeCycleTimer.Start(); 54 | else 55 | _themeCycleTimer.Stop(); 56 | } 57 | } 58 | 59 | public string WindowTitle { get; } 60 | 61 | //================================================== 62 | // Constructor. 63 | //================================================== 64 | 65 | public MainWindowViewModel() 66 | { 67 | WindowTitle = $"Romzetron Avalonia Theme Example {GetNugetVersion()}"; 68 | 69 | SelectedColorTheme = ColorTheme.Blue; 70 | 71 | _themeCycleTimer = new Timer(1000); 72 | _themeCycleTimer.Elapsed += OnThemeCycleTimerElapsed; 73 | 74 | RunTimer = true; 75 | } 76 | 77 | //================================================== 78 | // Get the nuget version. 79 | //================================================== 80 | 81 | private static string GetNugetVersion() 82 | { 83 | var assembly = Assembly.GetExecutingAssembly(); 84 | var attribute = assembly 85 | .GetCustomAttributes() 86 | .FirstOrDefault(); 87 | 88 | if (attribute?.InformationalVersion == null) 89 | return "Version not found"; 90 | 91 | var nugetVersion = attribute.InformationalVersion; 92 | var semanticVersion = nugetVersion.Split('+').First(); 93 | 94 | return semanticVersion; 95 | } 96 | 97 | //================================================== 98 | // Get the RomzetronTheme style from the App. 99 | //================================================== 100 | 101 | private static RomzetronTheme? GetRomzetronAvaloniaTheme() 102 | { 103 | if (Application.Current is not App app) 104 | return null; 105 | 106 | foreach (var style in app.Styles) 107 | { 108 | if (style is RomzetronTheme theme) 109 | return theme; 110 | } 111 | 112 | return null; 113 | } 114 | 115 | //================================================== 116 | // Toggle cycling themes. 117 | //================================================== 118 | 119 | public void ToggleCyclingThemes() 120 | { 121 | RunTimer = !RunTimer; 122 | } 123 | 124 | //================================================== 125 | // Automatic colorTheme cycling timer elapsed. 126 | //================================================== 127 | 128 | private void OnThemeCycleTimerElapsed(object? sender, ElapsedEventArgs args) 129 | { 130 | Dispatcher.UIThread.Invoke(() => 131 | { 132 | SelectedColorTheme = SelectedColorTheme switch 133 | { 134 | ColorTheme.Default => ColorTheme.Red, 135 | ColorTheme.Red => ColorTheme.Pink, 136 | ColorTheme.Pink => ColorTheme.Purple, 137 | ColorTheme.Purple => ColorTheme.DeepPurple, 138 | ColorTheme.DeepPurple => ColorTheme.Indigo, 139 | ColorTheme.Indigo => ColorTheme.Blue, 140 | ColorTheme.Blue => ColorTheme.Teal, 141 | ColorTheme.Teal => ColorTheme.Green, 142 | ColorTheme.Green => ColorTheme.Amber, 143 | ColorTheme.Amber => ColorTheme.Orange, 144 | ColorTheme.Orange => ColorTheme.DeepOrange, 145 | ColorTheme.DeepOrange => ColorTheme.Brown, 146 | ColorTheme.Brown => ColorTheme.BlueGrey, 147 | ColorTheme.BlueGrey => ColorTheme.Red, 148 | _ => SelectedColorTheme 149 | }; 150 | }); 151 | } 152 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/ViewModels/ProductViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ReactiveUI; 3 | 4 | namespace Romzetron.Avalonia.Example.ViewModels; 5 | 6 | public class ProductViewModel : ViewModelBase 7 | { 8 | //================================================== 9 | // Property backing variables. 10 | //================================================== 11 | 12 | private int _productId; 13 | private string _name = ""; 14 | private string _category = ""; 15 | private string _manufacturer = ""; 16 | private double _price; 17 | private int _stockQuantity; 18 | private DateTime _dateAdded; 19 | private DateTime _lastRestocked; 20 | private bool _isAvailable; 21 | private string _sku = ""; 22 | private string _warehouseLocation = ""; 23 | private double _weight; 24 | private double _dimensions; 25 | private string _color = ""; 26 | private string _material = ""; 27 | private string _warranty = ""; 28 | private string _supplier = ""; 29 | private string _description = ""; 30 | private double _discount; 31 | private int _customerRating; 32 | private int _timesPurchased; 33 | 34 | //================================================== 35 | // Properties. 36 | //================================================== 37 | 38 | public int ProductID 39 | { 40 | get => _productId; 41 | set => this.RaiseAndSetIfChanged(ref _productId, value); 42 | } 43 | 44 | public string Name 45 | { 46 | get => _name; 47 | set => this.RaiseAndSetIfChanged(ref _name, value); 48 | } 49 | 50 | public string Category 51 | { 52 | get => _category; 53 | set => this.RaiseAndSetIfChanged(ref _category, value); 54 | } 55 | 56 | public string Manufacturer 57 | { 58 | get => _manufacturer; 59 | set => this.RaiseAndSetIfChanged(ref _manufacturer, value); 60 | } 61 | 62 | public double Price 63 | { 64 | get => _price; 65 | set => this.RaiseAndSetIfChanged(ref _price, value); 66 | } 67 | 68 | public int StockQuantity 69 | { 70 | get => _stockQuantity; 71 | set => this.RaiseAndSetIfChanged(ref _stockQuantity, value); 72 | } 73 | 74 | public DateTime DateAdded 75 | { 76 | get => _dateAdded; 77 | set => this.RaiseAndSetIfChanged(ref _dateAdded, value); 78 | } 79 | 80 | public DateTime LastRestocked 81 | { 82 | get => _lastRestocked; 83 | set => this.RaiseAndSetIfChanged(ref _lastRestocked, value); 84 | } 85 | 86 | public bool IsAvailable 87 | { 88 | get => _isAvailable; 89 | set => this.RaiseAndSetIfChanged(ref _isAvailable, value); 90 | } 91 | 92 | public string SKU 93 | { 94 | get => _sku; 95 | set => this.RaiseAndSetIfChanged(ref _sku, value); 96 | } 97 | 98 | public string WarehouseLocation 99 | { 100 | get => _warehouseLocation; 101 | set => this.RaiseAndSetIfChanged(ref _warehouseLocation, value); 102 | } 103 | 104 | public double Weight 105 | { 106 | get => _weight; 107 | set => this.RaiseAndSetIfChanged(ref _weight, value); 108 | } 109 | 110 | public double Dimensions 111 | { 112 | get => _dimensions; 113 | set => this.RaiseAndSetIfChanged(ref _dimensions, value); 114 | } 115 | 116 | public string Color 117 | { 118 | get => _color; 119 | set => this.RaiseAndSetIfChanged(ref _color, value); 120 | } 121 | 122 | public string Material 123 | { 124 | get => _material; 125 | set => this.RaiseAndSetIfChanged(ref _material, value); 126 | } 127 | 128 | public string Warranty 129 | { 130 | get => _warranty; 131 | set => this.RaiseAndSetIfChanged(ref _warranty, value); 132 | } 133 | 134 | public string Supplier 135 | { 136 | get => _supplier; 137 | set => this.RaiseAndSetIfChanged(ref _supplier, value); 138 | } 139 | 140 | public string Description 141 | { 142 | get => _description; 143 | set => this.RaiseAndSetIfChanged(ref _description, value); 144 | } 145 | 146 | public double Discount 147 | { 148 | get => _discount; 149 | set => this.RaiseAndSetIfChanged(ref _discount, value); 150 | } 151 | 152 | public int CustomerRating 153 | { 154 | get => _customerRating; 155 | set => this.RaiseAndSetIfChanged(ref _customerRating, value); 156 | } 157 | 158 | public int TimesPurchased 159 | { 160 | get => _timesPurchased; 161 | set => this.RaiseAndSetIfChanged(ref _timesPurchased, value); 162 | } 163 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/ViewModels/SplitViewViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Avalonia.Controls; 3 | using ReactiveUI; 4 | 5 | namespace Romzetron.Avalonia.Example.ViewModels; 6 | 7 | public class SplitViewViewModel : ViewModelBase 8 | { 9 | //================================================== 10 | // Private variables. 11 | //================================================== 12 | 13 | private bool _isLeft = true; 14 | private int _displayMode = 3; //CompactOverlay 15 | 16 | //================================================== 17 | // Properties. 18 | //================================================== 19 | 20 | public bool IsLeft 21 | { 22 | get => _isLeft; 23 | set 24 | { 25 | this.RaiseAndSetIfChanged(ref _isLeft, value); 26 | this.RaisePropertyChanged(nameof(PanePlacement)); 27 | } 28 | } 29 | 30 | public int DisplayMode 31 | { 32 | get => _displayMode; 33 | set 34 | { 35 | this.RaiseAndSetIfChanged(ref _displayMode, value); 36 | this.RaisePropertyChanged(nameof(CurrentDisplayMode)); 37 | } 38 | } 39 | 40 | public SplitViewPanePlacement PanePlacement => _isLeft ? SplitViewPanePlacement.Left : SplitViewPanePlacement.Right; 41 | 42 | public SplitViewDisplayMode CurrentDisplayMode 43 | { 44 | get 45 | { 46 | if (Enum.IsDefined(typeof(SplitViewDisplayMode), _displayMode)) 47 | return (SplitViewDisplayMode) _displayMode; 48 | 49 | return SplitViewDisplayMode.CompactOverlay; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | 3 | namespace Romzetron.Avalonia.Example.ViewModels; 4 | 5 | public class ViewModelBase : ReactiveObject 6 | { 7 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/Views/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Romzetron.Avalonia.Example.ViewModels; 3 | 4 | namespace Romzetron.Avalonia.Example.Views; 5 | 6 | public partial class MainWindow : Window 7 | { 8 | public MainWindow() 9 | { 10 | InitializeComponent(); 11 | 12 | var mainVm = new MainWindowViewModel(); 13 | DataContext = mainVm; 14 | } 15 | } -------------------------------------------------------------------------------- /Romzetron.Avalonia.Example/Views/Tabs/TabAdornerLayer.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Controls.Primitives; 3 | using Avalonia.Interactivity; 4 | 5 | namespace Romzetron.Avalonia.Example.Views.Tabs; 6 | 7 | public partial class TabAdornerLayer : UserControl 8 | { 9 | //================================================== 10 | // Private variables. 11 | //================================================== 12 | 13 | private Control? _adorner; 14 | 15 | //================================================== 16 | // Constructor. 17 | //================================================== 18 | 19 | public TabAdornerLayer() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | //================================================== 25 | // Remove adorner button click event handler. 26 | //================================================== 27 | 28 | private void RemoveAdorner_OnClick(object? sender, RoutedEventArgs e) 29 | { 30 | var adornerButton = this.FindControl