-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andreas Sekulski
committed
Mar 1, 2024
1 parent
b7c577a
commit cf5164d
Showing
13 changed files
with
232 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Application xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:Class="AvaloniaApplication.App" | ||
RequestedThemeVariant="Default"> | ||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. --> | ||
|
||
<Application.Styles> | ||
<FluentTheme /> | ||
</Application.Styles> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Avalonia; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using Avalonia.Data.Core; | ||
using Avalonia.Data.Core.Plugins; | ||
using Avalonia.Markup.Xaml; | ||
using AvaloniaApplication.ViewModels; | ||
using AvaloniaApplication.Views; | ||
|
||
namespace AvaloniaApplication | ||
{ | ||
public partial class App : Application | ||
{ | ||
public override void Initialize() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
|
||
public override void OnFrameworkInitializationCompleted() | ||
{ | ||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) | ||
{ | ||
// Line below is needed to remove Avalonia data validation. | ||
// Without this line you will get duplicate validations from both Avalonia and CT | ||
BindingPlugins.DataValidators.RemoveAt(0); | ||
desktop.MainWindow = new MainWindow | ||
{ | ||
DataContext = new MainWindowViewModel(), | ||
}; | ||
} | ||
|
||
base.OnFrameworkInitializationCompleted(); | ||
} | ||
} | ||
} |
Binary file not shown.
26 changes: 26 additions & 0 deletions
26
TestApplications/src/AvaloniaApplication/AvaloniaApplication.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> | ||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Models\" /> | ||
<AvaloniaResource Include="Assets\**" /> | ||
</ItemGroup> | ||
|
||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia" Version="11.0.9" /> | ||
<PackageReference Include="Avalonia.Desktop" Version="11.0.9" /> | ||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.9" /> | ||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.9" /> | ||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> | ||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.9" /> | ||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Avalonia; | ||
using System; | ||
|
||
namespace AvaloniaApplication | ||
{ | ||
internal class Program | ||
{ | ||
// Initialization code. Don't use any Avalonia, third-party APIs or any | ||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized | ||
// yet and stuff might break. | ||
[STAThread] | ||
public static void Main(string[] args) => BuildAvaloniaApp() | ||
.StartWithClassicDesktopLifetime(args); | ||
|
||
// Avalonia configuration, don't remove; also used by visual designer. | ||
public static AppBuilder BuildAvaloniaApp() | ||
=> AppBuilder.Configure<App>() | ||
.UsePlatformDetect() | ||
.WithInterFont() | ||
.LogToTrace(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
TestApplications/src/AvaloniaApplication/Properties/PublishProfiles/FolderProfile.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishDir>bin\Release\net8.0\publish\win-x86\</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<SelfContained>false</SelfContained> | ||
<RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
</PropertyGroup> | ||
</Project> |
7 changes: 7 additions & 0 deletions
7
TestApplications/src/AvaloniaApplication/ViewModels/MainWindowViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace AvaloniaApplication.ViewModels | ||
{ | ||
public partial class MainWindowViewModel : ViewModelBase | ||
{ | ||
public string Greeting => "Welcome to Avalonia!"; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
TestApplications/src/AvaloniaApplication/ViewModels/ViewModelBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
|
||
namespace AvaloniaApplication.ViewModels | ||
{ | ||
public class ViewModelBase : ObservableObject | ||
{ | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
TestApplications/src/AvaloniaApplication/Views/MainWindow.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Window xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:vm="using:AvaloniaApplication.ViewModels" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="AvaloniaApplication.Views.MainWindow" | ||
x:DataType="vm:MainWindowViewModel" | ||
Icon="/Assets/avalonia-logo.ico" | ||
Title="AvaloniaApplication"> | ||
|
||
<Design.DataContext> | ||
<!-- This only sets the DataContext for the previewer in an IDE, | ||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) --> | ||
<vm:MainWindowViewModel/> | ||
</Design.DataContext> | ||
|
||
<TextBlock Text="{Binding Greeting}" | ||
AutomationProperties.AutomationId="Greetings" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"/> | ||
|
||
</Window> |
12 changes: 12 additions & 0 deletions
12
TestApplications/src/AvaloniaApplication/Views/MainWindow.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Avalonia.Controls; | ||
|
||
namespace AvaloniaApplication.Views | ||
{ | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<!-- This manifest is used on Windows only. | ||
Don't remove it as it might cause problems with window transparency and embeded controls. | ||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests --> | ||
<assemblyIdentity version="1.0.0.0" name="AvaloniaApplication.Desktop"/> | ||
|
||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
<application> | ||
<!-- A list of the Windows versions that this application has been tested on | ||
and is designed to work with. Uncomment the appropriate elements | ||
and Windows will automatically select the most compatible environment. --> | ||
|
||
<!-- Windows 10 --> | ||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> | ||
</application> | ||
</compatibility> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters