├── .gitignore ├── .gitmodules ├── AvaloniaSnippets ├── Readme.md ├── avap.snippet ├── avdr.snippet ├── avow.snippet └── avsp.snippet ├── BehaviorDemos └── NP.Demos.BehaviorsDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.ThemingPrototype.csproj │ ├── NP.ThemingPrototype.sln │ ├── Program.cs │ └── Themes │ └── MainColorThemes │ ├── AccentColorThemes │ └── DarkBlueAccent.axaml │ ├── DarkColorsTheme.axaml │ └── LightColorsTheme.axaml ├── Demos ├── Directory.Build.props ├── MultiPlatformWindowDemo │ ├── App.axaml │ ├── App.axaml.cs │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── CustomWindowViewModel.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── MultiPlatformWindowDemo.sln │ ├── NP.Demos.MultiPlatformWindowDemo.csproj │ ├── NP.Demos.MultiPlatformWindowDemo.csproj.user │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── StartupTestWindow.cs │ └── nuget.config ├── NP.AutoGridTest │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.AutoGridTest.csproj │ ├── NP.AutoGridTest.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml ├── NP.ColorUtils │ ├── .gitignore │ ├── NP.ColorUtils.csproj │ ├── NP.ColorUtils.sln │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── NP.ControlsDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.ControlsDemo.csproj │ ├── NP.ControlsDemo.sln │ ├── Program.cs │ └── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml ├── NP.CustomCursorDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.CustomCursorDemo.csproj │ ├── NP.CustomCursorDemo.sln │ ├── Program.cs │ └── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml ├── NP.Demos.BehaviorPrototypes │ ├── App.axaml │ ├── App.axaml.cs │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── Events.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.Demos.BehaviorPrototypes.csproj │ ├── NP.Demos.BehaviorPrototypes.sln │ └── Program.cs ├── NP.Demos.CustomWindowSample │ ├── App.axaml │ ├── App.axaml.cs │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.Demos.CustomWindowSample.csproj │ ├── NP.Demos.CustomWindowSample.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── nuget.config ├── NP.Demos.ImplantWinByHandle │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.Demos.ImplantWinByHandle.csproj │ ├── NP.Demos.ImplantWinByHandle.sln │ ├── Program.cs │ └── app.manifest ├── NP.Demos.ImplantedWindowTest │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.Demos.ImplantedWindowTest.csproj │ ├── NP.Demos.ImplantedWindowTest.sln │ ├── NuGet.Config │ ├── Program.cs │ └── app.manifest ├── NP.Demos.LiveTradingDemo │ ├── App.axaml │ ├── App.axaml.cs │ ├── Assets │ │ ├── LinuxIcon.jpg │ │ └── LinuxIcon.png │ ├── Domain │ │ ├── Infrastructure │ │ │ ├── DispatcherScheduler.cs │ │ │ ├── Extensions.cs │ │ │ ├── ILogger.cs │ │ │ ├── ISchedulerProvider.cs │ │ │ ├── LogEntry.cs │ │ │ ├── LogEntrySummary.cs │ │ │ ├── LogLevel.cs │ │ │ └── SchedulerProvider.cs │ │ ├── Model │ │ │ ├── BuyOrSell.cs │ │ │ ├── CurrencyPair.cs │ │ │ ├── MarketData.cs │ │ │ ├── Trade.cs │ │ │ ├── TradeProxy.cs │ │ │ └── TradeStatus.cs │ │ └── Services │ │ │ ├── IMarketDataService.cs │ │ │ ├── IStaticData.cs │ │ │ ├── ITradeService.cs │ │ │ ├── MarketDataService.cs │ │ │ ├── StaticData.cs │ │ │ ├── TradeGenerator.cs │ │ │ └── TradeService.cs │ ├── LiveTradesViewer.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.Demos.LiveTradingDemo.csproj │ ├── NP.Demos.LiveTradingDemo.sln │ ├── Program.cs │ └── ViewModels │ │ ├── LiveTradesViewModel.cs │ │ └── SearchHints.cs ├── NP.ElementImageTest │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.ElementImageTest.csproj │ ├── NP.ElementImageTest.sln │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Themes │ │ ├── DarkCrystalTheme.axaml │ │ └── LightCrystalTheme.axaml ├── NP.GridSplitterInOverlayWindowDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── MyGridSplitter.cs │ ├── NP.GridSplitterInOverlayWindowDemo.csproj │ ├── NP.GridSplitterInOverlayWindowDemo.sln │ └── Program.cs ├── NP.LabeledControlDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.LabeledControlDemo.csproj │ ├── NP.LabeledControlDemo.sln │ └── Program.cs ├── NP.LocalizationPrototype │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── ColorDictionaries │ │ ├── DarkResources.axaml │ │ └── LightResources.axaml │ ├── ColorThemes.cs │ ├── Data.cs │ ├── Images │ │ ├── English.jpg │ │ ├── Hebrew.jpg │ │ ├── Russian.jpg │ │ └── USA.png │ ├── Language.cs │ ├── LanguageDictionaries │ │ ├── EnglishResources.axaml │ │ ├── HebrewResources.axaml │ │ └── RussianResources.axaml │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.LocalizationPrototype.csproj │ ├── NP.LocalizationPrototype.sln │ ├── Program.cs │ └── Resources │ │ └── AppStyles.axaml ├── NP.OverlayingControlDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.OverlayingControlDemo.csproj │ ├── NP.OverlayingControlDemo.sln │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── NP.OverlayingPopupDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.OverlayingPopupDemo.csproj │ ├── NP.OverlayingPopupDemo.sln │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── NP.OverlayingTransitionsDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.OverlayingTransitionsDemo.csproj │ ├── NP.OverlayingTransitionsDemo.sln │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── NP.OverlayingWindowDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.OverlayingWindowDemo.csproj │ ├── NP.OverlayingWindowDemo.sln │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── NP.ThemingPrototype │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.ThemingPrototype.csproj │ ├── NP.ThemingPrototype.sln │ ├── Program.cs │ └── Themes │ │ └── MainColorThemes │ │ ├── AccentColorThemes │ │ └── DarkBlueAccent.axaml │ │ ├── DarkColorsTheme.axaml │ │ └── LightColorsTheme.axaml └── NP.ToggleButtonDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.ToggleButtonDemo.csproj │ ├── NP.ToggleButtonDemo.sln │ ├── Program.cs │ └── Themes │ ├── DarkCrystalTheme.axaml │ └── LightCrystalTheme.axaml ├── Directory.Build.props ├── FinanceDemos ├── Directory.Build.props └── NP.TradesDemo │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── Models │ ├── BuyOrSell.cs │ ├── Customer.cs │ ├── NasdaqSymbols.cs │ ├── Trade.cs │ ├── TradeStatus.cs │ └── Traders.cs │ ├── NP.TradesDemo.csproj │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Themes │ ├── DarkCrystalTheme.axaml │ └── LightCrystalTheme.axaml │ └── TradesDemo.sln ├── LICENSE ├── README.md ├── ThemeDemos └── NP.Demos.SimpleThemingAndL10NSample │ ├── .gitignore │ ├── App.axaml │ ├── App.axaml.cs │ ├── ColorThemes │ ├── DarkResources.axaml │ └── LightResources.axaml │ ├── LanguageDictionaries │ ├── EnglishDictionary.axaml │ └── HebrewDictionary.axaml │ ├── MainWindow.axaml │ ├── MainWindow.axaml.cs │ ├── NP.Demos.SimpleThemingAndL10NSample.csproj │ ├── NP.Demos.SimpleThemingAndL10NSample.sln │ └── Program.cs └── src ├── Assets └── avalonia-32.png ├── Behaviors ├── AttachedPropToCollectionBindingBehavior.cs ├── AttachedPropValueGetter.cs ├── CallAction.cs ├── ClassesBehavior.cs ├── CurrentBaseUrlBehaviorExtension.cs ├── CurrentScreenPointBehavior.cs ├── EventBehavior.cs ├── FindLogicalAncestorBehavior.cs ├── FindPartBehavior.cs ├── FindResourceBehavior.cs ├── FindVisualDescendantBehavior.cs ├── GridColumnsBehavior.cs ├── GridPartsResizeBehavior.cs ├── HandleEventBehavior.cs ├── HasVisibleLogicalChildrenBehavior.cs ├── IRoutedEventArgsMatcher.cs ├── ImageHelper.cs ├── KeyboardService.cs ├── LeftOverSizeBehavior.cs ├── LogicalChildBehavior.cs ├── LogicalChildrenBehavior.cs ├── MultiClickEventMatcher.cs ├── OverlayBehavior.cs ├── ProcessControllerBehavior.cs ├── PropertiesChangeObserver.cs ├── ReactiveLogicalDescendantsBehavior.cs ├── ReactiveVisualDesendantsBehavior.cs ├── ResizeBehavior.cs ├── ResourceTreeHelper.cs ├── SetDynamicResourceBehavior.cs ├── StringContactBehavior.cs ├── ThemeVariantBehavior.cs ├── ToCollectionBindingBehavior.cs ├── TriggerBehavior.cs ├── ValueBinding.cs ├── VisualFlow.cs ├── VisualFlowBehavior.cs ├── VisualHelper.cs └── WindowSystemDecorationChangeBehavior.cs ├── ColorUtils ├── ColorHelper.cs └── HslColor.cs ├── ControlContainer.cs ├── Controls ├── ActionIndicator.cs ├── AttachedProperties.cs ├── AutoGrid.cs ├── AvaloniaContentPresenter.cs ├── CustomWindow.cs ├── GridLenDictionary.cs ├── HorizontalTransform.cs ├── ImplantedWindowHost.cs ├── ImplantedWindowHostContainer.cs ├── LabeledControl.cs ├── NpComboBox.cs ├── NpItemsPresenter.cs ├── NpToggleButton.cs ├── OverlayingPopup.cs ├── PieSegment.cs ├── VisualsRepeater.cs └── WinUtils.cs ├── Converters ├── AndConverter.cs ├── AngleToPointConverter.cs ├── BitmapConverter.cs ├── BoolConverters.cs ├── BoolToBrushConverter.cs ├── BoolToChromeHintsConverter.cs ├── BoolToCornerRadiusConverter.cs ├── BoolToDoubleConverter.cs ├── BoolToIntConverter.cs ├── BoolToStringConverter.cs ├── BoolToThicknessConverter.cs ├── BorderThicknessConverter.cs ├── EnumTypeToValuesConverter.cs ├── ExtendClientAreaToDecorationHintConverter.cs ├── FactorConverter.cs ├── FirstOrSecondValueConverter.cs ├── FromControlContainerConverter.cs ├── GenericBoolConverter.cs ├── IntConverters.cs ├── IntSumConverter.cs ├── InvertColorConverter.cs ├── LastNonDefaultValueConverter.cs ├── NoTopBorderThicknessConverter.cs ├── OrConverter.cs ├── OrientationConverters.cs ├── ShiftFromTopLeftMarginConverter.cs ├── StringFormatConverter.cs ├── SumConverter.cs ├── ThicknessToDoubleConverter.cs ├── ToBoolConverter.cs ├── ToControlContainerConverter.cs ├── ToGridLengthConverter.cs ├── ToWindowIconConverter.cs └── VisualFlowConverter.cs ├── GridLengthHelper.cs ├── MarkupExtensions ├── DynamicResourceBinding.cs └── ExtensionsHelper.cs ├── NP.Ava.Visuals.csproj ├── PointHelper.cs ├── Properties └── AssemblyInfo.cs ├── Themes ├── ButtonStyles.axaml ├── CustomWindowStyles.axaml ├── DataGridResources.axaml ├── DefaultColors.axaml ├── Geometries.axaml ├── OverlayingPopupStyles.axaml ├── PieSegmentStyles.axaml ├── TextStyles.axaml ├── ThemeResources.axaml └── ThemeStyles.axaml ├── ThemingAndL10N ├── StyleReference.cs ├── ThemeInfo.cs ├── ThemeLoader.cs └── ThemeVariantReference.cs └── WindowsOnly ├── GtkApi.cs ├── ImplantWindowUtils.cs ├── WinApi.cs ├── WindowLongFlags.cs └── WindowStyles.cs /.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 | -------------------------------------------------------------------------------- /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/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 11 | 13 | 15 | 16 | 18 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/NP.ThemingPrototype.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/Themes/MainColorThemes/AccentColorThemes/DarkBlueAccent.axaml: -------------------------------------------------------------------------------- 1 | 3 | #23597D 4 | #3178AD 5 | 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /BehaviorDemos/NP.Demos.BehaviorsDemo/Themes/MainColorThemes/LightColorsTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #D4D4D4 5 | #979797 6 | #050505 7 | #282828 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/MultiPlatformWindowDemo/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/MultiPlatformWindowDemo/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/MultiPlatformWindowDemo/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /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/MultiPlatformWindowDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | Welcome to Avalonia! 11 | 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/NP.Demos.MultiPlatformWindowDemo.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ProjectDebugger 5 | 6 | 7 | NP.Demos.MultiPlatformWindowDemo 8 | 9 | -------------------------------------------------------------------------------- /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/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/MultiPlatformWindowDemo/StartupTestWindow.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.Controls; 13 | using Avalonia.Styling; 14 | using NP.Ava.Visuals.Controls; 15 | using System; 16 | 17 | namespace NP.Demos.MultiPlatformWindowDemo 18 | { 19 | public class StartupTestWindow : CustomWindow 20 | { 21 | protected override Type StyleKeyOverride => typeof(StartupTestWindow); 22 | 23 | public void StartWindowWithCustomHeaderAndViewModel() 24 | { 25 | var window = new CustomWindow 26 | { 27 | DragOnBeginMove = false, 28 | Width=600, 29 | Height=500, 30 | }; 31 | 32 | window.Classes.Add("WindowContentHeaderAndViewModel"); 33 | 34 | window.Show(); 35 | } 36 | 37 | 38 | public void StartWindowWithCompleteHeaderRestyling() 39 | { 40 | var window = new CustomWindow 41 | { 42 | Width = 600, 43 | Height = 500 44 | }; 45 | 46 | window.Classes.Add("CompleteHeaderRestyling"); 47 | 48 | window.Show(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Demos/MultiPlatformWindowDemo/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/NP.AutoGridTest/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /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.AutoGridTest/NP.AutoGridTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | 5 | 6 | -------------------------------------------------------------------------------- /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.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.AutoGridTest/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.ColorUtils/NP.ColorUtils.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | 5 | NP.ThemingPrototype.Program 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /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.ColorUtils/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NP.ColorUtils": { 4 | "commandName": "Project", 5 | "commandLineArgs": "#302F4A" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 12 | 14 | 16 | 17 | 18 | 19 | 21 | 24 | 25 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /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.ControlsDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /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/NP.ControlsDemo/NP.ControlsDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/Themes/DarkCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FF000000 4 | #FFF3F3F3 5 | #FF222222 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.ControlsDemo/Themes/LightCrystalTheme.axaml: -------------------------------------------------------------------------------- 1 | 3 | #FFFFFFFF 4 | #FF0C0C0C 5 | #FFDDDDDD 6 | 7 | -------------------------------------------------------------------------------- /Demos/NP.CustomCursorDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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.CustomCursorDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | 20 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /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.CustomCursorDemo/NP.CustomCursorDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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.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/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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.BehaviorPrototypes/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.Demos.BehaviorPrototypes/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.Demos.BehaviorPrototypes/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 13 | 22 | 23 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Interactivity; 3 | using Avalonia.Markup.Xaml; 4 | using NP.Ava.Visuals.Controls; 5 | 6 | namespace NP.Demos.BehaviorPrototypes 7 | { 8 | public partial class MainWindow : CustomWindow 9 | { 10 | 11 | #region WindowPosition Styled Avalonia Property 12 | public PixelPoint WindowPosition 13 | { 14 | get { return GetValue(WindowPositionProperty); } 15 | set { SetValue(WindowPositionProperty, value); } 16 | } 17 | 18 | public static readonly StyledProperty WindowPositionProperty = 19 | AvaloniaProperty.Register 20 | ( 21 | nameof(WindowPosition) 22 | ); 23 | #endregion WindowPosition Styled Avalonia Property 24 | 25 | 26 | public MainWindow() 27 | { 28 | InitializeComponent(); 29 | #if DEBUG 30 | this.AttachDevTools(); 31 | #endif 32 | this.AddHandler(Events.MyEvent, OnMyEvent); 33 | } 34 | 35 | private void OnMyEvent(object? sender, RoutedEventArgs e) 36 | { 37 | 38 | } 39 | 40 | private void InitializeComponent() 41 | { 42 | AvaloniaXamlLoader.Load(this); 43 | } 44 | 45 | public void OnPressed() 46 | { 47 | 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Demos/NP.Demos.BehaviorPrototypes/NP.Demos.BehaviorPrototypes.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /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.Demos.CustomWindowSample/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.Demos.CustomWindowSample/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.Demos.CustomWindowSample/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Demos/NP.Demos.CustomWindowSample/NP.Demos.CustomWindowSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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.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.Demos.CustomWindowSample/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Demos/NP.Demos.ImplantWinByHandle/App.axaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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.ImplantWinByHandle/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 14 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.Demos.ImplantedWindowTest/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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.Demos.ImplantedWindowTest/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 10 | 13 | 14 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /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.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: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.jpg -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.Demos.LiveTradingDemo/Assets/LinuxIcon.png -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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/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.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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /Demos/NP.Demos.LiveTradingDemo/Domain/Model/CurrencyPair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace NP.Demos.LiveTradingDemo.Domain.Services; 5 | 6 | public class CurrencyPair 7 | { 8 | public CurrencyPair 9 | ( 10 | string code, 11 | decimal startingPrice, 12 | int decimalPlaces, 13 | decimal tickFrequency, 14 | int defaultSpread = 8) 15 | { 16 | Code = code; 17 | InitialPrice = startingPrice; 18 | DecimalPlaces = decimalPlaces; 19 | TickFrequency = tickFrequency; 20 | DefaultSpread = defaultSpread; 21 | PipSize = (decimal)Math.Pow(10, -decimalPlaces); 22 | } 23 | 24 | public string Code { get; } 25 | public decimal InitialPrice { get; } 26 | public int DecimalPlaces { get; } 27 | public decimal TickFrequency { get; } 28 | public int DefaultSpread { get; } 29 | public decimal PipSize { get; } 30 | 31 | #region Equality 32 | 33 | protected bool Equals(CurrencyPair other) 34 | { 35 | return string.Equals(Code, other.Code); 36 | } 37 | 38 | public override bool Equals(object obj) 39 | { 40 | if (ReferenceEquals(null, obj)) return false; 41 | if (ReferenceEquals(this, obj)) return true; 42 | if (obj.GetType() != this.GetType()) return false; 43 | return Equals((CurrencyPair)obj); 44 | } 45 | 46 | public override int GetHashCode() 47 | { 48 | return (Code != null ? Code.GetHashCode() : 0); 49 | } 50 | 51 | #endregion 52 | 53 | public override string ToString() 54 | { 55 | return $"Code: {Code}, DecimalPlaces: {DecimalPlaces}"; 56 | } 57 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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.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/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.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 | } -------------------------------------------------------------------------------- /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.Demos.LiveTradingDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Interactivity; 3 | using Avalonia.Markup.Xaml; 4 | using NP.Ava.Visuals.Controls; 5 | using NP.Demos.LiveTradingDemo.ViewModels; 6 | 7 | namespace NP.Demos.LiveTradingDemo 8 | { 9 | public partial class MainWindow : CustomWindow 10 | { 11 | 12 | #region WindowPosition Styled Avalonia Property 13 | public PixelPoint WindowPosition 14 | { 15 | get { return GetValue(WindowPositionProperty); } 16 | set { SetValue(WindowPositionProperty, value); } 17 | } 18 | 19 | public static readonly StyledProperty WindowPositionProperty = 20 | AvaloniaProperty.Register 21 | ( 22 | nameof(WindowPosition) 23 | ); 24 | #endregion WindowPosition Styled Avalonia Property 25 | 26 | LiveTradesViewModel _viewModel; 27 | 28 | public MainWindow() 29 | { 30 | InitializeComponent(); 31 | #if DEBUG 32 | this.AttachDevTools(); 33 | #endif 34 | _viewModel = new LiveTradesViewModel(); 35 | 36 | this.DataContext = _viewModel; 37 | } 38 | 39 | private void OnMyEvent(object? sender, RoutedEventArgs e) 40 | { 41 | 42 | } 43 | 44 | private void InitializeComponent() 45 | { 46 | AvaloniaXamlLoader.Load(this); 47 | } 48 | 49 | public void OnPressed() 50 | { 51 | 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/NP.ElementImageTest/App.axaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 19 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /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.ElementImageTest/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 13 | 14 | 16 |