├── .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: 
10 | 3. Press Add button, navigate to the snippets folder you want to add and press "Select Folder" button: 
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 |
20 |
21 |
26 |
30 |
31 |
35 |
36 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Demos/NP.ElementImageTest/NP.ElementImageTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
--------------------------------------------------------------------------------
/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.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.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.GridSplitterInOverlayWindowDemo/App.axaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.GridSplitterInOverlayWindowDemo/NP.GridSplitterInOverlayWindowDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.LabeledControlDemo/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/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.LabeledControlDemo/NP.LabeledControlDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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.LocalizationPrototype/App.axaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
14 |
16 |
18 |
19 |
21 |
23 |
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/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.LocalizationPrototype/ColorDictionaries/DarkResources.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
9 |
11 |
12 |
14 |
15 |
17 |
18 |
21 |
23 |
25 |
26 |
27 |
30 |
32 |
34 |
36 |
37 |
38 | DarkGray
39 |
40 | Silver
41 |
42 | Gold
43 |
44 |
45 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.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.LocalizationPrototype/Images/English.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.LocalizationPrototype/Images/English.jpg
--------------------------------------------------------------------------------
/Demos/NP.LocalizationPrototype/Images/Hebrew.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.LocalizationPrototype/Images/Hebrew.jpg
--------------------------------------------------------------------------------
/Demos/NP.LocalizationPrototype/Images/Russian.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.LocalizationPrototype/Images/Russian.jpg
--------------------------------------------------------------------------------
/Demos/NP.LocalizationPrototype/Images/USA.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/Demos/NP.LocalizationPrototype/Images/USA.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Demos/NP.LocalizationPrototype/LanguageDictionaries/EnglishResources.axaml:
--------------------------------------------------------------------------------
1 |
4 | Normal
5 | 750
6 | 340
7 | Demo Window
8 | This is a simple text
9 | This is a formatted text. For example, the width of this window is {0}, and its height is {1}
10 | 650
11 | 50
12 |
13 | This control takes width, height, color and flow direction from the dictionary
14 |
15 | Text and color within a Data Template for instance {0}
16 |
17 | Different text and different color within a Data Template for instance {0}
18 | avares://NP.LocalizationPrototype/Images/USA.png
19 | Exit
20 | Show Error
21 | There is not enough memory
22 |
23 |
--------------------------------------------------------------------------------
/Demos/NP.LocalizationPrototype/LanguageDictionaries/HebrewResources.axaml:
--------------------------------------------------------------------------------
1 |
4 | Reverse
5 | 560
6 | 390
7 | חלון דוגמה
8 | זהו טקסט פשוט
9 | זה טקסט ערוך. לדוגמה, רוחב החלון הינו {0} וגובהו {1}
10 | 460
11 | 100
12 |
13 | פקד זה לוקח רוחב, גובה, צבע וכיוון שפה מהמילון
14 |
15 | טקסט וצבע מתוך תבנית-נתונים עבור אובייקט מספר {0}
16 |
17 | טקסט וצבע נוסף מתוך תבנית-נתונים עבור אובייקט מספר {0}
18 | avares://NP.LocalizationPrototype/Images/Hebrew.jpg
19 | צא
20 | הצג שגיאה
21 | אין מספיק זכרון
22 |
23 |
--------------------------------------------------------------------------------
/Demos/NP.LocalizationPrototype/LanguageDictionaries/RussianResources.axaml:
--------------------------------------------------------------------------------
1 |
4 | Normal
5 | 780
6 | 340
7 | Демонстрационное Окно
8 | Это просто текст
9 | Это отформатированный текст. Например, ширина окна {0} и высота {1}
10 | 660
11 | 70
12 |
13 | Этот контроль берет ширину, высоту, цвет и направление из словаря
14 |
15 | Текст и цвет внутри дата темплэйта для экземпляра {0}
16 |
17 | Другой текст и другой цвет внутри дата темплэйта для экземпляра {0}
18 | avares://NP.LocalizationPrototype/Images/Russian.jpg
19 | Закрыть Окно
20 | Показать Ошибку
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.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 |
--------------------------------------------------------------------------------
/Demos/NP.OverlayingControlDemo/App.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/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.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/NP.OverlayingControlDemo/NP.OverlayingControlDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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.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.OverlayingPopupDemo/App.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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.OverlayingPopupDemo/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/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.OverlayingPopupDemo/NP.OverlayingPopupDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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.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 | }
--------------------------------------------------------------------------------
/Demos/NP.OverlayingTransitionsDemo/App.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/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.OverlayingTransitionsDemo/NP.OverlayingTransitionsDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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.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.OverlayingWindowDemo/App.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/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.OverlayingWindowDemo/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
10 |
12 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/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.OverlayingWindowDemo/NP.OverlayingWindowDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.ThemingPrototype/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Demos/NP.ThemingPrototype/Themes/MainColorThemes/AccentColorThemes/DarkBlueAccent.axaml:
--------------------------------------------------------------------------------
1 |
3 | #23597D
4 | #FF119EDA
5 | #3178AD
6 |
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Demos/NP.ThemingPrototype/Themes/MainColorThemes/LightColorsTheme.axaml:
--------------------------------------------------------------------------------
1 |
3 | #FFFFFFFF
4 | #D4D4D4
5 | #979797
6 | #050505
7 | #282828
8 |
9 |
--------------------------------------------------------------------------------
/Demos/NP.ToggleButtonDemo/App.axaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Demos/NP.ToggleButtonDemo/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
19 |
20 |
22 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/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.ToggleButtonDemo/NP.ToggleButtonDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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.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 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | net9.0
4 | enable
5 | 11.2.3.0
6 |
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/FinanceDemos/NP.TradesDemo/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/FinanceDemos/NP.TradesDemo/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/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/Models/BuyOrSell.cs:
--------------------------------------------------------------------------------
1 | namespace NP.TradesDemo.Models;
2 |
3 | public enum BuyOrSell
4 | {
5 | Buy,
6 | Sell
7 | }
8 |
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/FinanceDemos/NP.TradesDemo/Models/NasdaqSymbols.cs:
--------------------------------------------------------------------------------
1 | namespace NP.TradesDemo.Models;
2 |
3 | using System.Linq;
4 | using static NP.TradesDemo.Models.NasdaqSymbol;
5 |
6 | public enum NasdaqSymbol
7 | {
8 | None = 0,
9 | CVSI,
10 | TSLA,
11 | AAPL,
12 | AMZN,
13 | INTC,
14 | GOOG,
15 | IBMW,
16 | MSFT,
17 | ORCL,
18 | NVDA,
19 | META,
20 | MERC
21 | }
22 |
23 | public class CompanyData
24 | {
25 | public NasdaqSymbol Symbol { get; init; }
26 | public string? CompanyName { get; init; }
27 |
28 | public static implicit operator CompanyData((NasdaqSymbol symbol, string companyName) t) =>
29 | new CompanyData { Symbol = t.symbol, CompanyName = t.companyName };
30 | }
31 |
32 | public static class Companies
33 | {
34 | public static CompanyData[] TheCompanies { get; } =
35 | [
36 | (CVSI, "SV Sciences Inc"),
37 | (TSLA, "Tesla Inc"),
38 | (AAPL, "Apple Inc"),
39 | (AMZN, "Amazon.com Inc"),
40 | (INTC, "Intel Inc"),
41 | (GOOG, "Google Inc"),
42 | (IBMW, "IBM Inc"),
43 | (MSFT, "Microsoft Corp"),
44 | (ORCL, "Oracle Corp"),
45 | (NVDA, "NVIDIA Corp"),
46 | (META, "Meta Platforms Inc"),
47 | (MERC, "Mercer International Inc")
48 | ];
49 |
50 | public static CompanyData? GetCompData(this NasdaqSymbol nasdaqSymbol)
51 | {
52 | return TheCompanies.FirstOrDefault(compData => compData.Symbol == nasdaqSymbol);
53 | }
54 |
55 | public static string? GetCompanyName(this NasdaqSymbol symbol)
56 | {
57 | return symbol.GetCompData()?.CompanyName;
58 | }
59 | }
--------------------------------------------------------------------------------
/FinanceDemos/NP.TradesDemo/Models/TradeStatus.cs:
--------------------------------------------------------------------------------
1 | namespace NP.TradesDemo.Models;
2 |
3 | public enum TradeStatus
4 | {
5 | Live,
6 | Closed
7 | }
8 |
--------------------------------------------------------------------------------
/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 | }
--------------------------------------------------------------------------------
/FinanceDemos/NP.TradesDemo/NP.TradesDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 |
5 |
6 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/FinanceDemos/NP.TradesDemo/Themes/DarkCrystalTheme.axaml:
--------------------------------------------------------------------------------
1 |
3 | #FF000000
4 | #FFF3F3F3
5 | #FF222222
6 |
7 |
--------------------------------------------------------------------------------
/FinanceDemos/NP.TradesDemo/Themes/LightCrystalTheme.axaml:
--------------------------------------------------------------------------------
1 |
3 | #FFFFFFFF
4 | #FF0C0C0C
5 | #FFDDDDDD
6 |
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/App.axaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
13 |
14 |
16 |
17 |
19 |
20 |
21 |
22 |
24 |
25 |
27 |
28 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/ColorThemes/DarkResources.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
8 |
10 |
12 |
13 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/ColorThemes/LightResources.axaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
8 |
10 |
12 |
13 |
15 |
16 |
--------------------------------------------------------------------------------
/ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/LanguageDictionaries/EnglishDictionary.axaml:
--------------------------------------------------------------------------------
1 |
4 | Theming Demo
5 | Hello World from Avalonia!!!
6 | Window Title is '{0}'
7 |
8 |
--------------------------------------------------------------------------------
/ThemeDemos/NP.Demos.SimpleThemingAndL10NSample/LanguageDictionaries/HebrewDictionary.axaml:
--------------------------------------------------------------------------------
1 |
4 | הדגמת לוקליזציה
5 | !!!שלום עולמ מאבולוניה
6 | 'כותרת החלון היא '{0}
7 |
8 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/src/Assets/avalonia-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/npolyak/NP.Ava.Visuals/018fd5502f92abad95b3f78fe3bab53516aabe14/src/Assets/avalonia-32.png
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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/Behaviors/GridColumnsBehavior.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using System;
4 |
5 | namespace NP.Ava.Visuals.Behaviors
6 | {
7 | public static class GridColumnsBehavior
8 | {
9 |
10 | #region ColDefsToSet Attached Avalonia Property
11 | public static ColumnDefinitions GetColDefsToSet(Grid obj)
12 | {
13 | return obj.GetValue(ColDefsToSetProperty);
14 | }
15 |
16 | public static void SetColDefsToSet(Grid obj, ColumnDefinitions value)
17 | {
18 | obj.SetValue(ColDefsToSetProperty, value);
19 | }
20 |
21 | public static readonly AttachedProperty ColDefsToSetProperty =
22 | AvaloniaProperty.RegisterAttached
23 | (
24 | "ColDefsToSet"
25 | );
26 |
27 | static GridColumnsBehavior()
28 | {
29 | ColDefsToSetProperty.Changed.Subscribe(OnColDefsChanged);
30 |
31 |
32 | }
33 |
34 | private static void OnColDefsChanged(AvaloniaPropertyChangedEventArgs args)
35 | {
36 | Grid g = (Grid)args.Sender;
37 |
38 | g.ColumnDefinitions.Clear();
39 |
40 | var colDefs = GetColDefsToSet(g);
41 |
42 | if (colDefs == null)
43 | return;
44 |
45 | g.ColumnDefinitions.AddRange(colDefs);
46 | }
47 | #endregion ColDefsToSet Attached Avalonia Property
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/Behaviors/HasVisibleLogicalChildrenBehavior.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.LogicalTree;
4 | using NP.Ava.Visuals.Controls;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 |
9 | namespace NP.Ava.Visuals.Behaviors
10 | {
11 | public class HasVisibleLogicalChildrenBehavior : LogicalChildBehavior
12 | {
13 | private Dictionary _subscriptionDictionary =
14 | new Dictionary();
15 |
16 | protected override void OnChildAdded(ILogical childObj)
17 | {
18 | Control child = (Control)childObj;
19 |
20 | IDisposable subscriptionToken =
21 | child.GetObservable(Visual.IsVisibleProperty).Subscribe(OnIsChildVisibleChanged);
22 |
23 | _subscriptionDictionary[childObj] = subscriptionToken;
24 |
25 | ResetHasVisibleChildren();
26 | }
27 |
28 | private void OnIsChildVisibleChanged(bool isChildVisible)
29 | {
30 | ResetHasVisibleChildren();
31 | }
32 |
33 | private void ResetHasVisibleChildren()
34 | {
35 | bool hasVisibleLogicalChildren = TheControl.GetLogicalChildren().Any(c => (c as Control).IsVisible);
36 |
37 | AttachedProperties.SetHasVisibleLogicalChildren(TheControl, hasVisibleLogicalChildren);
38 | }
39 |
40 | protected override void OnChildRemoved(ILogical childObj)
41 | {
42 | IDisposable subscriptionToken = _subscriptionDictionary[childObj];
43 |
44 | subscriptionToken?.Dispose();
45 |
46 | _subscriptionDictionary.Remove(childObj);
47 |
48 | ResetHasVisibleChildren();
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/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/Behaviors/ImageHelper.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Media;
4 | using Avalonia.Media.Imaging;
5 | using Avalonia.Platform;
6 |
7 | namespace NP.Ava.Visuals
8 | {
9 | public static class ImageHelper
10 | {
11 | public static IImage ControlToImage(this Control control)
12 | {
13 | double width = control.Bounds.Width;
14 | double height = control.Bounds.Height;
15 |
16 | PixelSize pixSize =
17 | new PixelSize((int)width, (int)height);
18 |
19 | var dpi = new Avalonia.Vector(96d, 96d);
20 |
21 | using RenderTargetBitmap renderTargetBitmap =
22 | new RenderTargetBitmap(pixSize, dpi);
23 | var size = new Size(width, height);
24 |
25 | renderTargetBitmap.Render(control);
26 |
27 | WriteableBitmap writeableBitmap = new WriteableBitmap(pixSize, dpi);
28 |
29 | var buff = writeableBitmap.Lock();
30 |
31 | renderTargetBitmap.CopyPixels
32 | (
33 | new PixelRect(new PixelPoint(0, 0), pixSize),
34 | buff.Address,
35 | sizeof(int) * buff.Size.Width * buff.Size.Height,
36 | buff.RowBytes);
37 |
38 | Bitmap b =
39 | new Bitmap
40 | (
41 | renderTargetBitmap.Format.Value,
42 | AlphaFormat.Premul,
43 | buff.Address,
44 | pixSize,
45 | dpi,
46 | buff.RowBytes);
47 |
48 | return b;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Behaviors/KeyboardService.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Input;
2 | using Avalonia;
3 | using NP.Utilities;
4 |
5 | namespace NP.Ava.Visuals.Behaviors
6 | {
7 | public static class KeyboardService
8 | {
9 | private static KeyboardDevice? _instance;
10 | public static KeyboardDevice? Instance
11 | {
12 | get
13 | {
14 | if (_instance == null)
15 | {
16 | _instance = (KeyboardDevice)AvaloniaLocator.Current.GetService();
17 | }
18 |
19 | return _instance;
20 | }
21 | }
22 |
23 | public static bool IsShiftPressed
24 | {
25 | get
26 | {
27 | RawInputModifiers modifiers =
28 | (RawInputModifiers) Instance.GetPropValue("Modifiers", true);
29 |
30 | return (modifiers & RawInputModifiers.Shift) == RawInputModifiers.Shift;
31 | }
32 | }
33 |
34 | public static bool IsControlPressed
35 | {
36 | get
37 | {
38 | RawInputModifiers modifiers =
39 | (RawInputModifiers)Instance.GetPropValue("Modifiers", true);
40 |
41 | return (modifiers & RawInputModifiers.Control) == RawInputModifiers.Control;
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Behaviors/LogicalChildBehavior.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 | using Avalonia.LogicalTree;
3 | using NP.Concepts.Behaviors;
4 | using System;
5 |
6 | namespace NP.Ava.Visuals.Behaviors
7 | {
8 | public abstract class LogicalChildBehavior : IDisposable
9 | {
10 | private IDisposable? _subscription = null;
11 | Control? _control;
12 |
13 | protected internal Control? TheControl
14 | {
15 | get => _control;
16 | set
17 | {
18 | if (ReferenceEquals(_control, value))
19 | return;
20 |
21 | ClearSubscription();
22 |
23 | _control = value;
24 |
25 | if (_control != null)
26 | {
27 | _subscription = _control.GetLogicalChildren().AddBehavior(OnChildAdded, OnChildRemoved);
28 | }
29 | }
30 | }
31 |
32 | private void ClearSubscription()
33 | {
34 | _subscription?.Dispose();
35 | _subscription = null;
36 | }
37 |
38 | public void Dispose()
39 | {
40 | TheControl = null;
41 | }
42 |
43 | protected abstract void OnChildAdded(ILogical child);
44 |
45 | protected abstract void OnChildRemoved(ILogical child);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Behaviors/LogicalChildrenBehavior.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using System;
4 |
5 | namespace NP.Ava.Visuals.Behaviors
6 | {
7 | public static class LogicalChildrenBehavior
8 | {
9 | #region TheLogicalChildBehavior Attached Avalonia Property
10 | public static LogicalChildBehavior GetTheLogicalChildBehavior(AvaloniaObject obj)
11 | {
12 | return obj.GetValue(TheLogicalChildBehaviorProperty);
13 | }
14 |
15 | public static void SetTheLogicalChildBehavior(AvaloniaObject obj, LogicalChildBehavior value)
16 | {
17 | obj.SetValue(TheLogicalChildBehaviorProperty, value);
18 | }
19 |
20 | public static readonly AttachedProperty TheLogicalChildBehaviorProperty =
21 | AvaloniaProperty.RegisterAttached