Files
Avalonia/PortfolioManager/Readme.txt
2025-06-18 20:03:31 -04:00

203 lines
7.8 KiB
Plaintext

dotnet new avalonia.window -na EditPositionDialog -n PortfolioManager.Dialog
dotnet new avalonia.usercontrol -na [namespace] -n [name]
From Views Folder....
dotnet new avalonia.usercontrol -na MomentumView -n PortfolioManager.Views
dotnet new avalonia.usercontrol -na GainLossView -n PortfolioManager.Views
editor.inlineSuggest.enabled
dotnet new avalonia.window -na EditPositionDialog -n PortfolioManager.Dialogs
dotnet new avalonia.window -na EditPositionDialogNoStop -n PortfolioManager.Dialogs
1) Install dotnet 8.0 sdk (C:\download\dotnetcore\dotnet-sdk-8.0.409-win-x64.exe)
https://dotnet.microsoft.com/en-us/download/dotnet/8.0
2) Install Avalonia for VSCode extension
3) dotnet new install Avalonia.Templates
4) dotnet new avalonia.mvvm -o MyApp
5) in order to target Linux you need to publish to that target (i.e.) dotnet publish -r linux-arm64
Skip
6) dotnet add package HyperText.Avalonia
Skip
7) dotnet add package Avalonia.Labs.CommandManager --version 11.2.0
8) dotnet add package Avalonia.Controls.DataGrid
skip
9) dotnet add package Avalonia.Skia.Linux.Natives --version <version_number>
For Avalonia applications targeting .NET 8 on Linux, you'll need Avalonia.Skia.Linux.Natives version 11.3.0. This version is designed to work with the latest Avalonia framework, which is 11.3.0. The other components, like SkiaSharp and its native assets, should also be at version 2.88.9 or higher for optimal compatibility, as per the documentation.
Skip
10) dotnet add package SkiaSharp.NativeAssets.Linux.NoDependencies
11) Add this to the project file in order to get the correct version of libSkiaSharp.so
<!-- Have to copy this shared library manually because publish was deploying an incorrect version of it
that was not running on the pi -->
<ItemGroup>
<None Update="libSkiaSharp.so">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
Skip
12) SkiaSharp.Views
13) add package Avalonia.Attached
14) vscode preferences -> settings -> terminal.integrated.copyOnSelection -> check the box
15) Avalonia Cartesian Chart
https://eremexcontrols.net/articles/controls/charts/get-started-with-charts-mvvm.html
https://eremexcontrols.net/articles/get-started/create-new-avalonia-project-using-avalonia-templates.html
https://www.eremexcontrols.net/articles/controls/charts/cartesian-series-views/line-series-vew.html
https://eremexcontrols.net/articles/controls/charts/get-started-with-charts.html
https://eremexcontrols.net/articles/controls/charts/cartesian-series-views/line-series-vew.html
dotnet add package Eremex.Avalonia.Controls
dotnet add package Eremex.Avalonia.Themes.DeltaDesign
In App.axaml Replace
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="PortfolioManager.App"
xmlns:local="using:PortfolioManager"
RequestedThemeVariant="Default"
>
with
<Application
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="PortfolioManager.App"
xmlns:local="using:PortfolioManager"
xmlns:theme="clr-namespace:Eremex.AvaloniaUI.Themes.DeltaDesign;assembly=Eremex.Avalonia.Themes.DeltaDesign"
RequestedThemeVariant="Light">
16) dotnet add package LoadingIndicators.Avalonia --version 11.0.11.1
https://www.nuget.org/packages/LoadingIndicators.Avalonia
17) Creating Dialogs in Avalonia
https://www.google.com/search?client=firefox-b-1-d&q=how+to+create+a+simple+dialog+in+avalonia
18) dotnet add package Avalonia.ReactiveUI
Also Replace
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
</Application.Styles>
with
<Application.Styles>
<theme:DeltaDesignTheme/>
<!-- .... -->
</Application.Styles>
dotnet new avalonia.usercontrol -na [namespace] -n [name]
dotnet new avalonia.window -na [namespace] -n [name]
dotnet new avalonia.window -na EditPositionDialog -n PortfolioManager.Dialog
https://github.com/AvaloniaUI/avalonia-dotnet-templates
RelayCommands
https://stackoverflow.com/questions/77978828/fire-relaycommand-from-datagrid-with-avaloniaui-and-community-toolkit-mvvm
To install SkiaSharp native assets for ARM64, you'll need to ensure your project is set up to target the correct runtime identifier (RID) and then add the necessary NuGet packages. Specifically, you'll want to use the linux-arm64 RID and install the SkiaSharp native assets packages for Linux and specifically those without dependencies.
Here's a step-by-step guide:
Set the target framework and RID:
In your project file (e.g., MyProject.csproj), add or modify the <TargetFramework> and <RuntimeIdentifier> elements:
Code
<TargetFramework>net7.0</TargetFramework> <!-- Or your target framework -->
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
1. Install the SkiaSharp native assets packages:
Use the NuGet Package Manager to install the following packages:
SkiaSharp.NativeAssets.Linux (or SkiaSharp.NativeAssets.Linux.NoDependencies if you prefer to not depend on external font config packages).
If you're using a custom runtime, you might also need SkiaSharp.NativeAssets.Linux.NoDependencies or SkiaSharp.NativeAssets.Linux.
2. Build and test:
Build your project and ensure that it compiles and runs correctly on your ARM64 target.
You may need to adjust your Dockerfile or other deployment configuration to include the necessary Linux packages if using SkiaSharp.NativeAssets.Linux.
Important considerations:
Dependencies:
If you choose SkiaSharp.NativeAssets.Linux, ensure your container or deployment environment has the necessary libraries (e.g., libfontconfig1, libGLX, etc.).
Linux Distributions:
If you're targeting a specific Linux distribution, you might need to adjust the RID accordingly (e.g., linux-musl-arm64 for Alpine Linux).
Containers:
If you're running your application in a container, you'll need to include the SkiaSharp native assets within the container image.
VS Code:
If you're using VS Code and are deploying a container, make sure the workspace is in the container and that you can see the full file system structure of the container.
By following these steps, you can successfully install and use SkiaSharp's native assets on your ARM64 target
// https://stackoverflow.com/questions/7929646/how-to-programmatically-select-a-tabitem-in-wpf-tabcontrol
<DataGrid>
<Interaction.Behaviors>
<EventTriggerBehavior EventName="SelectionChanged">
<InvokeCommandAction Command="{Binding SelectionChangedCommand}"></InvokeCommandAction>
</EventTriggerBehavior>
</Interaction.Behaviors>
...
</DataGrid>
<DataGrid.Styles>
<Style Selector="DataGridRow:selected">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="White" />
<Setter Property="Opacity" Value=".50" />
</Style>
</DataGrid.Styles>
Install the ScottPlot.Avalonia NuGet package: This package provides the necessary components to integrate ScottPlot plots into your Avalonia application.
Import the ScottPlot.Avalonia namespace: Add this namespace to your window element in your Avalonia application.
Add an AvaPlot control: Add an AvaPlot element to your layout in your Avalonia application, giving it a unique name.
Plot your data: Use the AvaPlot control to display your data and create various plot types, such as line plots, scatter plots, bar charts, and more.
https://scottplot.net/quickstart/avalonia/
1) dotnet add package ScottPlot.Avalonia