Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Avalonia.NameGenerator to the main repository #10407

Merged
merged 112 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from 109 commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
85de11d
Initial commit
worldbeater Oct 25, 2020
5f132c9
Add Avalonia Source Generator for x:Name refs
worldbeater Oct 25, 2020
e5f3c79
Ignore Idea stuff
worldbeater Oct 25, 2020
433c279
Allow specifying namespaces manually
worldbeater Oct 26, 2020
2318f71
Support custom controls via AdditionalNamespaces
worldbeater Oct 26, 2020
2c8d46d
feature: Add XamlXRawNameReferenceXamlParser (#4)
worldbeater Oct 26, 2020
08ed528
feature: Use XamlX for Type Resolution (#5)
worldbeater Oct 26, 2020
b45c450
Remove markup extension transformer
worldbeater Oct 26, 2020
e3490c6
housekeeping: Diagnostics and Refactorings (#6)
worldbeater Oct 27, 2020
7fc979f
housekeeping: Add XamlNameReferenceGenerator.Tests (#7)
worldbeater Oct 27, 2020
701daf0
feature: Don't Generate x:Name References for DataTemplates (#10)
worldbeater Oct 31, 2020
53942a5
Update README.md
worldbeater Oct 31, 2020
aa0fbc6
Exclude ControlTemplates (#2)
worldbeater Oct 31, 2020
73cd39b
housekeeping: Add Basic GitHub Actions Configuration (#11)
worldbeater Nov 1, 2020
734f344
fix: Don't Throw when Attached Properties are Unknown (#12)
worldbeater Nov 1, 2020
03b33fb
fix: Remove ConstructableObjectTransformer (#13)
worldbeater Nov 1, 2020
e1a87d6
fix: Use global:: for Type Names (#14)
worldbeater Nov 1, 2020
489a610
housekeeping: Update Generated Code Sample (#15)
worldbeater Nov 1, 2020
ecc9677
housekeeping: Rename to Avalonia.NameGenerator (#16)
worldbeater Nov 2, 2020
063ef71
housekeeping: Temporary use old package name
worldbeater Nov 29, 2020
af3b0be
housekeeping: Add GIF recordings
worldbeater Feb 6, 2021
edf0217
feature: Support x:FieldModifier Directive (#20)
worldbeater Feb 7, 2021
fee0c58
fix: Temporary use old <PackageId /> (#21)
worldbeater Feb 7, 2021
cff386b
feature: Generate x:Name mapping without the GenerateTypedNameReferen…
workgroupengineering Feb 9, 2021
631870b
feature: Document the AvaloniaNameGenerator Property, Don't Crash on …
worldbeater Feb 9, 2021
806fe0f
docs: Document AXN warnings suppression
worldbeater Feb 9, 2021
592fae2
feature: Resolve Class Name from x:Class (#27)
worldbeater Feb 9, 2021
8e8d684
housekeeping: Cleanup README.md
worldbeater Feb 9, 2021
3fdacad
fix: Don't parse XAML twice, bring back the extensions
worldbeater Feb 9, 2021
11b74bb
IClassResolver->IViewResolver
worldbeater Feb 9, 2021
bac5aa8
fix: Use https in .gitmodules
worldbeater Feb 11, 2021
398fc79
feature: Add InitializeComponent Source Generator Behavior (#29)
RomanSoloweow Feb 12, 2021
5bbde81
refactor: Introduce GeneratorOptions (#30)
worldbeater Feb 12, 2021
b5ddad6
feature: Ability to specify default field modifier, closes #31
worldbeater Feb 12, 2021
5917bc3
feature: Add AvaloniaNameGeneratorFilterByPath option (#32)
worldbeater Feb 12, 2021
b00b699
feature: Add AvaloniaNameGeneratorFilterByNamespace
worldbeater Feb 13, 2021
93b6c06
docs: Document the new Generator Options (#33)
worldbeater Feb 13, 2021
c836504
refactor: Consistent naming, AXN0002 as error
worldbeater Feb 17, 2021
6e621e5
feature: Generate this.AttachDevTools() if Avalonia.Diagnostics is ne…
worldbeater Feb 21, 2021
7d74612
docs: Document this.AttachDevTools() generation (#36)
worldbeater Feb 22, 2021
41258fb
housekeeping: Create dependabot.yml
worldbeater Feb 23, 2021
bdc086f
housekeeping: Move dependabot.yml
worldbeater Feb 23, 2021
636bb97
Improve the InitializeComponent Code Generator (#39)
RomanSoloweow Feb 25, 2021
10d67cc
docs: Update generated sample
worldbeater Feb 28, 2021
97e00cb
fix: Fix and Turn On InitializeComponent Behavior by Default (#41)
worldbeater Feb 28, 2021
37a4482
housekeeping: Use old product code
worldbeater Feb 28, 2021
fbcc40f
docs: Document InitializeComponent
worldbeater Feb 28, 2021
9daf718
fix: Actually clear resolved names (#42)
worldbeater Mar 1, 2021
85d13f4
housekeeping: Bump version (#43)
worldbeater Mar 1, 2021
93784b7
build(deps): Bump Microsoft.CodeAnalysis.CSharp in /src (#46)
worldbeater Mar 8, 2021
d20fff1
feature: Add comments to generated InitializeComponent (#49)
ngarside Apr 30, 2021
c8449cd
build(deps): Bump Nerdbank.GitVersioning from 3.3.37 to 3.4.194 in /s…
dependabot[bot] Apr 30, 2021
8e1f7b8
housekeeping: Release 1.2 (#50)
worldbeater Apr 30, 2021
50342ab
build(deps): bump Microsoft.NET.Test.Sdk from 16.8.3 to 16.9.1 in /sr…
dependabot[bot] May 28, 2021
f0e90bb
build(deps): Bump Nerdbank.GitVersioning from 3.4.194 to 3.4.203 in /…
dependabot[bot] May 28, 2021
c1475df
build(deps): Bump Nerdbank.GitVersioning from 3.4.203 to 3.4.205 in /…
dependabot[bot] Jun 4, 2021
86f3664
build(deps): Bump Microsoft.NET.Test.Sdk from 16.9.1 to 16.10.0 in /s…
dependabot[bot] Jun 4, 2021
ed311da
build(deps): Bump Nerdbank.GitVersioning from 3.4.205 to 3.4.216 in /…
dependabot[bot] Jun 14, 2021
94f6eb2
housekeeping: Use .NET 5.0.301 (#58)
worldbeater Jun 15, 2021
4c2b48b
build(deps): Bump Nerdbank.GitVersioning from 3.4.216 to 3.4.220 in /…
dependabot[bot] Jun 29, 2021
3a1a859
Remove incorrect whitespace in generated code (#60)
robloo Jul 20, 2021
8ba5714
housekeeping: Update version.json (#61)
worldbeater Jul 20, 2021
876a434
build(deps): Bump Nerdbank.GitVersioning from 3.4.220 to 3.4.228 in /…
dependabot[bot] Jul 28, 2021
6f7f933
build(deps): Bump Nerdbank.GitVersioning from 3.4.228 to 3.4.231 in /…
dependabot[bot] Aug 4, 2021
42b889f
fix: Resolve #54, Support Older .NET SDKs (#64)
worldbeater Aug 11, 2021
7db1359
build(deps): Bump Microsoft.NET.Test.Sdk from 16.10.0 to 16.11.0 in /…
dependabot[bot] Aug 16, 2021
1a6b429
build(deps): Bump Nerdbank.GitVersioning from 3.4.231 to 3.4.240 in /…
dependabot[bot] Sep 29, 2021
4e64912
build(deps): Bump Microsoft.CodeAnalysis.Analyzers in /src (#70)
dependabot[bot] Oct 23, 2021
a2e7ba4
docs: Don't override InitializeComponent (#71)
worldbeater Oct 23, 2021
aa8f77a
build(deps): Bump Nerdbank.GitVersioning from 3.4.240 to 3.4.244 in /…
dependabot[bot] Oct 26, 2021
e2ae639
build(deps): Bump Microsoft.NET.Test.Sdk from 16.11.0 to 17.0.0 in /s…
dependabot[bot] Oct 27, 2021
c2c394b
build(deps): Bump Nerdbank.GitVersioning from 3.4.244 to 3.4.255 in /…
dependabot[bot] Jan 7, 2022
cb79cd8
refactor: Use file scoped namespaces (#75)
worldbeater Jan 7, 2022
a73388c
chore: Make dependabot update monthly
worldbeater Feb 14, 2022
b16a6ba
build(deps): Bump Microsoft.NET.Test.Sdk from 17.0.0 to 17.1.0 in /sr…
dependabot[bot] Mar 2, 2022
a2fb3c8
build(deps): Bump Microsoft.NET.Test.Sdk from 17.1.0 to 17.2.0 in /sr…
dependabot[bot] Jun 30, 2022
b93d8bf
build(deps): Bump xunit.runner.visualstudio from 2.4.3 to 2.4.5 in /s…
dependabot[bot] Jun 30, 2022
c876e96
build(deps): Bump Nerdbank.GitVersioning from 3.4.255 to 3.5.107 in /…
dependabot[bot] Jun 30, 2022
dc8a993
build(deps): Bump ReactiveUI.Validation from 2.2.1 to 3.0.1 in /src (…
dependabot[bot] Jul 7, 2022
32a3a4b
build(deps): Bump Nerdbank.GitVersioning from 3.5.107 to 3.5.108 in /…
dependabot[bot] Aug 12, 2022
233535c
feature: Recognize Nodes with Generic Parameters (#88)
deryaza Sep 21, 2022
6210c22
build(deps): Bump xunit from 2.4.1 to 2.4.2 in /src (#86)
dependabot[bot] Sep 21, 2022
77c8a19
build(deps): Bump xunit.runner.console from 2.4.1 to 2.4.2 in /src (#87)
dependabot[bot] Sep 21, 2022
c27b3fa
build(deps): Bump Nerdbank.GitVersioning from 3.5.108 to 3.5.113 in /…
dependabot[bot] Sep 21, 2022
42fe90a
build(deps): Bump Microsoft.NET.Test.Sdk from 17.2.0 to 17.3.1 in /sr…
dependabot[bot] Sep 21, 2022
677d1de
build(deps): Bump Microsoft.NET.Test.Sdk from 17.3.1 to 17.3.2 in /sr…
dependabot[bot] Oct 7, 2022
138be17
build(deps): Bump Nerdbank.GitVersioning from 3.5.113 to 3.5.119 in /…
dependabot[bot] Nov 3, 2022
88b52d8
fix: Name Generation for Identical View Class Names (#93)
worldbeater Nov 4, 2022
c0226c2
housekeeping: Update version.json (#94)
worldbeater Nov 4, 2022
fda0a3c
fix: Don't break when one form is invalid (#95)
worldbeater Nov 6, 2022
1d6b309
build(deps): Bump ReactiveUI.Validation from 3.0.1 to 3.0.22 in /src …
dependabot[bot] Dec 3, 2022
da39281
fix: Check for Control Base Type Since IControl Interface is Removed …
notanaverageman Dec 4, 2022
733996f
build(deps): Bump Microsoft.NET.Test.Sdk from 17.3.2 to 17.4.0 in /sr…
dependabot[bot] Dec 4, 2022
fef928b
chore: Release 1.5 (#101)
worldbeater Dec 4, 2022
3d92724
build(deps): Bump Microsoft.NET.Test.Sdk from 17.4.0 to 17.4.1 in /sr…
dependabot[bot] Jan 1, 2023
4ecf3d6
build(deps): Bump Microsoft.CodeAnalysis.Analyzers in /src (#104)
dependabot[bot] Feb 1, 2023
59056ab
feature: Support Inlines, sync XamlX, use Avalonia 11 (#106)
worldbeater Feb 19, 2023
6c3f976
Rename projects
maxkatz6 Feb 20, 2023
69d338e
Move projects
maxkatz6 Feb 20, 2023
6684e1e
Remove everything that won't go into main repo
maxkatz6 Feb 20, 2023
882ed8e
Merge branch 'prepare' into move-name-generator
maxkatz6 Feb 20, 2023
30d1dc7
Setup generators project in the repository, use in the control catalog
maxkatz6 Feb 20, 2023
c35259d
Run generators tests on CI
maxkatz6 Feb 20, 2023
4c2939e
Merge branch 'master' into move-name-generator
maxkatz6 Feb 22, 2023
60b3467
Merge branch 'master' into move-name-generator
maxkatz6 Feb 28, 2023
7d81279
Return generators sandbox
maxkatz6 Feb 28, 2023
adbbe46
Reorganize generators code
maxkatz6 Feb 28, 2023
d8a69c6
Include Avalonia.Generators in the main package
maxkatz6 Feb 28, 2023
f4c8210
Add AvaloniaNameGeneratorIsEnabled parameter
maxkatz6 Feb 28, 2023
f7ddb0b
Update Avalonia.csproj
maxkatz6 Feb 28, 2023
fa6fb50
Merge branch 'master' into move-name-generator
maxkatz6 Mar 4, 2023
a565566
Merge branch 'master' into move-name-generator
danwalmsley Mar 4, 2023
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
4 changes: 2 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@
"GenerateCppHeaders",
"Package",
"RunCoreLibsTests",
"RunDesignerTests",
"RunHtmlPreviewerTests",
"RunLeakTests",
"RunRenderTests",
"RunTests",
"RunToolsTests",
"ZipFiles"
]
}
Expand Down Expand Up @@ -123,11 +123,11 @@
"GenerateCppHeaders",
"Package",
"RunCoreLibsTests",
"RunDesignerTests",
"RunHtmlPreviewerTests",
"RunLeakTests",
"RunRenderTests",
"RunTests",
"RunToolsTests",
"ZipFiles"
]
}
Expand Down
21 changes: 21 additions & 0 deletions Avalonia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Controls.ItemsRepe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Controls.ItemsRepeater.UnitTests", "tests\Avalonia.Controls.ItemsRepeater.UnitTests\Avalonia.Controls.ItemsRepeater.UnitTests.csproj", "{F4E36AA8-814E-4704-BC07-291F70F45193}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Generators", "src\tools\Avalonia.Generators\Avalonia.Generators.csproj", "{DDA28789-C21A-4654-86CE-D01E81F095C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Generators.Tests", "tests\Avalonia.Generators.Tests\Avalonia.Generators.Tests.csproj", "{2D7C812B-7E73-4252-8EFD-BC8A4D5CCB9F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Fonts.Inter", "src\Avalonia.Fonts.Inter\Avalonia.Fonts.Inter.csproj", "{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generators.Sandbox", "samples\Generators.Sandbox\Generators.Sandbox.csproj", "{A82AD1BC-EBE6-4FC3-A13B-D52A50297533}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -573,10 +579,22 @@ Global
{F4E36AA8-814E-4704-BC07-291F70F45193}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4E36AA8-814E-4704-BC07-291F70F45193}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4E36AA8-814E-4704-BC07-291F70F45193}.Release|Any CPU.Build.0 = Release|Any CPU
{DDA28789-C21A-4654-86CE-D01E81F095C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DDA28789-C21A-4654-86CE-D01E81F095C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DDA28789-C21A-4654-86CE-D01E81F095C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDA28789-C21A-4654-86CE-D01E81F095C5}.Release|Any CPU.Build.0 = Release|Any CPU
{2D7C812B-7E73-4252-8EFD-BC8A4D5CCB9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D7C812B-7E73-4252-8EFD-BC8A4D5CCB9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D7C812B-7E73-4252-8EFD-BC8A4D5CCB9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D7C812B-7E73-4252-8EFD-BC8A4D5CCB9F}.Release|Any CPU.Build.0 = Release|Any CPU
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13F1135D-BA1A-435C-9C5B-A368D1D63DE4}.Release|Any CPU.Build.0 = Release|Any CPU
{A82AD1BC-EBE6-4FC3-A13B-D52A50297533}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A82AD1BC-EBE6-4FC3-A13B-D52A50297533}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A82AD1BC-EBE6-4FC3-A13B-D52A50297533}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A82AD1BC-EBE6-4FC3-A13B-D52A50297533}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -643,7 +661,10 @@ Global
{75C47156-C5D8-44BC-A5A7-E8657C2248D6} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{C810060E-3809-4B74-A125-F11533AF9C1B} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{C692FE73-43DB-49CE-87FC-F03ED61F25C9} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637}
{DDA28789-C21A-4654-86CE-D01E81F095C5} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637}
{2D7C812B-7E73-4252-8EFD-BC8A4D5CCB9F} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
{F4E36AA8-814E-4704-BC07-291F70F45193} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
{A82AD1BC-EBE6-4FC3-A13B-D52A50297533} = {9B9E3891-2366-4253-A952-D08BCEB71098}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A}
Expand Down
17 changes: 16 additions & 1 deletion build/SourceGenerators.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyGroup>
<IncludeDevGenerators Condition="'$(IncludeDevGenerators)' == ''">true</IncludeDevGenerators>
<IncludeAvaloniaGenerators Condition="'$(IncludeAvaloniaGenerators)' == ''">false</IncludeAvaloniaGenerators>
</PropertyGroup>

<ItemGroup Condition="'$(IncludeDevGenerators)' == 'true'">
<ProjectReference
Include="$(MSBuildThisFileDirectory)/../src/tools/DevGenerators/DevGenerators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"
PrivateAssets="all" />
<Compile Include="$(MSBuildThisFileDirectory)/../src/Shared/SourceGeneratorAttributes.cs" />
</ItemGroup>

<ItemGroup Condition="'$(IncludeAvaloniaGenerators)' == 'true'">
<ProjectReference
Include="../../src/tools/Avalonia.Generators/Avalonia.Generators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"
PrivateAssets="all" />
</ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)/../src/tools/Avalonia.Generators/Avalonia.Generators.props"
Condition="'$(IncludeDevGenerators)' == 'true'" />
</Project>
12 changes: 7 additions & 5 deletions nukebuild/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,18 @@ void RunCoreTest(string projectName)
.Executes(() =>
{
RunCoreTest("Avalonia.Skia.RenderTests");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (Parameters.IsRunningOnWindows)
RunCoreTest("Avalonia.Direct2D1.RenderTests");
});

Target RunDesignerTests => _ => _
.OnlyWhenStatic(() => !Parameters.SkipTests && Parameters.IsRunningOnWindows)
Target RunToolsTests => _ => _
.OnlyWhenStatic(() => !Parameters.SkipTests)
.DependsOn(Compile)
.Executes(() =>
{
RunCoreTest("Avalonia.DesignerSupport.Tests");
RunCoreTest("Avalonia.Generators.Tests");
if (Parameters.IsRunningOnWindows)
RunCoreTest("Avalonia.DesignerSupport.Tests");
});

Target RunLeakTests => _ => _
Expand Down Expand Up @@ -276,7 +278,7 @@ void DoMemoryTest()
Target RunTests => _ => _
.DependsOn(RunCoreLibsTests)
.DependsOn(RunRenderTests)
.DependsOn(RunDesignerTests)
.DependsOn(RunToolsTests)
.DependsOn(RunHtmlPreviewerTests)
.DependsOn(RunLeakTests);

Expand Down
5 changes: 5 additions & 0 deletions nukebuild/numerge.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"Id": "Avalonia.Build.Tasks",
"IgnoreMissingFrameworkBinaries": true,
"DoNotMergeDependencies": true
},
{
"Id": "Avalonia.Generators",
"IgnoreMissingFrameworkBinaries": true,
"DoNotMergeDependencies": true
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion packages/Avalonia/Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

<ItemGroup>
<ProjectReference Include="../../src/Avalonia.Remote.Protocol/Avalonia.Remote.Protocol.csproj" />
<ProjectReference Include="../../src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj" >
<ProjectReference Include="../../src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj">
<PrivateAssets>all</PrivateAssets>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
</ProjectReference>
<ProjectReference Include="..\..\src\tools\Avalonia.Generators\Avalonia.Generators.csproj"
maxkatz6 marked this conversation as resolved.
Show resolved Hide resolved
OutputItemType="Analyzer" />
</ItemGroup>

<PropertyGroup>
Expand Down
14 changes: 3 additions & 11 deletions samples/ControlCatalog/ControlCatalog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<Nullable>enable</Nullable>
<IncludeAvaloniaGenerators>true</IncludeAvaloniaGenerators>
</PropertyGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs">
Expand Down Expand Up @@ -35,14 +36,5 @@
</ItemGroup>

<Import Project="..\..\build\BuildTargets.targets" />

<ItemGroup>
<None Remove="Pages\CustomDrawing.xaml" />
</ItemGroup>

<ItemGroup>
<AvaloniaResource Update="Pages\CustomDrawing.xaml">
<Generator></Generator>
</AvaloniaResource>
</ItemGroup>
<Import Project="..\..\build\SourceGenerators.props" />
</Project>
8 changes: 1 addition & 7 deletions samples/ControlCatalog/Pages/FlyoutsPage.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Markup.Xaml;
using Avalonia.Interactivity;

namespace ControlCatalog.Pages
{
public class FlyoutsPage : UserControl
public partial class FlyoutsPage : UserControl
{
public FlyoutsPage()
{
Expand All @@ -28,11 +27,6 @@ private void Afp_DoubleTapped(object? sender, RoutedEventArgs e)
}
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

private void SetXamlTexts()
{
var bfxt = this.Get<TextBlock>("ButtonFlyoutXamlText");
Expand Down
11 changes: 2 additions & 9 deletions samples/ControlCatalog/Pages/LabelsPage.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Controls;
using ControlCatalog.Models;

namespace ControlCatalog.Pages
{
public class LabelsPage : UserControl
public partial class LabelsPage : UserControl
{
private Person? _person;

Expand All @@ -25,11 +23,6 @@ private void CreateDefaultPerson()
};
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}

public void DoSave()
{

Expand Down
14 changes: 3 additions & 11 deletions samples/ControlCatalog/Pages/RefreshContainerPage.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Controls;
using ControlCatalog.ViewModels;

namespace ControlCatalog.Pages
{
public class RefreshContainerPage : UserControl
public partial class RefreshContainerPage : UserControl
{
private RefreshContainerViewModel _viewModel;

public RefreshContainerPage()
{
this.InitializeComponent();
InitializeComponent();

_viewModel = new RefreshContainerViewModel();

Expand All @@ -27,10 +24,5 @@ private async void RefreshContainerPage_RefreshRequested(object? sender, Refresh

deferral.Complete();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
13 changes: 3 additions & 10 deletions samples/ControlCatalog/Pages/RelativePanelPage.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Controls;

namespace ControlCatalog.Pages
{
public class RelativePanelPage : UserControl
public partial class RelativePanelPage : UserControl
{
public RelativePanelPage()
{
this.InitializeComponent();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
InitializeComponent();
}
}
}
20 changes: 8 additions & 12 deletions samples/ControlCatalog/Pages/ThemePage.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Styling;

namespace ControlCatalog.Pages
{
public class ThemePage : UserControl
public partial class ThemePage : UserControl
{
public static ThemeVariant Pink { get; } = new("Pink", ThemeVariant.Light);

public ThemePage()
{
AvaloniaXamlLoader.Load(this);
InitializeComponent();

var selector = this.FindControl<ComboBox>("Selector")!;
var themeVariantScope = this.FindControl<ThemeVariantScope>("ThemeVariantScope")!;

selector.Items = new[]
Selector.Items = new[]
{
ThemeVariant.Default,
ThemeVariant.Dark,
ThemeVariant.Light,
Pink
};
selector.SelectedIndex = 0;
Selector.SelectedIndex = 0;

selector.SelectionChanged += (_, _) =>
Selector.SelectionChanged += (_, _) =>
{
if (selector.SelectedItem is ThemeVariant theme)
if (Selector.SelectedItem is ThemeVariant theme)
{
themeVariantScope.RequestedThemeVariant = theme;
ThemeVariantScope.RequestedThemeVariant = theme;
}
};
}
Expand Down
7 changes: 7 additions & 0 deletions samples/Generators.Sandbox/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Generators.Sandbox.App">
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
20 changes: 20 additions & 0 deletions samples/Generators.Sandbox/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Avalonia;
using Avalonia.Markup.Xaml;
using Generators.Sandbox.ViewModels;

namespace Generators.Sandbox;

public class App : Application
{
public override void Initialize() => AvaloniaXamlLoader.Load(this);

public override void OnFrameworkInitializationCompleted()
{
var view = new Views.SignUpView
{
ViewModel = new SignUpViewModel()
};
view.Show();
base.OnFrameworkInitializationCompleted();
}
}
10 changes: 10 additions & 0 deletions samples/Generators.Sandbox/Controls/CustomTextBox.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;
using Avalonia.Controls;
using Avalonia.Styling;

namespace Generators.Sandbox.Controls;

public class CustomTextBox : TextBox, IStyleable
{
Type IStyleable.StyleKey => typeof(TextBox);
}
Loading