Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
443 changes: 443 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

59 changes: 3 additions & 56 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -297,45 +297,10 @@ FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
**/.paket/paket.exe
paket-files/

# FAKE - F# Make
**/.fake/

# CodeRush personal settings
**/.cr/personal

Expand All @@ -347,18 +312,6 @@ paket-files/
#tools/**
#!tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

Expand All @@ -369,15 +322,6 @@ ASALocalRun/
*.binlog
MSBuild_Logs/

# AWS SAM Build and Temporary Artifacts folder
.aws-sam

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
**/.mfractor/

# Local History for Visual Studio
**/.localhistory/

Expand Down Expand Up @@ -416,3 +360,6 @@ FodyWeavers.xsd
*.msix
*.msm
*.msp

# 3rd-Party tools folder
[Tt]ools/
8 changes: 8 additions & 0 deletions 01-BootstrapperShell/App.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="BootstrapperShellSample.App"
RequestedThemeVariant="Light">
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
51 changes: 51 additions & 0 deletions 01-BootstrapperShell/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Prism.DryIoc;
using BootstrapperShellSample.Views;

namespace BootstrapperShellSample;

internal class App : PrismApplication
{
public static AppBuilder BuildAvaloniaApp()
{
var builder = AppBuilder
.Configure<App>()
.UsePlatformDetect();
#if DEBUG
builder.LogToTrace();
#endif
return builder;
}

public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
base.Initialize();
}

protected override AvaloniaObject CreateShell()
{
return Container.Resolve<MainWindow>();
}

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
}

// Application entry point. Avalonia is completely initialized.
private static void AppMain(Application app, string[] args)
{
// A cancellation token source that will be used to stop the main loop
var cts = new CancellationTokenSource();

// Start the main loop
app.Run(cts.Token);
}

private static void Main(string[] args)
{
BuildAvaloniaApp().Start(AppMain, args);
}
}
16 changes: 16 additions & 0 deletions 01-BootstrapperShell/BootstrapperShell.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
<Authors>Damian Suess</Authors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Prism.Avalonia" />
<PackageReference Include="Prism.DryIoc.Avalonia" />
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions 01-BootstrapperShell/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="BootstrapperShellSample.Views.MainWindow"
Title="Shell"
Width="525"
Height="350">
<Grid>
<TextBlock Text="Hello, from Prism.Avalonia!"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="17"
FontWeight="Heavy" />
</Grid>
</Window>
19 changes: 19 additions & 0 deletions 01-BootstrapperShell/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Avalonia;
using Avalonia.Controls;

namespace BootstrapperShellSample.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
}
}
}
48 changes: 48 additions & 0 deletions CodeMaid.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="SteveCadwallader.CodeMaid.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<userSettings>
<SteveCadwallader.CodeMaid.Properties.Settings>
<setting name="Formatting_CommentXmlValueIndent" serializeAs="String">
<value>2</value>
</setting>
<setting name="Cleaning_RemoveEndOfFileTrailingNewLine" serializeAs="String">
<value>False</value>
</setting>
<setting name="Cleaning_PerformPartialCleanupOnExternal" serializeAs="String">
<value>1</value>
</setting>
<setting name="Reorganizing_RunAtStartOfCleanup" serializeAs="String">
<value>True</value>
</setting>
<setting name="Reorganizing_AlphabetizeMembersOfTheSameGroup" serializeAs="String">
<value>True</value>
</setting>
<setting name="Reorganizing_ExplicitMembersAtEnd" serializeAs="String">
<value>True</value>
</setting>
<setting name="Cleaning_AutoCleanupOnFileSave" serializeAs="String">
<value>False</value>
</setting>
<setting name="Collapsing_CollapseSolutionWhenOpened" serializeAs="String">
<value>False</value>
</setting>
<setting name="Collapsing_KeepSoloProjectExpanded" serializeAs="String">
<value>False</value>
</setting>
<setting name="Feature_CollapseAllSolutionExplorer" serializeAs="String">
<value>False</value>
</setting>
<setting name="Reorganizing_PerformWhenPreprocessorConditionals" serializeAs="String">
<value>1</value>
</setting>
<setting name="ThirdParty_UseXAMLStylerCleanup" serializeAs="String">
<value>True</value>
</setting>
</SteveCadwallader.CodeMaid.Properties.Settings>
</userSettings>
</configuration>
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<PrismTargetFramework>net8.0-windows</PrismTargetFramework>
</PropertyGroup>
</Project>
19 changes: 19 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.3.5</AvaloniaVersion>
<PrismVersion>9.0.537</PrismVersion>
<PrismAvaloniaVersion>9.0.537.11130</PrismAvaloniaVersion>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Themes.Simple" Version="$(AvaloniaVersion)" />

<PackageVersion Include="Prism.Core" Version="$(PrismVersion)" />
<PackageVersion Include="Prism.Avalonia" Version="$(PrismAvaloniaVersion)" />
<PackageVersion Include="Prism.DryIoc.Avalonia" Version="$(PrismAvaloniaVersion)" />
</ItemGroup>
</Project>
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2025 PrismLibrary

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions Prism.Avalonia-Samples.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapperShell", "01-BootstrapperShell\BootstrapperShell.csproj", "{3068311C-48C1-4C1E-BD26-206B83CF8BDD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
CodeMaid.config = CodeMaid.config
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
LICENSE = LICENSE
README.md = README.md
Settings.XamlStyler = Settings.XamlStyler
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3068311C-48C1-4C1E-BD26-206B83CF8BDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3068311C-48C1-4C1E-BD26-206B83CF8BDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3068311C-48C1-4C1E-BD26-206B83CF8BDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3068311C-48C1-4C1E-BD26-206B83CF8BDD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BE891119-B614-4966-9A9E-F925FB29A533}
EndGlobalSection
EndGlobal
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
# Prism-Samples-Avalonia
# Prism.Avalonia.Samples

Samples that demonstrate how to use various Prism features with Avalonia. If you are just getting started with Prism, it is recommended that you start from the first sample, and work your way down the list sequentially (in order). Each sample builds on the previous sample's concept.

Examples are based on Prism's [WPF Examples](https://github.com/PrismLibrary/Prism-Samples-Wpf) to demonstrate similarities with Prism.Avalonia. Future sample will include using Android, iOS, and WASM.

| # | Topic | Description|
|-|-|-|
| 02 | [Regions][2]| Region |

[1]: 01-BootstrapperShell/
[2]: 02-Regions/
[3]: 03-CustomRegions/
[4]: 04-ViewDiscovery/
[5]: 05-ViewInjection/
[6]: 06-ViewActivationDeactivation/
[7]: 07-Modules-AppConfig/
[8]: 07-Modules-Code/
[9]: 07-Modules-Directory/
[10]: 07-Modules-LoadManual/
[11]: 08-ViewModelLocator/
[12]: 09-ChangeConvention/
[13]: 10-CustomRegistrations/
[14]: 11-UsingDelegateCommands/
[15]: 12-UsingCompositeCommands/
[16]: 13-IActiveAwareCommands/
[17]: 14-UsingEventAggregator/
[18]: 15-FilteringEvents/
[19]: 16-RegionContext/
[20]: 17-BasicRegionNavigation/
[21]: 18-NavigationCallback/
[22]: 19-NavigationParticipation/
[23]: 20-NavigateToExistingViews/
[24]: 21-PassingParameters/
[25]: 22-ConfirmCancelNavigation/
[26]: 23-RegionMemberLifetime/
[27]: 24-NavigationJournal/
[29]: 26-UsingDialogService/
[30]: 27-StylingDialog/
[31]: 28-UsingCustomWindow/
[32]: 29-InvokeCommandAction/
Loading