├── src ├── Assets │ └── avalonia-32.png ├── Converters │ ├── BoolToIntConverter.cs │ ├── BoolToDoubleConverter.cs │ ├── BoolToStringConverter.cs │ ├── BoolToBrushConverter.cs │ ├── BoolToThicknessConverter.cs │ ├── BoolToCornerRadiusConverter.cs │ ├── BoolConverters.cs │ ├── BoolToChromeHintsConverter.cs │ ├── IntSumConverter.cs │ ├── SumConverter.cs │ ├── AndConverter.cs │ ├── IntConverters.cs │ ├── OrConverter.cs │ ├── InvertColorConverter.cs │ ├── ThicknessToDoubleConverter.cs │ ├── ExtendClientAreaToDecorationHintConverter.cs │ ├── FactorConverter.cs │ ├── FromControlContainerConverter.cs │ ├── ToControlContainerConverter.cs │ ├── StringFormatConverter.cs │ ├── FirstOrSecondValueConverter.cs │ ├── ShiftFromTopLeftMarginConverter.cs │ ├── LastNonDefaultValueConverter.cs │ ├── ToBoolConverter.cs │ ├── GenericBoolConverter.cs │ ├── BitmapConverter.cs │ ├── NoTopBorderThicknessConverter.cs │ ├── ToGridLengthConverter.cs │ ├── OrientationConverters.cs │ ├── ToWindowIconConverter.cs │ └── EnumTypeToValuesConverter.cs ├── Behaviors │ ├── IRoutedEventArgsMatcher.cs │ ├── ReactiveLogicalDescendantsBehavior.cs │ ├── ReactiveVisualDesendantsBehavior.cs │ ├── VisualFlow.cs │ ├── CurrentBaseUrlBehaviorExtension.cs │ ├── MultiClickEventMatcher.cs │ ├── AttachedPropToCollectionBindingBehavior.cs │ ├── AttachedPropValueGetter.cs │ ├── ToCollectionBindingBehavior.cs │ ├── ValueBinding.cs │ ├── LogicalChildBehavior.cs │ ├── KeyboardService.cs │ ├── GridColumnsBehavior.cs │ ├── ImageHelper.cs │ ├── HasVisibleLogicalChildrenBehavior.cs │ └── LogicalChildrenBehavior.cs ├── Controls │ ├── GridLenDictionary.cs │ ├── WinUtils.cs │ ├── ActionIndicator.cs │ ├── AvaloniaContentPresenter.cs │ ├── HorizontalTransform.cs │ └── VisualsRepeater.cs ├── MarkupExtensions │ └── ExtensionsHelper.cs ├── ControlContainer.cs ├── ColorUtils │ └── HslColor.cs ├── Themes │ ├── DefaultColors.axaml │ ├── DataGridResources.axaml │ ├── OverlayingPopupStyles.axaml │ └── TextStyles.axaml ├── GridLengthHelper.cs ├── WindowsOnly │ ├── WindowLongFlags.cs │ ├── GtkApi.cs │ └── WindowStyles.cs └── ThemingAndL10N │ ├── ThemeVariantReference.cs │ ├── StyleReference.cs │ └── ThemeInfo.cs ├── Demos ├── NP.LocalizationPrototype │ ├── Images │ │ ├── USA.png │ │ ├── English.jpg │ │ ├── Hebrew.jpg │ │ └── Russian.jpg │ ├── ColorThemes.cs │ ├── Language.cs │ ├── NP.LocalizationPrototype.csproj │ ├── App.axaml.cs │ ├── Program.cs │ ├── Data.cs │ ├── ColorDictionaries │ │ ├── LightResources.axaml │ │ └── DarkResources.axaml │ ├── LanguageDictionaries │ │ ├── HebrewResources.axaml │ │ ├── RussianResources.axaml │ │ └── EnglishResources.axaml │ └── App.axaml ├── MultiPlatformWindowDemo │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── nuget.config │ ├── Properties │ │ └── launchSettings.json │ ├── NP.Demos.MultiPlatformWindowDemo.csproj.user │ ├── MainWindow.axaml.cs │ ├── MainWindow.axaml │ ├── Program.cs │ ├── NP.Demos.MultiPlatformWindowDemo.csproj │ ├── App.axaml.cs │ ├── CustomWindowViewModel.cs │ └── StartupTestWindow.cs ├── NP.Demos.LiveTradingDemo │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── Domain │ │ ├── Model │ │ │ ├── BuyOrSell.cs │ │ │ ├── TradeStatus.cs │ │ │ └── CurrencyPair.cs │ │ ├── Infrastructure │ │ │ ├── LogLevel.cs │ │ │ ├── ISchedulerProvider.cs │ │ │ ├── ILogger.cs │ │ │ └── SchedulerProvider.cs │ │ └── Services │ │ │ ├── IStaticData.cs │ │ │ ├── IMarketDataService.cs │ │ │ ├── ITradeService.cs │ │ │ └── StaticData.cs │ ├── LiveTradesViewer.cs │ ├── App.axaml │ ├── Program.cs │ ├── App.axaml.cs │ ├── NP.Demos.LiveTradingDemo.csproj │ └── MainWindow.axaml.cs ├── NP.Demos.BehaviorPrototypes │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── NP.Demos.BehaviorPrototypes.csproj │ ├── Events.cs │ ├── App.axaml │ ├── Program.cs │ ├── App.axaml.cs │ ├── MainWindow.axaml.cs │ └── MainWindow.axaml ├── NP.Demos.CustomWindowSample │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── Properties │ │ └── launchSettings.json │ ├── nuget.config │ ├── NP.Demos.CustomWindowSample.csproj │ ├── Program.cs │ ├── App.axaml.cs │ ├── App.axaml │ └── MainWindow.axaml ├── NP.AutoGridTest │ ├── NP.AutoGridTest.csproj │ ├── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml │ ├── Properties │ │ └── launchSettings.json │ ├── App.axaml.cs │ ├── Program.cs │ └── App.axaml ├── NP.ElementImageTest │ ├── NP.ElementImageTest.csproj │ ├── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml │ ├── Properties │ │ └── launchSettings.json │ ├── MainWindow.axaml.cs │ ├── App.axaml.cs │ ├── Program.cs │ ├── MainWindow.axaml │ └── App.axaml ├── NP.ColorUtils │ ├── Properties │ │ └── launchSettings.json │ ├── Program.cs │ └── NP.ColorUtils.csproj ├── NP.ControlsDemo │ ├── NP.ControlsDemo.csproj │ ├── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml │ ├── MainWindow.axaml │ ├── App.axaml.cs │ ├── Program.cs │ ├── MainWindow.axaml.cs │ └── App.axaml ├── NP.LabeledControlDemo │ ├── NP.LabeledControlDemo.csproj │ ├── MainWindow.axaml.cs │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ └── Program.cs ├── NP.Demos.ImplantedWindowTest │ ├── NP.Demos.ImplantedWindowTest.csproj │ ├── NuGet.Config │ ├── App.axaml │ ├── App.axaml.cs │ ├── Program.cs │ └── MainWindow.axaml ├── NP.OverlayingPopupDemo │ ├── NP.OverlayingPopupDemo.csproj │ ├── Properties │ │ └── launchSettings.json │ ├── App.axaml │ ├── MainWindow.axaml.cs │ ├── App.axaml.cs │ ├── Program.cs │ └── MainWindow.axaml ├── NP.OverlayingWindowDemo │ ├── NP.OverlayingWindowDemo.csproj │ ├── Properties │ │ └── launchSettings.json │ ├── App.axaml │ ├── MainWindow.axaml.cs │ ├── App.axaml.cs │ ├── Program.cs │ └── MainWindow.axaml ├── NP.CustomCursorDemo │ ├── NP.CustomCursorDemo.csproj │ ├── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml │ ├── App.axaml │ ├── MainWindow.axaml.cs │ ├── App.axaml.cs │ ├── Program.cs │ └── MainWindow.axaml ├── NP.OverlayingControlDemo │ ├── NP.OverlayingControlDemo.csproj │ ├── Properties │ │ └── launchSettings.json │ ├── App.axaml │ ├── MainWindow.axaml.cs │ ├── App.axaml.cs │ └── Program.cs ├── NP.ToggleButtonDemo │ ├── NP.ToggleButtonDemo.csproj │ ├── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml │ ├── App.axaml │ ├── MainWindow.axaml.cs │ ├── App.axaml.cs │ ├── Program.cs │ └── MainWindow.axaml ├── NP.GridSplitterInOverlayWindowDemo │ ├── NP.GridSplitterInOverlayWindowDemo.csproj │ ├── App.axaml │ ├── MyGridSplitter.cs │ ├── App.axaml.cs │ ├── MainWindow.axaml.cs │ └── Program.cs ├── NP.OverlayingTransitionsDemo │ ├── NP.OverlayingTransitionsDemo.csproj │ ├── Properties │ │ └── launchSettings.json │ ├── App.axaml │ ├── App.axaml.cs │ └── Program.cs ├── NP.Demos.ImplantWinByHandle │ ├── MainWindow.axaml.cs │ ├── App.axaml │ ├── App.axaml.cs │ ├── Program.cs │ ├── MainWindow.axaml │ └── NP.Demos.ImplantWinByHandle.csproj ├── NP.ThemingPrototype │ ├── Themes │ │ └── MainColorThemes │ │ │ ├── AccentColorThemes │ │ │ └── DarkBlueAccent.axaml │ │ │ ├── LightColorsTheme.axaml │ │ │ └── DarkColorsTheme.axaml │ ├── NP.ThemingPrototype.csproj │ ├── App.axaml.cs │ ├── Program.cs │ └── App.axaml └── Directory.Build.props ├── FinanceDemos ├── NP.TradesDemo │ ├── Models │ │ ├── BuyOrSell.cs │ │ ├── TradeStatus.cs │ │ ├── Traders.cs │ │ ├── Customer.cs │ │ └── NasdaqSymbols.cs │ ├── NP.TradesDemo.csproj │ ├── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml │ ├── MainWindow.axaml.cs │ ├── Properties │ │ └── launchSettings.json │ ├── MainWindow.axaml │ ├── App.axaml.cs │ ├── Program.cs │ └── App.axaml └── Directory.Build.props ├── Directory.Build.props ├── BehaviorDemos └── NP.Demos.BehaviorsDemo │ ├── Themes │ └── MainColorThemes │ │ ├── AccentColorThemes │ │ └── DarkBlueAccent.axaml │ │ ├── LightColorsTheme.axaml │ │ └── DarkColorsTheme.axaml │ ├── NP.ThemingPrototype.csproj │ ├── App.axaml.cs │ ├── Program.cs │ └── App.axaml ├── README.md ├── ThemeDemos └── NP.Demos.SimpleThemingAndL10NSample │ ├── LanguageDictionaries │ ├── HebrewDictionary.axaml │ └── EnglishDictionary.axaml │ ├── NP.Demos.SimpleThemingAndL10NSample.csproj │ ├── App.axaml.cs │ ├── ColorThemes │ ├── LightResources.axaml │ └── DarkResources.axaml │ ├── Program.cs │ └── App.axaml ├── .gitmodules ├── AvaloniaSnippets └── Readme.md └── LICENSE /src/Assets/avalonia-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/src/Assets/avalonia-32.png -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/Images/USA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.LocalizationPrototype/Images/USA.png -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Models/BuyOrSell.cs: -------------------------------------------------------------------------------- 1 | namespace NP.TradesDemo.Models; 2 | 3 | public enum BuyOrSell 4 | { 5 | Buy, 6 | Sell 7 | } 8 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/MultiPlatformWindowDemo/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/MultiPlatformWindowDemo/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/Images/English.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.LocalizationPrototype/Images/English.jpg -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/Images/Hebrew.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.LocalizationPrototype/Images/Hebrew.jpg -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/Images/Russian.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.LocalizationPrototype/Images/Russian.jpg -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Models/TradeStatus.cs: -------------------------------------------------------------------------------- 1 | namespace NP.TradesDemo.Models; 2 | 3 | public enum TradeStatus 4 | { 5 | Live, 6 | Closed 7 | } 8 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.Demos.BehaviorPrototypes/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.Demos.BehaviorPrototypes/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.Demos.CustomWindowSample/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/HEAD/Demos/NP.Demos.CustomWindowSample/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Model/BuyOrSell.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Demos.LiveTradingDemo.Domain.Model; 2 | 3 | public enum BuyOrSell 4 | { 5 | Buy, 6 | Sell 7 | } -------------------------------------------------------------------------------- /src/Converters/BoolToIntConverter.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Ava.Visuals.Converters 2 | { 3 | public class BoolToIntConverter : GenericBoolConverter 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Demos/NP.AutoGridTest/NP.AutoGridTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/NP.ElementImageTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/NP.TradesDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Converters/BoolToDoubleConverter.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Ava.Visuals.Converters 2 | { 3 | public class BoolToDoubleConverter : GenericBoolConverter 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Converters/BoolToStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Ava.Visuals.Converters 2 | { 3 | public class BoolToStringConverter : GenericBoolConverter 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Demos/NP.ColorUtils/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.ColorUtils": { 4 | "commandName": "Project", 5 | "commandLineArgs": "#302F4A" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Converters/BoolToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Media; 2 | 3 | namespace NP.Ava.Visuals.Converters 4 | { 5 | public class BoolToBrushConverter : GenericBoolConverter 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Converters/BoolToThicknessConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace NP.Ava.Visuals.Converters 4 | { 5 | public class BoolToThicknessConverter : GenericBoolConverter 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Converters/BoolToCornerRadiusConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace NP.Ava.Visuals.Converters 4 | { 5 | public class BoolToCornerRadiusConverter : GenericBoolConverter 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Model/TradeStatus.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Demos.LiveTradingDemo.Domain.Model 2 | { 3 | public enum TradeStatus 4 | { 5 | Live=0, 6 | Closed=1, 7 | Filled=2 8 | } 9 | } -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | 11.2.3.0 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Infrastructure/LogLevel.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Demos.LiveTradingDemo.Domain.Infrastructure; 2 | 3 | public enum LogLevel 4 | { 5 | Debug, 6 | Info, 7 | Warning, 8 | Error, 9 | Fatal 10 | } -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/NP.ControlsDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Behaviors/IRoutedEventArgsMatcher.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Interactivity; 2 | 3 | namespace NP.Ava.Visuals.Behaviors 4 | { 5 | public interface IRoutedEventArgsMatcher 6 | { 7 | bool Matches(RoutedEventArgs args); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Controls/GridLenDictionary.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using System.Collections.Generic; 3 | 4 | namespace NP.Ava.Visuals.Controls 5 | { 6 | public class GridLenDictionary : Dictionary 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Demos/NP.LabeledControlDemo/NP.LabeledControlDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantedWindowTest/NP.Demos.ImplantedWindowTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | app.manifest 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantedWindowTest/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingPopupDemo/NP.OverlayingPopupDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingWindowDemo/NP.OverlayingWindowDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Services/IStaticData.cs: -------------------------------------------------------------------------------- 1 | using Trader.Domain.Model; 2 | 3 | namespace NP.Demos.LiveTradingDemo.Domain.Services; 4 | 5 | public interface IStaticData 6 | { 7 | string[] Customers { get; } 8 | CurrencyPair[] CurrencyPairs { get; } 9 | } -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/LiveTradesViewer.cs: -------------------------------------------------------------------------------- 1 | using DynamicData.Binding; 2 | using System; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace NP.Demos.LiveTradingDemo; 6 | 7 | public class LiveTradesViewer : AbstractNotifyPropertyChanged 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/NP.CustomCursorDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.Demos.CustomWindowSample": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "distributionName": "" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Demos/NP.OverlayingControlDemo/NP.OverlayingControlDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/NP.ToggleButtonDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.GridSplitterInOverlayWindowDemo/NP.GridSplitterInOverlayWindowDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingTransitionsDemo/NP.OverlayingTransitionsDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/MarkupExtensions/ExtensionsHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NP.Ava.Visuals.MarkupExtensions 4 | { 5 | public static class ExtensionsHelper 6 | { 7 | public static T GetService(this IServiceProvider sp) => (T)sp?.GetService(typeof(T))!; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Services/IMarketDataService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Trader.Domain.Model; 3 | 4 | 5 | namespace NP.Demos.LiveTradingDemo.Domain.Services; 6 | 7 | public interface IMarketDataService 8 | { 9 | IObservable Watch(string currencyPair); 10 | } -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantWinByHandle/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace NP.Demos.ImplantWinByHandle 4 | { 5 | public partial class MainWindow : Window 6 | { 7 | public MainWindow() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/ControlContainer.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace NP.Ava.Visuals 4 | { 5 | internal class ControlContainer 6 | { 7 | public Control Control { get; } 8 | 9 | internal ControlContainer(Control control) 10 | { 11 | Control = control; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Infrastructure/ISchedulerProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Reactive.Concurrency; 2 | 3 | namespace NP.Demos.LiveTradingDemo.Domain.Infrastructure 4 | { 5 | public interface ISchedulerProvider 6 | { 7 | IScheduler MainThread { get; } 8 | IScheduler Background { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Services/ITradeService.cs: -------------------------------------------------------------------------------- 1 | using DynamicData; 2 | using NP.Demos.LiveTradingDemo.Domain.Model; 3 | 4 | namespace NP.Demos.LiveTradingDemo.Domain.Services; 5 | 6 | public interface ITradeService 7 | { 8 | IObservableCache All { get; } 9 | IObservableCache Live { get; } 10 | } 11 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingPopupDemo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.OverlayingPopupDemo": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "distributionName": "", 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/Themes/MainColorThemes/AccentColorThemes/DarkBlueAccent.axaml: -------------------------------------------------------------------------------- 1 | 3 | #23597D 4 | #3178AD 5 | 6 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingPopupDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/ColorUtils/HslColor.cs: -------------------------------------------------------------------------------- 1 | using NP.Utilities; 2 | 3 | namespace NP.Ava.Visuals.ColorUtils 4 | { 5 | public record HslColor(byte A, float H, float S, float L) 6 | { 7 | public override string ToString() 8 | { 9 | return $"{A}, {H}, {(S * 100d).ToFixed(1)}%, {(L * 100).ToFixed(1)}%"; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Demos/NP.AutoGridTest/Themes/DarkCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FFF3F3F3 5 | #FF222222 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/Themes/DarkCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FFF3F3F3 5 | #FF222222 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.AutoGridTest/Themes/LightCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #FF0C0C0C 5 | #FFDDDDDD 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/Themes/LightCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #FF0C0C0C 5 | #FFDDDDDD 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/Themes/DarkCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FFF3F3F3 5 | #FF222222 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/Themes/LightCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #FF0C0C0C 5 | #FFDDDDDD 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/NP.Demos.BehaviorPrototypes.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/Themes/DarkCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FFF3F3F3 5 | #FF222222 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/Themes/LightCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #FF0C0C0C 5 | #FFDDDDDD 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/Themes/DarkCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FFF3F3F3 5 | #FF222222 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/Themes/LightCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #FF0C0C0C 5 | #FFDDDDDD 6 | 7 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Themes/DarkCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FFF3F3F3 5 | #FF222222 6 | 7 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using NP.TradesDemo.Models; 4 | 5 | namespace NP.TradesDemo; 6 | 7 | public partial class MainWindow : Window 8 | { 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | #if DEBUG 13 | this.AttachDevTools(); 14 | #endif 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Themes/LightCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #FF0C0C0C 5 | #FFDDDDDD 6 | 7 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/NP.AutoGridTest/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.AutoGridTest": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "environmentVariables": { 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | }, 12 | "distributionName": "" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.TradesDemo": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "environmentVariables": { 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | }, 12 | "distributionName": "" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantWinByHandle/App.axaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.ElementImageTest": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "environmentVariables": { 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | }, 12 | "distributionName": "" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Demos/NP.ThemingPrototype/Themes/MainColorThemes/AccentColorThemes/DarkBlueAccent.axaml: -------------------------------------------------------------------------------- 1 | 3 | #23597D 4 | #FF119EDA 5 | #3178AD 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingControlDemo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.OverlayingControlDemo": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "environmentVariables": { 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | }, 12 | "distributionName": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Demos/NP.OverlayingWindowDemo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.OverlayingWindowDemo": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "environmentVariables": { 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | }, 12 | "distributionName": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Demos/NP.OverlayingControlDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingWindowDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.Demos.MultiPlatformWindowDemo": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "environmentVariables": { 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | }, 12 | "distributionName": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Demos/NP.OverlayingTransitionsDemo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.OverlayingTransitionsDemo": { 4 | "commandName": "Project" 5 | }, 6 | "WSL": { 7 | "commandName": "WSL2", 8 | "environmentVariables": { 9 | "DISPLAY": "10.0.0.7:0.0", 10 | "LIBGL_ALWAYS_INDIRECT": "1" 11 | }, 12 | "distributionName": "" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/ColorThemes.cs: -------------------------------------------------------------------------------- 1 | namespace NP.LocalizationPrototype 2 | { 3 | public enum ColorTheme 4 | { 5 | Dark, 6 | Light 7 | } 8 | 9 | public static class ColorThemesHelper 10 | { 11 | public static ColorTheme[] ColorThemes { get; } = 12 | { 13 | ColorTheme.Dark, 14 | ColorTheme.Light }; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingTransitionsDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Demos/NP.ColorUtils/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Media; 3 | using NP.Ava.Visuals.ColorUtils; 4 | using System; 5 | 6 | namespace NP.ThemingPrototype 7 | { 8 | class Program 9 | { 10 | public static void Main(string[] args) 11 | { 12 | Color color = Color.Parse(args[0]); 13 | 14 | Console.WriteLine(color.Invert().ToStr()); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/NP.Demos.CustomWindowSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NP.Avalonia.Visuals 2 | 3 | contains basic visual paradigms for Avalonia 4 | 5 | To checkout (together with the submodules so that you could build the demos) use the following command 6 | 7 | git clone https://github.com/npolyak/NP.Ava.Visuals.git --recursive 8 | 9 | To build the demos go to Demos/ and open the corresponding solution. E.g go to Demos\MultiPlatformWindowDemo folder and open solution MultiPlatformWindowDemo.sln 10 | -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/Language.cs: -------------------------------------------------------------------------------- 1 | namespace NP.LocalizationPrototype 2 | { 3 | public enum Language 4 | { 5 | English, 6 | Hebrew, 7 | Russian 8 | } 9 | 10 | public static class LanguageHelper 11 | { 12 | public static Language[] Languages { get; } = 13 | { 14 | Language.English, 15 | Language.Hebrew, 16 | Language.Russian 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Behaviors/ReactiveLogicalDescendantsBehavior.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.LogicalTree; 2 | using NP.Concepts.Behaviors; 3 | 4 | namespace NP.Ava.Visuals.Behaviors 5 | { 6 | public class ReactiveLogicalDescendantsBehavior : FlattenReactiveTreeBehavior 7 | { 8 | public ReactiveLogicalDescendantsBehavior(ILogical root) 9 | : 10 | base(root, logical => logical.LogicalChildren) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Models/Traders.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace NP.TradesDemo.Models; 5 | 6 | public enum Trader 7 | { 8 | None, 9 | Joe, 10 | Jack, 11 | Jim, 12 | Jordan, 13 | Ami, 14 | Nancy 15 | } 16 | 17 | public static class TradersHelper 18 | { 19 | public static Trader[] Traders { get; } = 20 | Enum.GetValues() 21 | .Except([Trader.None]) 22 | .ToArray(); 23 | } -------------------------------------------------------------------------------- /ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/LanguageDictionaries/HebrewDictionary.axaml: -------------------------------------------------------------------------------- 1 | 4 | הדגמת לוקליזציה 5 | !!!שלום עולמ מאבולוניה 6 | 'כותרת החלון היא '{0} 7 | 8 | -------------------------------------------------------------------------------- /src/Behaviors/ReactiveVisualDesendantsBehavior.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.VisualTree; 3 | using NP.Concepts.Behaviors; 4 | 5 | namespace NP.Ava.Visuals.Behaviors 6 | { 7 | public class ReactiveVisualDesendantsBehavior : FlattenReactiveTreeBehavior 8 | { 9 | public ReactiveVisualDesendantsBehavior(Visual root) 10 | : 11 | base(root, visual => visual.GetVisualChildren()) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Behaviors/VisualFlow.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Ava.Visuals.Behaviors 2 | { 3 | public enum VisualFlow 4 | { 5 | Normal, 6 | Reverse 7 | } 8 | 9 | public static class VisualFlowHelper 10 | { 11 | public static double ToScale(this VisualFlow visualFlow) 12 | { 13 | return visualFlow switch 14 | { 15 | VisualFlow.Normal => 1, 16 | _ => -1 17 | }; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/NP.Demos.MultiPlatformWindowDemo.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ProjectDebugger 5 | 6 | 7 | NP.Demos.MultiPlatformWindowDemo 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Infrastructure/ILogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NP.Demos.LiveTradingDemo.Domain.Infrastructure; 4 | 5 | public interface ILogger 6 | { 7 | void Debug(string message, params object[] values); 8 | void Info(string message, params object[] values); 9 | void Warn(string message, params object[] values); 10 | void Error(Exception ex, string message, params object[] values); 11 | void Fatal(string message, params object[] values); 12 | } -------------------------------------------------------------------------------- /ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/LanguageDictionaries/EnglishDictionary.axaml: -------------------------------------------------------------------------------- 1 | 4 | Theming Demo 5 | Hello World from Avalonia!!! 6 | Window Title is '{0}' 7 | 8 | -------------------------------------------------------------------------------- /Demos/NP.ThemingPrototype/Themes/MainColorThemes/LightColorsTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #D4D4D4 5 | #979797 6 | #050505 7 | #282828 8 | 9 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Converters/BoolConverters.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | 3 | namespace NP.Ava.Visuals.Converters 4 | { 5 | public static class BoolConverters 6 | { 7 | public static IMultiValueConverter And { get; } = new AndConverter(); 8 | 9 | public static IMultiValueConverter Or { get; } = new OrConverter(); 10 | 11 | public static IValueConverter Not { get; } = 12 | new GenericBoolConverter { FalseValue = true, TrueValue = false }; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/Themes/MainColorThemes/LightColorsTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #D4D4D4 5 | #979797 6 | #050505 7 | #282828 8 | 9 | -------------------------------------------------------------------------------- /Demos/NP.GridSplitterInOverlayWindowDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/NP.ThemingPrototype.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/Events.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Interactivity; 2 | 3 | namespace NP.Demos.BehaviorPrototypes 4 | { 5 | public class Events 6 | { 7 | /// 8 | /// Defines the event. 9 | /// 10 | public static readonly RoutedEvent MyEvent = 11 | RoutedEvent.Register 12 | ( 13 | "My", 14 | RoutingStrategies.Bubble); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Controls/WinUtils.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Platform; 3 | using System; 4 | 5 | namespace NP.Ava.Visuals.Controls 6 | { 7 | public static class WinUtils 8 | { 9 | public static IPlatformHandle GetPlatformHandle(this Window window) 10 | { 11 | return window.TryGetPlatformHandle(); 12 | } 13 | 14 | public static IntPtr GetWinHandle(this Window window) 15 | { 16 | return window.GetPlatformHandle().Handle; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Themes/DefaultColors.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #D4D4D4 5 | #979797 6 | #FF000000 7 | 8 | #282828 9 | 10 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantedWindowTest/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Converters/BoolToChromeHintsConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Platform; 2 | using NP.Ava.Visuals.Converters; 3 | 4 | namespace NP.Ava.Visuals.Converters; 5 | 6 | public class BoolToChromeHintsConverter : GenericBoolConverter 7 | { 8 | public static BoolToChromeHintsConverter Instance { get; } = 9 | new BoolToChromeHintsConverter 10 | { 11 | TrueValue = ExtendClientAreaChromeHints.NoChrome, 12 | FalseValue = ExtendClientAreaChromeHints.SystemChrome 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingPopupDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.OverlayingPopupDemo 6 | { 7 | public partial class MainWindow : Window 8 | { 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | #if DEBUG 13 | this.AttachDevTools(); 14 | #endif 15 | } 16 | 17 | private void InitializeComponent() 18 | { 19 | AvaloniaXamlLoader.Load(this); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingWindowDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.OverlayingWindowDemo 6 | { 7 | public partial class MainWindow : Window 8 | { 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | #if DEBUG 13 | this.AttachDevTools(); 14 | #endif 15 | } 16 | 17 | private void InitializeComponent() 18 | { 19 | AvaloniaXamlLoader.Load(this); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingControlDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.OverlayingControlDemo 6 | { 7 | public partial class MainWindow : Window 8 | { 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | #if DEBUG 13 | this.AttachDevTools(); 14 | #endif 15 | } 16 | 17 | private void InitializeComponent() 18 | { 19 | AvaloniaXamlLoader.Load(this); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.Demos.MultiPlatformWindowDemo 6 | { 7 | public partial class MainWindow : Window 8 | { 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | #if DEBUG 13 | this.AttachDevTools(); 14 | #endif 15 | } 16 | 17 | private void InitializeComponent() 18 | { 19 | AvaloniaXamlLoader.Load(this); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Behaviors/CurrentBaseUrlBehaviorExtension.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Markup.Xaml; 2 | using System; 3 | 4 | namespace NP.Ava.Visuals.Behaviors 5 | { 6 | public class CurrentBaseUrlBehaviorExtension 7 | { 8 | public Uri? ProvideValue(IServiceProvider serviceProvider) 9 | { 10 | IUriContext? uriContext = serviceProvider.GetService(typeof(IUriContext)) as IUriContext; 11 | 12 | if (uriContext == null) 13 | return null; 14 | 15 | return uriContext.BaseUri; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/GridLengthHelper.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using System.Globalization; 3 | 4 | namespace NP.Ava.Visuals 5 | { 6 | public static class GridLengthHelper 7 | { 8 | public static string ToCultureInvariantStr(this GridLength gridLength) 9 | { 10 | if (gridLength.IsAuto) 11 | { 12 | return "Auto"; 13 | } 14 | 15 | string s = gridLength.Value.ToString(CultureInfo.InvariantCulture); 16 | return gridLength.IsStar ? s + "*" : s; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/WindowsOnly/WindowLongFlags.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Ava.Visuals.WindowsOnly 2 | { 3 | /// 4 | /// borrowed from http://pinvoke.net/default.aspx/Enums/WindowLongFlags.html 5 | /// 6 | enum WindowLongFlags : int 7 | { 8 | GWL_EXSTYLE = -20, 9 | GWLP_HINSTANCE = -6, 10 | GWLP_HWNDPARENT = -8, 11 | GWL_ID = -12, 12 | GWL_STYLE = -16, 13 | GWL_USERDATA = -21, 14 | GWL_WNDPROC = -4, 15 | DWLP_USER = 0x8, 16 | DWLP_MSGRESULT = 0x0, 17 | DWLP_DLGPROC = 0x4 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Collections; 3 | using Avalonia.Controls; 4 | using Avalonia.Markup.Xaml; 5 | 6 | namespace NP.CustomCursorDemo 7 | { 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | #if DEBUG 14 | this.AttachDevTools(); 15 | #endif 16 | } 17 | 18 | 19 | private void InitializeComponent() 20 | { 21 | AvaloniaXamlLoader.Load(this); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Collections; 3 | using Avalonia.Controls; 4 | using Avalonia.Markup.Xaml; 5 | 6 | namespace NP.DataGridFilteringDemo 7 | { 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | #if DEBUG 14 | this.AttachDevTools(); 15 | #endif 16 | } 17 | 18 | 19 | private void InitializeComponent() 20 | { 21 | AvaloniaXamlLoader.Load(this); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Infrastructure/SchedulerProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reactive.Concurrency; 3 | using Avalonia.Threading; 4 | 5 | namespace NP.Demos.LiveTradingDemo.Domain.Infrastructure 6 | { 7 | public class SchedulerProvider : ISchedulerProvider 8 | { 9 | public SchedulerProvider(Dispatcher dispatcher) 10 | { 11 | MainThread = new DispatcherScheduler(dispatcher); 12 | } 13 | 14 | public IScheduler MainThread { get; } 15 | public IScheduler Background => TaskPoolScheduler.Default; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/NP.Demos.SimpleThemingAndL10NSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Converters/IntSumConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | 7 | namespace NP.Ava.Visuals.Converters 8 | { 9 | public class IntSumConverter : IMultiValueConverter 10 | { 11 | public static IntSumConverter Instance { get; } = new IntSumConverter(); 12 | 13 | public object? Convert(IList values, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | return values?.OfType().Sum(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | Welcome to Avalonia! 11 | 12 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Interactivity; 3 | using NP.Ava.Visuals; 4 | 5 | namespace NP.ElementImageTest 6 | { 7 | public partial class MainWindow : Window 8 | { 9 | public MainWindow() 10 | { 11 | InitializeComponent(); 12 | TakeElementImageButton.Click += TakeElementImageButton_Click; 13 | } 14 | 15 | private void TakeElementImageButton_Click(object? sender, RoutedEventArgs e) 16 | { 17 | TheImage.Source = ButtonPanel.ControlToImage(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/WindowsOnly/GtkApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace NP.Ava.Visuals.WindowsOnly 5 | { 6 | public static class GtkApi 7 | { 8 | private const string GdkName = "libgdk-3.so.0"; 9 | private const string GtkName = "libgtk-3.so.0"; 10 | [DllImport(GdkName)] 11 | // return the X11 handle for the linux window 12 | public static extern IntPtr gdk_x11_window_get_xid(IntPtr window); 13 | 14 | [DllImport(GtkName)] 15 | // destroys the gtk window 16 | public static extern void gtk_widget_destroy(IntPtr gtkWidget); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Demos/NP.ColorUtils/NP.ColorUtils.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | 5 | NP.ThemingPrototype.Program 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /FinanceDemos/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | 11.2.3.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Converters/SumConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | 7 | namespace NP.Ava.Visuals.Converters 8 | { 9 | public class SumConverter : IMultiValueConverter 10 | { 11 | public static SumConverter Instance { get; } = new SumConverter(); 12 | 13 | public object Convert(IList values, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (values == null) 16 | return 0d; 17 | 18 | return values.OfType().Sum(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Behaviors/MultiClickEventMatcher.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Input; 2 | using Avalonia.Interactivity; 3 | 4 | namespace NP.Ava.Visuals.Behaviors 5 | { 6 | public class MultiClickEventMatcher : IRoutedEventArgsMatcher 7 | { 8 | public int NumberClicked { get; set; } = 2; 9 | 10 | public bool Matches(RoutedEventArgs args) 11 | { 12 | if (args.RoutedEvent != InputElement.PointerPressedEvent) 13 | return false; 14 | 15 | PointerPressedEventArgs pointerPressedEventArgs = (PointerPressedEventArgs)args; 16 | 17 | return pointerPressedEventArgs.ClickCount == NumberClicked; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Controls/ActionIndicator.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.Primitives; 3 | 4 | namespace NP.Ava.Visuals.Controls 5 | { 6 | public class ActionIndicator : TemplatedControl 7 | { 8 | #region IsOn Styled Avalonia Property 9 | public bool IsOn 10 | { 11 | get { return GetValue(IsOnProperty); } 12 | set { SetValue(IsOnProperty, value); } 13 | } 14 | 15 | public static readonly StyledProperty IsOnProperty = 16 | AvaloniaProperty.Register 17 | ( 18 | nameof(IsOn) 19 | ); 20 | #endregion IsOn Styled Avalonia Property 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/NP.LocalizationPrototype.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Demos/NP.AutoGridTest/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.AutoGridTest 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.ControlsDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.LabeledControlDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Markup.Xaml; 4 | using NP.Ava.Visuals.Controls; 5 | using NP.Ava.Visuals.ThemingAndL10N; 6 | 7 | namespace NP.LabeledControlDemo 8 | { 9 | public partial class MainWindow : Window 10 | { 11 | private ThemeLoader _themeLoader; 12 | 13 | AutoGrid _autoGrid; 14 | 15 | public MainWindow() 16 | { 17 | InitializeComponent(); 18 | #if DEBUG 19 | this.AttachDevTools(); 20 | #endif 21 | } 22 | 23 | 24 | private void InitializeComponent() 25 | { 26 | AvaloniaXamlLoader.Load(this); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Demos/NP.ThemingPrototype/NP.ThemingPrototype.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.TradesDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.CustomCursorDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.ElementImageTest 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.GridSplitterInOverlayWindowDemo/MyGridSplitter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Input; 3 | using Avalonia.Interactivity; 4 | using Avalonia.Styling; 5 | using System; 6 | 7 | namespace NP.GridSplitterInOverlayWindowDemo 8 | { 9 | public class MyGridSplitter : GridSplitter, IStyleable 10 | { 11 | Type IStyleable.StyleKey => typeof(GridSplitter); 12 | 13 | protected override void OnLostFocus(RoutedEventArgs e) 14 | { 15 | 16 | } 17 | 18 | protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) 19 | { 20 | base.OnLostFocus(e); 21 | base.OnPointerCaptureLost(e); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.ThemingPrototype/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.ThemingPrototype 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Models/Customer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using NP.Utilities; 4 | 5 | namespace NP.TradesDemo.Models; 6 | 7 | public enum Customer 8 | { 9 | None, 10 | AmericanExpress, 11 | Fidelity, 12 | BankOfAmerica, 13 | FranklinTempleton, 14 | MorganWealth, 15 | CharlesSchwab, 16 | GoldmanSachs 17 | } 18 | 19 | public static class CustomerHelper 20 | { 21 | public static Customer[] Customers { get; } = 22 | Enum.GetValues() 23 | .Except([Customer.None]) 24 | .ToArray(); 25 | 26 | public static string GetName(this Customer customer) 27 | { 28 | return customer.ToString().PhraseFromName(); 29 | } 30 | } -------------------------------------------------------------------------------- /Demos/NP.LabeledControlDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Demos/NP.LabeledControlDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.LabeledControlDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingPopupDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.OverlayingPopupDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingWindowDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.OverlayingWindowDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.DataGridFilteringDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.ThemingPrototype 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.LocalizationPrototype 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingControlDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.OverlayingControlDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantWinByHandle/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.Demos.ImplantWinByHandle 6 | { 7 | public partial class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantedWindowTest/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.Demos.BehaviorPrototypes 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingTransitionsDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.OverlayingTransitionsDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.GridSplitterInOverlayWindowDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.GridSplitterInOverlayWindowDemo 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Behaviors/AttachedPropToCollectionBindingBehavior.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace NP.Ava.Visuals.Behaviors 6 | { 7 | public class AttachedPropToCollectionBindingBehavior : 8 | ToCollectionBindingBehavior 9 | { 10 | public AttachedPropToCollectionBindingBehavior 11 | ( 12 | AvaloniaObject source, 13 | AvaloniaProperty attachedProp, 14 | IEnumerable collection, 15 | Action setter) 16 | : 17 | base(new AttachedPropValueGetter(source, attachedProp), collection, setter) 18 | { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Converters/AndConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | 6 | namespace NP.Ava.Visuals.Converters 7 | { 8 | internal class AndConverter : IMultiValueConverter 9 | { 10 | public object Convert(IList values, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | foreach(object val in values) 13 | { 14 | if (val is bool b) 15 | { 16 | if (!b) 17 | { 18 | return false; 19 | } 20 | } 21 | } 22 | 23 | return true; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "SubModules/NP.Utilities"] 2 | path = SubModules/NP.Utilities 3 | url = https://github.com/npolyak/NP.Utilities.git 4 | [submodule "SubModules/NP.Concepts.Behaviors"] 5 | path = SubModules/NP.Concepts.Behaviors 6 | url = https://github.com/npolyak/NP.Concepts.Behaviors.git 7 | [submodule "SubModules/NP.DependencyInjection"] 8 | path = SubModules/NP.DependencyInjection 9 | url = https://github.com/npolyak/NP.DependencyInjection.git 10 | [submodule "SubModules/NP.NLogAdapter"] 11 | path = SubModules/NP.NLogAdapter 12 | url = https://github.com/npolyak/NP.NLogAdapter.git 13 | [submodule "SubModules/NP.ViewModelInterfaces"] 14 | path = SubModules/NP.ViewModelInterfaces 15 | url = https://github.com/npolyak/NP.ViewModelInterfaces.git 16 | -------------------------------------------------------------------------------- /ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace NP.Demos.SimpleThemingAndL10NSample 6 | { 7 | public class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace NP.Demos.LiveTradingDemo 4 | { 5 | class Program 6 | { 7 | // Initialization code. Don't use any Avalonia, third-party APIs or any 8 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 9 | // yet and stuff might break. 10 | public static void Main(string[] args) => BuildAvaloniaApp() 11 | .StartWithClassicDesktopLifetime(args); 12 | 13 | // Avalonia configuration, don't remove; also used by visual designer. 14 | public static AppBuilder BuildAvaloniaApp() 15 | => AppBuilder.Configure() 16 | .UsePlatformDetect() 17 | .LogToTrace(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace NP.Demos.MultiPlatformWindowDemo 4 | { 5 | class Program 6 | { 7 | // Initialization code. Don't use any Avalonia, third-party APIs or any 8 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 9 | // yet and stuff might break. 10 | public static void Main(string[] args) => BuildAvaloniaApp() 11 | .StartWithClassicDesktopLifetime(args); 12 | 13 | // Avalonia configuration, don't remove; also used by visual designer. 14 | public static AppBuilder BuildAvaloniaApp() 15 | => AppBuilder.Configure() 16 | .UsePlatformDetect() 17 | .LogToTrace(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace NP.Demos.BehaviorPrototypes 4 | { 5 | class Program 6 | { 7 | // Initialization code. Don't use any Avalonia, third-party APIs or any 8 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 9 | // yet and stuff might break. 10 | public static void Main(string[] args) => BuildAvaloniaApp() 11 | .StartWithClassicDesktopLifetime(args); 12 | 13 | // Avalonia configuration, don't remove; also used by visual designer. 14 | public static AppBuilder BuildAvaloniaApp() 15 | => AppBuilder.Configure() 16 | .UsePlatformDetect() 17 | .LogToTrace(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace NP.Demos.CustomWindowSample 4 | { 5 | class Program 6 | { 7 | // Initialization code. Don't use any Avalonia, third-party APIs or any 8 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 9 | // yet and stuff might break. 10 | public static void Main(string[] args) => BuildAvaloniaApp() 11 | .StartWithClassicDesktopLifetime(args); 12 | 13 | // Avalonia configuration, don't remove; also used by visual designer. 14 | public static AppBuilder BuildAvaloniaApp() 15 | => AppBuilder.Configure() 16 | .UsePlatformDetect() 17 | .LogToTrace(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantedWindowTest/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | 3 | namespace NP.Demos.BehaviorPrototypes 4 | { 5 | class Program 6 | { 7 | // Initialization code. Don't use any Avalonia, third-party APIs or any 8 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 9 | // yet and stuff might break. 10 | public static void Main(string[] args) => BuildAvaloniaApp() 11 | .StartWithClassicDesktopLifetime(args); 12 | 13 | // Avalonia configuration, don't remove; also used by visual designer. 14 | public static AppBuilder BuildAvaloniaApp() 15 | => AppBuilder.Configure() 16 | .UsePlatformDetect() 17 | .LogToTrace(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.ApplicationLifetimes; 4 | using Avalonia.Markup.Xaml; 5 | using NP.Utilities; 6 | 7 | namespace NP.Demos.LiveTradingDemo 8 | { 9 | public class App : Application 10 | { 11 | public override void Initialize() 12 | { 13 | AvaloniaXamlLoader.Load(this); 14 | } 15 | 16 | public override void OnFrameworkInitializationCompleted() 17 | { 18 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 19 | { 20 | desktop.MainWindow = new MainWindow(); 21 | } 22 | 23 | base.OnFrameworkInitializationCompleted(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/ColorThemes/LightResources.axaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 8 | 10 | 12 | 13 | 15 | 16 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.ApplicationLifetimes; 4 | using Avalonia.Markup.Xaml; 5 | using NP.Utilities; 6 | 7 | namespace NP.Demos.BehaviorPrototypes 8 | { 9 | public class App : Application 10 | { 11 | public override void Initialize() 12 | { 13 | AvaloniaXamlLoader.Load(this); 14 | } 15 | 16 | public override void OnFrameworkInitializationCompleted() 17 | { 18 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 19 | { 20 | desktop.MainWindow = new MainWindow(); 21 | } 22 | 23 | base.OnFrameworkInitializationCompleted(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.ApplicationLifetimes; 4 | using Avalonia.Markup.Xaml; 5 | using NP.Utilities; 6 | 7 | namespace NP.Demos.CustomWindowSample 8 | { 9 | public class App : Application 10 | { 11 | public override void Initialize() 12 | { 13 | AvaloniaXamlLoader.Load(this); 14 | } 15 | 16 | public override void OnFrameworkInitializationCompleted() 17 | { 18 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 19 | { 20 | desktop.MainWindow = new MainWindow(); 21 | } 22 | 23 | base.OnFrameworkInitializationCompleted(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demos/NP.GridSplitterInOverlayWindowDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Markup.Xaml; 4 | using System; 5 | 6 | namespace NP.GridSplitterInOverlayWindowDemo 7 | { 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | #if DEBUG 14 | this.AttachDevTools(); 15 | #endif 16 | 17 | this.Closed += MainWindow_Closed; 18 | } 19 | 20 | private void MainWindow_Closed(object? sender, System.EventArgs e) 21 | { 22 | Environment.Exit(0); 23 | } 24 | 25 | private void InitializeComponent() 26 | { 27 | AvaloniaXamlLoader.Load(this); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/ColorThemes/DarkResources.axaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 8 | 10 | 12 | 13 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demos/NP.AutoGridTest/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.AutoGridTest 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.ControlsDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /FinanceDemos/NP.TradesDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.TradesDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.CustomCursorDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.ElementImageTest 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.LabeledControlDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | 20 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Demos/NP.LabeledControlDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.LabeledControlDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.DataGridFilteringDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingControlDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.OverlayingControlDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingPopupDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.OverlayingPopupDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingWindowDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.OverlayingWindowDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.ThemingPrototype 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingTransitionsDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.OverlayingTransitionsDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantWinByHandle/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.Demos.ImplantWinByHandle 5 | { 6 | internal class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Demos/NP.ThemingPrototype/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.ThemingPrototype 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder 18 | .Configure() 19 | .UsePlatformDetect() 20 | .LogToTrace(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Converters/IntConverters.cs: -------------------------------------------------------------------------------- 1 | // (c) Nick Polyak 2021 - http://awebpros.com/ 2 | // License: MIT License (https://opensource.org/licenses/MIT) 3 | // 4 | // short overview of copyright rules: 5 | // 1. you can use this framework in any commercial or non-commercial 6 | // product as long as you retain this copyright message 7 | // 2. Do not blame the author of this software if something goes wrong. 8 | // 9 | // Also, please, mention this software in any documentation for the 10 | // products that use it. 11 | 12 | namespace NP.Ava.Visuals.Converters 13 | { 14 | public static class IntConverters 15 | { 16 | public static ToBoolConverter IsPositiveConverter { get; } = 17 | new ToBoolConverter 18 | { 19 | IsTrue = val => val > 0 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Converters/OrConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | 6 | namespace NP.Ava.Visuals.Converters 7 | { 8 | public class OrConverter : IMultiValueConverter 9 | { 10 | public static OrConverter Instance { get; } = new OrConverter(); 11 | 12 | public object Convert(IList values, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | foreach (object val in values) 15 | { 16 | if (val is bool b) 17 | { 18 | if (b) 19 | { 20 | return true; 21 | } 22 | } 23 | } 24 | 25 | return false; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Demos/NP.GridSplitterInOverlayWindowDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | 4 | namespace NP.GridSplitterInOverlayWindowDemo 5 | { 6 | class Program 7 | { 8 | // Initialization code. Don't use any Avalonia, third-party APIs or any 9 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 10 | // yet and stuff might break. 11 | [STAThread] 12 | public static void Main(string[] args) => BuildAvaloniaApp() 13 | .StartWithClassicDesktopLifetime(args); 14 | 15 | // Avalonia configuration, don't remove; also used by visual designer. 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure() 18 | .UsePlatformDetect() 19 | .LogToTrace(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Behaviors/AttachedPropValueGetter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using NP.Concepts.Behaviors; 3 | using System; 4 | 5 | namespace NP.Ava.Visuals.Behaviors 6 | { 7 | public class AttachedPropValueGetter : IValueGetter 8 | { 9 | public AvaloniaObject Source { get; } 10 | 11 | private AvaloniaProperty _attachedProperty; 12 | 13 | public TProp GetValue() => Source.GetValue(_attachedProperty); 14 | 15 | public IObservable ValueObservable { get; } 16 | 17 | public AttachedPropValueGetter(AvaloniaObject source, AvaloniaProperty attachedProperty) 18 | { 19 | Source = source; 20 | _attachedProperty = attachedProperty; 21 | 22 | ValueObservable = source.GetObservable(_attachedProperty); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Converters/InvertColorConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using Avalonia.Media; 3 | using NP.Ava.Visuals.ColorUtils; 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace NP.Ava.Visuals.Converters 8 | { 9 | public class InvertColorConverter : IValueConverter 10 | { 11 | public static InvertColorConverter Instance { get; } = 12 | new InvertColorConverter(); 13 | 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | Color color = (Color)value; 17 | 18 | return color.Invert(); 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AvaloniaSnippets/Readme.md: -------------------------------------------------------------------------------- 1 | This folder contains the following AvaloniaUI snippets: 2 | 3 | * avap - a snippet for creating an Avalonia Attached Property 4 | * avsp - a snippet for creating an Avalonia Style Property 5 | * avdr - a snippet for creating an Avalonia Direct Property 6 | 7 | To install these snippets on your Visual Studio follow the steps below: 8 | 1. Download those snippets and place them in the same folder you want to use for your snippets 9 | 2. Open your Visual Studio, click Code Snippet Manager menu item under Tools menu: ![image](https://user-images.githubusercontent.com/2833722/131730756-912a6d95-4c6c-4fc9-96c1-51d90853db9c.png) 10 | 3. Press Add button, navigate to the snippets folder you want to add and press "Select Folder" button: ![image](https://user-images.githubusercontent.com/2833722/131731211-707135d8-3c68-4c50-95a2-a52957fd60c3.png) 11 | 12 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/Themes/MainColorThemes/DarkColorsTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FF666666 5 | #2B2B2B 6 | #666666 7 | #666666 8 | #3B3B3B 9 | #4E4E4E 10 | #3A3A3A 11 | #FFFFFFFF 12 | #D9D9D9 13 | #888888 14 | 15 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantWinByHandle/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 14 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Converters/ThicknessToDoubleConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Data.Converters; 3 | using System; 4 | using System.Globalization; 5 | 6 | namespace NP.Ava.Visuals.Converters 7 | { 8 | public class ThicknessToDoubleConverter : IValueConverter 9 | { 10 | public static ThicknessToDoubleConverter Instance { get; } = new ThicknessToDoubleConverter(); 11 | 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | if (value is Thickness th) 15 | { 16 | return th.Left; 17 | } 18 | 19 | return 0d; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.ApplicationLifetimes; 4 | using System; 5 | 6 | namespace NP.LocalizationPrototype 7 | { 8 | class Program 9 | { 10 | // Initialization code. Don't use any Avalonia, third-party APIs or any 11 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 12 | // yet and stuff might break. 13 | [STAThread] 14 | public static void Main(string[] args) => BuildAvaloniaApp() 15 | .StartWithClassicDesktopLifetime(args); 16 | 17 | // Avalonia configuration, don't remove; also used by visual designer. 18 | public static AppBuilder BuildAvaloniaApp() 19 | => AppBuilder.Configure() 20 | .UsePlatformDetect() 21 | .LogToTrace(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ThemingAndL10N/ThemeVariantReference.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Styling; 2 | using NP.Utilities; 3 | using System.ComponentModel; 4 | 5 | namespace NP.Ava.Visuals.ThemingAndL10N 6 | { 7 | public class ThemeVariantReference : VMBase 8 | { 9 | #region TheThemeVariant Property 10 | private ThemeVariant? _themeVariant; 11 | public ThemeVariant? TheThemeVariant 12 | { 13 | get 14 | { 15 | return this._themeVariant; 16 | } 17 | set 18 | { 19 | if (this._themeVariant.ObjEquals(value)) 20 | { 21 | return; 22 | } 23 | 24 | this._themeVariant = value; 25 | this.OnPropertyChanged(nameof(TheThemeVariant)); 26 | } 27 | } 28 | #endregion TheThemeVariant Property 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantedWindowTest/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 13 | 14 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Converters/ExtendClientAreaToDecorationHintConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Data.Converters; 3 | using NP.Utilities; 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace NP.Ava.Visuals.Converters; 8 | 9 | public class ExtendClientAreaToDecorationHintConverter : IValueConverter 10 | { 11 | public static IValueConverter Instance { get; } = 12 | new ExtendClientAreaToDecorationHintConverter(); 13 | 14 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) 15 | { 16 | return (!OSUtils.IsWindows) || ((value is WindowState windowState) && (windowState is WindowState.Normal or WindowState.Minimized)); 17 | } 18 | 19 | public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Converters/FactorConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using System; 3 | using System.Globalization; 4 | 5 | namespace NP.Ava.Visuals.Converters 6 | { 7 | public class FactorConverter : IValueConverter 8 | { 9 | public static FactorConverter TheDoubleConverter { get; } = 10 | new FactorConverter { TheFactor = 2d }; 11 | 12 | public double TheFactor { get; private set; } = 1d; 13 | 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (!(value is double)) 17 | return 0d; 18 | 19 | return ((double)value) * TheFactor; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Converters/FromControlContainerConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using NP.Utilities; 3 | using System; 4 | using System.Globalization; 5 | 6 | namespace NP.Ava.Visuals.Converters 7 | { 8 | public class FromControlContainerConverter : IValueConverter 9 | { 10 | public static FromControlContainerConverter Instance { get; } = 11 | new FromControlContainerConverter(); 12 | 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value is ControlContainer controlContainer) 16 | return controlContainer.Control; 17 | 18 | return value; 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/NP.Demos.MultiPlatformWindowDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.ApplicationLifetimes; 4 | using System; 5 | 6 | namespace NP.Demos.SimpleThemingAndL10NSample 7 | { 8 | class Program 9 | { 10 | // Initialization code. Don't use any Avalonia, third-party APIs or any 11 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 12 | // yet and stuff might break. 13 | [STAThread] 14 | public static void Main(string[] args) => BuildAvaloniaApp() 15 | .StartWithClassicDesktopLifetime(args); 16 | 17 | // Avalonia configuration, don't remove; also used by visual designer. 18 | public static AppBuilder BuildAvaloniaApp() 19 | => AppBuilder.Configure() 20 | .UsePlatformDetect() 21 | .LogToTrace(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Demos/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | enable 5 | 11.3.0 6 | 7 | 8 | 9 | 10 | 11 | 13 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Converters/ToControlContainerConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Data.Converters; 3 | using System; 4 | using System.Globalization; 5 | 6 | namespace NP.Ava.Visuals.Converters 7 | { 8 | public class ToControlContainerConverter : IValueConverter 9 | { 10 | public static ToControlContainerConverter Instance { get; } = 11 | new ToControlContainerConverter(); 12 | 13 | public object? Convert(object? value, Type targetType, object? parameter, CultureInfo? culture) 14 | { 15 | Control? control = value as Control; 16 | 17 | if (control == null) 18 | return value; 19 | 20 | return new ControlContainer(control); 21 | } 22 | 23 | public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo? culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/Data.cs: -------------------------------------------------------------------------------- 1 | using NP.Utilities; 2 | using System.ComponentModel; 3 | 4 | namespace NP.LocalizationPrototype 5 | { 6 | public class Data : VMBase 7 | { 8 | private static int _sid = 0; 9 | 10 | private int _id = ++_sid; 11 | 12 | public int ID 13 | { 14 | get { return _id; } 15 | } 16 | 17 | 18 | #region Uid Property 19 | private string _uid; 20 | public string Uid 21 | { 22 | get 23 | { 24 | return this._uid; 25 | } 26 | set 27 | { 28 | if (this._uid == value) 29 | { 30 | return; 31 | } 32 | 33 | this._uid = value; 34 | this.OnPropertyChanged(nameof(Uid)); 35 | } 36 | } 37 | #endregion Uid Property 38 | 39 | public Data(string uid) 40 | { 41 | this._uid = uid; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Demos/NP.ThemingPrototype/Themes/MainColorThemes/DarkColorsTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FF666666 5 | #2B2B2B 6 | #666666 7 | #666666 8 | #3B3B3B 9 | #4E4E4E 10 | #3A3A3A 11 | #A0A0A0 12 | #808080 13 | #FFFFFFFF 14 | #D9D9D9 15 | #888888 16 | 17 | -------------------------------------------------------------------------------- /src/Themes/DataGridResources.axaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/ThemingAndL10N/StyleReference.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Styling; 2 | using NP.Utilities; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace NP.Ava.Visuals.ThemingAndL10N 10 | { 11 | public class StyleReference : Styles 12 | { 13 | public StyleReference() 14 | { 15 | } 16 | 17 | private IStyle _style = null; 18 | public IStyle TheStyle 19 | { 20 | get => _style; 21 | 22 | set 23 | { 24 | if (_style == value) 25 | return; 26 | 27 | if (_style != null) 28 | { 29 | this.Remove(_style); 30 | } 31 | 32 | _style = value; 33 | 34 | if (_style != null) 35 | { 36 | this.Add(_style); 37 | } 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Converters/StringFormatConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | 7 | namespace NP.Ava.Visuals.Converters 8 | { 9 | public class StringFormatConverter : IMultiValueConverter 10 | { 11 | public static StringFormatConverter Instance { get; } = 12 | new StringFormatConverter(); 13 | 14 | public object Convert(IList values, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | if (values.Count == 0) 17 | return null; 18 | 19 | string str = values[0].ToString(); 20 | 21 | if (values.Count == 1) 22 | return str; 23 | 24 | object[] args = values.Skip(1).ToArray(); 25 | 26 | if (args.Any(a => a == null)) 27 | return null; 28 | 29 | return string.Format(str, values.Skip(1).ToArray()); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Converters/FirstOrSecondValueConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Data.Converters; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | 7 | namespace NP.Ava.Visuals.Converters 8 | { 9 | public class FirstOrSecondValueConverter : IMultiValueConverter 10 | { 11 | public static FirstOrSecondValueConverter Instance { get; } = new FirstOrSecondValueConverter(); 12 | 13 | public object? Convert(IList values, Type targetType, object? parameter, CultureInfo culture) 14 | { 15 | if (values == null || values.Count < 2) 16 | return null; 17 | 18 | if (values[0] is bool b) 19 | { 20 | if (b) 21 | return values[1]; 22 | else 23 | { 24 | return (values.Count > 2) ? values[2] : null; 25 | } 26 | } 27 | 28 | return null; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Controls.ApplicationLifetimes; 4 | using Avalonia.Markup.Xaml; 5 | using NP.NLogAdapter; 6 | using NP.Utilities; 7 | 8 | namespace NP.Demos.MultiPlatformWindowDemo 9 | { 10 | public class App : Application 11 | { 12 | public override void Initialize() 13 | { 14 | AvaloniaXamlLoader.Load(this); 15 | } 16 | 17 | public override void OnFrameworkInitializationCompleted() 18 | { 19 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 20 | { 21 | desktop.MainWindow = 22 | new StartupTestWindow{ SizeToContent = SizeToContent.WidthAndHeight, Content = "Hello World!" }; 23 | 24 | desktop.MainWindow.Classes.Add("PlainCustomWindow"); 25 | } 26 | 27 | NLogWrapper.SetLog(); 28 | 29 | base.OnFrameworkInitializationCompleted(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Services/StaticData.cs: -------------------------------------------------------------------------------- 1 | namespace NP.Demos.LiveTradingDemo.Domain.Services; 2 | 3 | public class StaticData : IStaticData 4 | { 5 | public string[] Customers { get; } = new[] 6 | { 7 | "Bank of Andorra", 8 | "Bank of Europe", 9 | "Bank of England", 10 | "BCCI", 11 | "Abbey National", 12 | "Fx Shop", 13 | "Midland Bank", 14 | "National Bank of Alaska", 15 | "Northern Rock" 16 | }; 17 | 18 | 19 | // 'M' stands for decimal 20 | public CurrencyPair[] CurrencyPairs { get; } = { 21 | new CurrencyPair("GBP/USD",1.6M,4,5M) , 22 | new CurrencyPair("EUR/USD",1.23904M,4,3M), 23 | new CurrencyPair("EUR/GBP",0.7913M,4,2M), 24 | new CurrencyPair("NZD/CAD",0.8855M,4,0.5M) , 25 | new CurrencyPair("HKD/USD",0.128908M,6,0.01M) , 26 | new CurrencyPair("NOK/SEK",1.10M,3,2M) , 27 | new CurrencyPair("XAU/GBP",768.399M,3,0.5M) , 28 | new CurrencyPair("USD/JPY",118.81M,2,0.1M), 29 | }; 30 | } -------------------------------------------------------------------------------- /src/Converters/ShiftFromTopLeftMarginConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Data.Converters; 3 | using System; 4 | using System.Globalization; 5 | 6 | namespace NP.Ava.Visuals.Converters 7 | { 8 | public class ShiftFromTopLeftMarginConverter : IValueConverter 9 | { 10 | public static ShiftFromTopLeftMarginConverter TheInstance { get; } = 11 | new ShiftFromTopLeftMarginConverter(); 12 | 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value is double d) 16 | { 17 | return new Thickness(d, d, 0, 0); 18 | } 19 | else if (value is Point p) 20 | { 21 | return new Thickness(p.X, p.Y, 0, 0); 22 | } 23 | 24 | return new Thickness(); 25 | } 26 | 27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingWindowDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 12 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/NP.Demos.LiveTradingDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Behaviors/ToCollectionBindingBehavior.cs: -------------------------------------------------------------------------------- 1 | using NP.Concepts.Behaviors; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace NP.Ava.Visuals.Behaviors 6 | { 7 | public class ToCollectionBindingBehavior 8 | { 9 | SetItemsBehavior _setItemsBehavior; 10 | 11 | IValueGetter _valueGetter; 12 | 13 | public ToCollectionBindingBehavior 14 | ( 15 | IValueGetter valueGetter, 16 | IEnumerable targets, 17 | Action setter) 18 | { 19 | _setItemsBehavior = new SetItemsBehavior(setter); 20 | 21 | _valueGetter = valueGetter; 22 | 23 | _valueGetter.ValueObservable.Subscribe(OnSourcePropChanged); 24 | 25 | OnSourcePropChanged(_valueGetter.GetValue()); 26 | 27 | _setItemsBehavior.Items = targets; 28 | } 29 | 30 | private void OnSourcePropChanged(TProp val) 31 | { 32 | _setItemsBehavior.Val = val; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ThemingAndL10N/ThemeInfo.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | using Avalonia.Markup.Xaml; 3 | using Avalonia.Styling; 4 | using NP.ViewModelInterfaces.ThemingAndL10N; 5 | using System; 6 | 7 | namespace NP.Ava.Visuals.ThemingAndL10N 8 | { 9 | public class ThemeInfo: IThemeInfo 10 | { 11 | public object Id { get; set; } 12 | 13 | public Uri ResourceUrl { get; set; } 14 | 15 | internal IResourceProvider Resource { get; set;} 16 | 17 | public Uri StyleUrl { get; set; } 18 | 19 | internal IStyle Style { get; set; } 20 | 21 | internal void TryLoad(Uri baseUrl) 22 | { 23 | if (baseUrl == null) 24 | { 25 | return; 26 | } 27 | if (ResourceUrl != null) 28 | { 29 | Resource = 30 | (ResourceDictionary)AvaloniaXamlLoader.Load(ResourceUrl, baseUrl); 31 | } 32 | 33 | if (StyleUrl != null) 34 | { 35 | Style = (IStyle)AvaloniaXamlLoader.Load(StyleUrl, baseUrl); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Demos/NP.ToggleButtonDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | 20 | 22 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Nick Polyak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/WindowsOnly/WindowStyles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | // Borrowed from http://pinvoke.net/default.aspx/Enums/WindowStyles.html 4 | namespace NP.Ava.Visuals.WindowsOnly 5 | { 6 | [Flags] 7 | enum WindowStyles : uint 8 | { 9 | WS_BORDER = 0x800000, 10 | WS_CAPTION = 0xc00000, 11 | WS_CHILD = 0x40000000, 12 | WS_CLIPCHILDREN = 0x2000000, 13 | WS_CLIPSIBLINGS = 0x4000000, 14 | WS_DISABLED = 0x8000000, 15 | WS_DLGFRAME = 0x400000, 16 | WS_GROUP = 0x20000, 17 | WS_HSCROLL = 0x100000, 18 | WS_MAXIMIZE = 0x1000000, 19 | WS_MAXIMIZEBOX = 0x10000, 20 | WS_MINIMIZE = 0x20000000, 21 | WS_MINIMIZEBOX = 0x20000, 22 | WS_OVERLAPPED = 0x0, 23 | WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_SIZEFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 24 | WS_POPUP = 0x80000000u, 25 | WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU, 26 | WS_SIZEFRAME = 0x40000, 27 | WS_SYSMENU = 0x80000, 28 | WS_TABSTOP = 0x10000, 29 | WS_VISIBLE = 0x10000000, 30 | WS_VSCROLL = 0x200000 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Demos/NP.LocalizationPrototype/ColorDictionaries/LightResources.axaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 10 | 11 | 14 | 16 | 18 | 19 | 20 | 23 | 25 | 27 | 29 | 30 | 31 | #FF71706E 32 | 33 | #FFEEBC1D 34 | 35 | -------------------------------------------------------------------------------- /src/Controls/AvaloniaContentPresenter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.Presenters; 3 | using Avalonia.Data; 4 | using NP.Ava.Visuals.Converters; 5 | using System; 6 | 7 | namespace NP.Ava.Visuals.Controls 8 | { 9 | public class AvaloniaContentPresenter : ContentPresenter 10 | { 11 | readonly IDisposable? _bindingSubscription; 12 | public AvaloniaContentPresenter() 13 | { 14 | _bindingSubscription = 15 | this.Bind(ContentProperty, new Binding { Source = this, Path = "RealContent", Converter = ToControlContainerConverter.Instance }); 16 | } 17 | 18 | 19 | #region RealContent Styled Avalonia Property 20 | public object RealContent 21 | { 22 | get { return GetValue(RealContentProperty); } 23 | set { SetValue(RealContentProperty, value); } 24 | } 25 | 26 | public static readonly StyledProperty RealContentProperty = 27 | AvaloniaProperty.Register 28 | ( 29 | nameof(RealContent) 30 | ); 31 | #endregion RealContent Styled Avalonia Property 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Behaviors/ValueBinding.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Data; 3 | using NP.Utilities; 4 | using System; 5 | using System.Reactive.Subjects; 6 | 7 | namespace NP.Ava.Visuals.Behaviors 8 | { 9 | //internal class ValueBinding : IBinding 10 | //{ 11 | // private T? _value; 12 | // public T? Value 13 | // { 14 | // get => _value; 15 | // set 16 | // { 17 | // if (_value.ObjEquals(value)) 18 | // return; 19 | 20 | // _value = value; 21 | 22 | // if (_value != null) 23 | // { 24 | // _subject = new BehaviorSubject(_value); 25 | // } 26 | // } 27 | // } 28 | 29 | // private BehaviorSubject? _subject; 30 | 31 | // public InstancedBinding Initiate 32 | // ( 33 | // AvaloniaObject target, 34 | // AvaloniaProperty targetProperty, 35 | // object? anchor = null, 36 | // bool enableDataValidation = false) 37 | // { 38 | // return InstancedBinding.OneWay(_subject, BindingPriority.LocalValue); 39 | // } 40 | //} 41 | } 42 | -------------------------------------------------------------------------------- /Demos/NP.OverlayingPopupDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Controls/HorizontalTransform.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Media; 3 | using NP.Ava.Visuals.Behaviors; 4 | using System; 5 | 6 | namespace NP.Ava.Visuals.Controls 7 | { 8 | public class HorizontalTransform : Transform 9 | { 10 | #region TheVisualFlow Styled Avalonia Property 11 | public VisualFlow TheVisualFlow 12 | { 13 | get { return GetValue(TheVisualFlowProperty); } 14 | set { SetValue(TheVisualFlowProperty, value); } 15 | } 16 | 17 | public static readonly StyledProperty TheVisualFlowProperty = 18 | AvaloniaProperty.Register 19 | ( 20 | nameof(TheVisualFlow) 21 | ); 22 | #endregion TheVisualFlow Styled Avalonia Property 23 | 24 | public HorizontalTransform() 25 | { 26 | this.GetObservable(TheVisualFlowProperty).Subscribe(OnVisualFlowChanged); 27 | } 28 | 29 | public override Matrix Value => Matrix.CreateScale(TheVisualFlow == VisualFlow.Normal ? 1d : -1d, 1d); 30 | 31 | private void OnVisualFlowChanged(VisualFlow visualFlow) 32 | { 33 | RaiseChanged(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Converters/LastNonDefaultValueConverter.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Data.Converters; 2 | using Avalonia.Media; 3 | using NP.Utilities; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Globalization; 7 | using System.Linq; 8 | 9 | namespace NP.Ava.Visuals.Converters 10 | { 11 | public class LastNonDefaultValueConverter : IMultiValueConverter 12 | { 13 | public T? DefaultValue { get; set; } = default(T); 14 | 15 | public object? Convert(IList values, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | if (values == null) 18 | return DefaultValue; 19 | 20 | T? lastValue = values.OfType().LastOrDefault(v => !v.ObjEquals(DefaultValue)); 21 | 22 | if (lastValue == null) 23 | { 24 | return DefaultValue; 25 | } 26 | 27 | return lastValue; 28 | } 29 | } 30 | 31 | public class LastNonDefaultDoubleConverter : LastNonDefaultValueConverter { } 32 | 33 | 34 | public class LastNonDefaultColorConverter : LastNonDefaultValueConverter { } 35 | 36 | public class LastNonDefaultBrushConverter : LastNonDefaultValueConverter { } 37 | } 38 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantWinByHandle/NP.Demos.ImplantWinByHandle.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | copyused 6 | true 7 | app.manifest 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Converters/ToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | // (c) Nick Polyak 2021 - http://awebpros.com/ 2 | // License: MIT License (https://opensource.org/licenses/MIT) 3 | // 4 | // short overview of copyright rules: 5 | // 1. you can use this framework in any commercial or non-commercial 6 | // product as long as you retain this copyright message 7 | // 2. Do not blame the author of this software if something goes wrong. 8 | // 9 | // Also, please, mention this software in any documentation for the 10 | // products that use it. 11 | 12 | using Avalonia.Data.Converters; 13 | using System; 14 | using System.Collections.Generic; 15 | using System.Globalization; 16 | using System.Linq; 17 | 18 | namespace NP.Ava.Visuals.Converters 19 | { 20 | public class ToBoolConverter : IValueConverter 21 | { 22 | public Func IsTrue { get; set; } 23 | 24 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | TVal val = (TVal)value; 27 | 28 | return IsTrue(val); 29 | } 30 | 31 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls; 3 | using Avalonia.Interactivity; 4 | using Avalonia.Markup.Xaml; 5 | using NP.Ava.Visuals.Behaviors; 6 | using NP.Ava.Visuals.Controls; 7 | using NP.Ava.Visuals.ThemingAndL10N; 8 | 9 | namespace NP.ControlsDemo 10 | { 11 | public partial class MainWindow : Window 12 | { 13 | private ThemeLoader _themeLoader; 14 | 15 | AutoGrid _autoGrid; 16 | 17 | public MainWindow() 18 | { 19 | InitializeComponent(); 20 | #if DEBUG 21 | this.AttachDevTools(); 22 | #endif 23 | } 24 | 25 | 26 | private void InitializeComponent() 27 | { 28 | AvaloniaXamlLoader.Load(this); 29 | } 30 | 31 | 32 | 33 | #region Angle Styled Avalonia Property 34 | public double Angle 35 | { 36 | get { return GetValue(AngleProperty); } 37 | set { SetValue(AngleProperty, value); } 38 | } 39 | 40 | public static readonly StyledProperty AngleProperty = 41 | AvaloniaProperty.Register 42 | ( 43 | nameof(Angle) 44 | ); 45 | #endregion Angle Styled Avalonia Property 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/CustomWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | // (c) Nick Polyak 2021 - http://awebpros.com/ 2 | // License: MIT License (https://opensource.org/licenses/MIT) 3 | // 4 | // short overview of copyright rules: 5 | // 1. you can use this framework in any commercial or non-commercial 6 | // product as long as you retain this copyright message 7 | // 2. Do not blame the author of this software if something goes wrong. 8 | // 9 | // Also, please, mention this software in any documentation for the 10 | // products that use it. 11 | // 12 | using NP.Utilities; 13 | using System.ComponentModel; 14 | 15 | namespace NP.Demos.MultiPlatformWindowDemo 16 | { 17 | public class CustomWindowViewModel : VMBase 18 | { 19 | #region TheText Property 20 | private string? _text; 21 | public string? TheText 22 | { 23 | get 24 | { 25 | return this._text; 26 | } 27 | set 28 | { 29 | if (this._text == value) 30 | { 31 | return; 32 | } 33 | 34 | this._text = value; 35 | this.OnPropertyChanged(nameof(TheText)); 36 | } 37 | } 38 | #endregion TheText Property 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Demos/NP.ElementImageTest/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 13 | 14 | 16 |