Skip to content

Commit 2b547d9

Browse files
authored
Merge pull request #109 from timunie/feature/SnowFlakesControl
Adding a Snowflakes-Control
2 parents dc62fbb + d5aa3bd commit 2b547d9

24 files changed

+1557
-41
lines changed

README.adoc

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,44 @@ toc::[]
1616

1717
If you have feedback, questions or suggestions feel free to contact us via:
1818

19-
image:https://raw.githubusercontent.com/Patrolavia/telegram-badge/master/chat.svg[link=https://t.me/Avalonia]
20-
image:https://badges.gitter.im/Join%20Chat.svg[link=https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge&utm_content=badge&utm_medium=badge&utm_source=badge]
19+
image:https://raw.githubusercontent.com/Patrolavia/telegram-badge/master/chat.svg[link=https://t.me/Avalonia]
20+
image:https://badges.gitter.im/Join%20Chat.svg[link=https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge&utm_content=badge&utm_medium=badge&utm_source=badge]
2121
image:https://img.shields.io/badge/discord-join%20chat-46BC99[link=https://aka.ms/dotnet-discord]
2222

2323
Or file a new bug-report or feature request in the https://github.com/AvaloniaUI/Avalonia.Samples/issues[`Issues`]-section.
2424

2525

26+
[#_organization_of_the_samples]
2627
== 📂 Organization of the Samples
2728
28-
Every sample can be found in its own sub-folder and can run without any reference to another sample. Nevertheless we have a `*.sln`-File which has all projects in one solution, if you are looking for a complete collection of samples.
29+
Every sample can be found in its own sub-folder and can run without any reference to another sample.Nevertheless we have a `*.sln`-File which has all projects in one solution, if you are looking for a complete collection of samples.
2930
30-
You can find the list of samples <<samples,below>>. The samples are structured in different categories and difficulties. For better search results, each sample is also tagged with some **buzz-words**.
31+
You can find the list of samples <<samples,below>>.The samples are structured in different categories and difficulties.For better search results, each sample is also tagged with some **buzz-words**.
3132
32-
In every sample folder you will find a `README`-File, which describes the sample in detail and, if applicable, has links to further information and documentation.
33+
In every sample folder you will find a `README`-File, which describes the sample in detail and, if applicable, has links to further information and documentation.
3334
35+
36+
[#_difficulties]
3437
=== 🐣 Difficulties
3538
36-
Each sample is tagged with it's difficulty. The degree of difficulty describes how much base-knowledge a user should have.
39+
Each sample is tagged with it's difficulty.The degree of difficulty describes how much base-knowledge a user should have.
3740
3841
3942
[cols="1,1,2"]
4043
|===
41-
| 🔘 | Difficulty | Degree of knowledge
44+
| 🔘 | Difficulty | Degree of knowledge
4245
4346
| 🐣 | Beginner
44-
| A Beginner must not have any knowledge of Avalonia. Nevertheless some basic knowledge of `C#`, `X(A)ML` and your IDE is mandatory
47+
| A Beginner must not have any knowledge of Avalonia. Nevertheless some basic knowledge of `C#`, `X(A)ML` and your IDE is mandatory
4548
46-
| 🐥 | Easy
47-
| Some very basic knowledge of Avalonia is needed
49+
| 🐥 | Easy
50+
| Some very basic knowledge of Avalonia is needed
4851
49-
| 🐔 | Normal
50-
| The user is somewhat experienced with Avalonia
52+
| 🐔 | Normal
53+
| The user is somewhat experienced with Avalonia
5154
52-
| 🐉 | Hard
53-
| These samples are focusing on non-standard tasks, which most users will not need to know.
55+
| 🐉 | Hard
56+
| These samples are focusing on non-standard tasks, which most users will not need to know.
5457
5558
|===
5659
@@ -67,11 +70,12 @@ Each sample is tagged with it's difficulty. The degree of difficulty describes h
6770
////
6871
6972
73+
[#_mvvm_samples]
7074
=== 💡 MVVM-Samples
7175
7276
[cols="25h,25,50"]
7377
|===
74-
| Sample | Difficulty | Buzz-Words
78+
| Sample | Difficulty | Buzz-Words
7579
7680
| link:src/Avalonia.Samples/MVVM/BasicMvvmSample[Basic MVVM Sample]
7781
| 🐣 Beginner
@@ -91,11 +95,14 @@ Each sample is tagged with it's difficulty. The degree of difficulty describes h
9195
9296
|===
9397
98+
99+
100+
[#_drawing_samples]
94101
=== ✒️ Drawing-Samples
95102
96103
[cols="25h,25,50"]
97104
|===
98-
| Sample | Difficulty | Buzz-Words
105+
| Sample | Difficulty | Buzz-Words
99106
100107
| link:src/Avalonia.Samples/Drawing/BattleCity[BattleCity Game Sample]
101108
| 🐔 Normal
@@ -107,11 +114,12 @@ Each sample is tagged with it's difficulty. The degree of difficulty describes h
107114
108115
|===
109116
117+
[#_datatemplate_samples]
110118
=== 🎞️ DataTemplate-Samples
111119
112120
[cols="25h,25,50"]
113121
|===
114-
| Sample | Difficulty | Buzz-Words
122+
| Sample | Difficulty | Buzz-Words
115123
116124
| link:src/Avalonia.Samples/DataTemplates/BasicDataTemplateSample[Basic DataTemplate Sample]
117125
| 🐔 Normal
@@ -128,111 +136,123 @@ Each sample is tagged with it's difficulty. The degree of difficulty describes h
128136
|===
129137
130138
139+
[#_routing_navigation_samples]
131140
=== 🗺️ Routing / Navigation-Samples
132141
133142
[cols="25h,25,50"]
134143
|===
135-
| Sample | Difficulty | Buzz-Words
144+
| Sample | Difficulty | Buzz-Words
136145
137-
| link:src\Avalonia.Samples\Routing\BasicViewLocatorSample[Basic ViewLocator Sample]
146+
| link:src/Avalonia.Samples/Routing/BasicViewLocatorSample[Basic ViewLocator Sample]
138147
| 🐔 Normal
139148
| ViewLocator, Routing, Wizard, Navigation, Page, MVVM
140149
141150
|===
142151
143152
144-
153+
[#_custom_controls_samples]
145154
=== 🛠️ Custom Controls Samples
146155
147156
[cols="25h,25,50"]
148157
|===
149-
| Sample | Difficulty | Buzz-Words
158+
| Sample | Difficulty | Buzz-Words
150159
151-
| link:src\Avalonia.Samples\CustomControls\RatingControlSample[RatingControl Sample]
160+
| link:src/Avalonia.Samples/CustomControls/RatingControlSample[RatingControl Sample]
152161
| 🐔 Normal
153162
| Control, TemplatedControl, custom Control, reusable Control, AvaloniaProperty, StyledProperty, DirectProperty, ReadonlyProperty, Style, ControlTheme
154163
164+
| link:src/Avalonia.Samples/CustomControls/SnowflakesControlSample[SnowflakesControl Sample]
165+
| 🐔 Normal
166+
| Custom Control, Render, Hit-Testing, Custom Animations
167+
155168
|===
156169
157170
171+
[#_view_interaction_samples]
158172
=== ⚡ View Interaction Samples
159173
160174
[cols="25h,25,50"]
161175
|===
162176
| Sample | Difficulty | Buzz-Words
163177
164-
| link:src\Avalonia.Samples\ViewInteraction\MvvmDialogSample[Mvvm Dialog Sample]
178+
| link:src/Avalonia.Samples/ViewInteraction/MvvmDialogSample[Mvvm Dialog Sample]
165179
| 🐔 Normal
166180
| MVVM, Dialog, FileDialogs, TopLevel, Clipboard
167181
168-
| link:src\Avalonia.Samples\ViewInteraction\DialogManagerSample[Dialog Manager Sample]
182+
| link:src/Avalonia.Samples/ViewInteraction/DialogManagerSample[Dialog Manager Sample]
169183
| 🐔 Normal
170184
| MVVM, Dialog, FileDialogs, TopLevel, Clipboard, DialogManager, CommunityToolkit.Mvvm
171185
172186
|===
173187
174-
[#_️_automated_ui_testing]
188+
[#_automated_ui_testing]
175189
=== 🧪️ Automated UI Testing
176190
177191
[cols="25h,25,50"]
178192
|===
179193
| Sample | Difficulty | Buzz-Words
180194
181-
| link:src\Avalonia.Samples\Testing\TestableApp.Headless.XUnit[Testing with Headless XUnit]
195+
| link:src/Avalonia.Samples/Testing/TestableApp.Headless.XUnit[Testing with Headless XUnit]
182196
| 🐔 Normal
183197
| XUnit, Headless, Automation, UI Testing
184-
| link:src\Avalonia.Samples\Testing\TestableApp.Headless.NUnit[Testing with Headless NUnit]
198+
| link:src/Avalonia.Samples/Testing/TestableApp.Headless.NUnit[Testing with Headless NUnit]
185199
| 🐔 Normal
186200
| NUnit, Headless, Automation, UI Testing
187-
| link:src\Avalonia.Samples\Testing\TestableApp.Appium[Testing with Appium]
201+
| link:src/Avalonia.Samples/Testing/TestableApp.Appium[Testing with Appium]
188202
| 🐉 Hard
189203
| XUnit, Appium, WinAppDriver, Automation, UI Testing
190204
191205
|===
192206
207+
[#_complete_apps]
193208
[complete-apps]
194209
=== 🧑‍💻 Complete Apps
195210
[cols="25h,25,50"]
196211
|===
197212
| Sample | Difficulty | Buzz-Words
198213
199-
| link:src\Avalonia.Samples\CompleteApps\SimpleToDoList[Simple ToDo-List]
214+
| link:src/Avalonia.Samples/CompleteApps/SimpleToDoList[Simple ToDo-List]
200215
| 🐥 Easy
201216
| ToDo-List, Complete App, MVVM, CommunityToolkit.MVVM, Source Generator, Styles, Commands
202217
203218
|===
204219
205220
221+
[#_contribution]
206222
== 🪛 Contribution
207223
208-
Is Anything missing? Have you found an error? Have you found an outdated sample? Or do you have a great idea?
224+
Is Anything missing?Have you found an error?Have you found an outdated sample?Or do you have a great idea?
209225
210-
Fantastic! Your contribution is welcome.
226+
Fantastic!Your contribution is welcome.
211227
212-
NOTE: Before you start, make sure you have read the Code of Conduct
228+
NOTE: Before you start, make sure you have read the Code of Conduct
213229
214230
=== Code of Conduct
215-
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the https://dotnetfoundation.org/code-of-conduct[Contributor Covenant Code of Conduct]
231+
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.For more information see the https://dotnetfoundation.org/code-of-conduct[Contributor Covenant Code of Conduct]
216232
233+
[#_issues_and_feature_requests]
217234
=== Issues and Feature Requests
218-
If you file a new issue or feature request please fill in the templates available. If you found an issue in an existing sample, please link the sample and if possible the point us to what is wrong.
235+
If you file a new issue or feature request please fill in the templates available.If you found an issue in an existing sample, please link the sample and if possible the point us to what is wrong.
219236
237+
[#_pull_requests]
220238
=== Pull Requests
221239
222-
NOTE: Pull requests may be discussed and probably not every pull request will be merged in the end. If you are not sure, please <<get-in-touch>> first. Anyway, every contribution is welcome.
240+
NOTE: Pull requests may be discussed and probably not every pull request will be merged in the end.If you are not sure, please <<get-in-touch>> first.Anyway, every contribution is welcome.
223241
242+
[#_fixing_an_existing_sample]
224243
==== Fixing an existing sample
225244
226-
If you find that in an existing sample, that something is unclear or missing, you can update this sample and file a pull request. Also spelling mistakes or wrong wording can be changed and a pull request can be send.
245+
If you find that in an existing sample, that something is unclear or missing, you can update this sample and file a pull request.Also spelling mistakes or wrong wording can be changed and a pull request can be send.
227246
228-
IMPORTANT: If you change the difficulty or the buzz-words, remember to also update the main page.
247+
IMPORTANT: If you change the difficulty or the buzz-words, remember to also update the main page.
229248
249+
[#_adding_a_new_sample]
230250
==== Adding a new sample
231251
232252
. Add a new Project to the Solution `src ► Avalonia.Samples ► Avalonia.Samples.sln`
233-
. In the root directory of the new sample add a `ReadMe`-file. We highly suggest to use the template which you can find here:
234-
.. link:/_docs/AsciiDoc-Template/[AsciiDoc-Template]: If you want to provide richer content, we suggest to use the https://asciidoc.org[ascii-doc]-template.
235-
.. link:/_docs/Markdown-Template/[Markdown-Template]: If you don't like option a), you can use also the Markdown-template.
253+
. In the root directory of the new sample add a `ReadMe`-file.We highly suggest to use the template which you can find here:
254+
.. link:/_docs/AsciiDoc-Template/[AsciiDoc-Template]: If you want to provide richer content, we suggest to use the https://asciidoc.org[ascii-doc]-template.
255+
.. link:/_docs/Markdown-Template/[Markdown-Template]: If you don't like option a), you can use also the Markdown-template.
236256
237257
// Comment this in for next years hacktober fest
238258
////

src/Avalonia.Samples/Avalonia.Samples.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleToDoList", "CompleteA
5959
EndProject
6060
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RectPainter", "Drawing\RectPainter\RectPainter.csproj", "{2B746401-384F-484A-810E-7A65288165E0}"
6161
EndProject
62+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnowflakesControlSample", "CustomControls\SnowflakesControlSample\SnowflakesControlSample.csproj", "{B7B246E1-26F7-4225-A8FC-4344C1D7BA17}"
63+
EndProject
6264
Global
6365
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6466
Debug|Any CPU = Debug|Any CPU
@@ -137,6 +139,10 @@ Global
137139
{2B746401-384F-484A-810E-7A65288165E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
138140
{2B746401-384F-484A-810E-7A65288165E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
139141
{2B746401-384F-484A-810E-7A65288165E0}.Release|Any CPU.Build.0 = Release|Any CPU
142+
{B7B246E1-26F7-4225-A8FC-4344C1D7BA17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
143+
{B7B246E1-26F7-4225-A8FC-4344C1D7BA17}.Debug|Any CPU.Build.0 = Debug|Any CPU
144+
{B7B246E1-26F7-4225-A8FC-4344C1D7BA17}.Release|Any CPU.ActiveCfg = Release|Any CPU
145+
{B7B246E1-26F7-4225-A8FC-4344C1D7BA17}.Release|Any CPU.Build.0 = Release|Any CPU
140146
EndGlobalSection
141147
GlobalSection(SolutionProperties) = preSolution
142148
HideSolutionNode = FALSE
@@ -162,6 +168,7 @@ Global
162168
{0BC90E92-D8B3-4C6D-8C47-BAF57CD73CBA} = {2E99F15F-A82A-4734-A837-C0F768702600}
163169
{7D75B38A-304C-44DE-AC2F-8A461C7FC889} = {50FCF785-BBCF-4AFE-AC72-79EA9E92C43A}
164170
{2B746401-384F-484A-810E-7A65288165E0} = {D02161B3-8242-4BF5-96E9-780465A5023B}
171+
{B7B246E1-26F7-4225-A8FC-4344C1D7BA17} = {92C71AA7-E791-40C0-9F3A-2A85880B0439}
165172
EndGlobalSection
166173
GlobalSection(ExtensibilityGlobals) = postSolution
167174
SolutionGuid = {C246CAB0-0837-4EE4-A22D-28B3C74930B4}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Application xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
x:Class="SnowflakesControlSample.App"
4+
RequestedThemeVariant="Dark">
5+
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
6+
<!-- This App uses "Dark" Theme only since the snowflakes are White and thus better visible on a dark Background -->
7+
8+
<Application.Styles>
9+
<FluentTheme />
10+
</Application.Styles>
11+
</Application>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Avalonia;
2+
using Avalonia.Controls.ApplicationLifetimes;
3+
using Avalonia.Data.Core;
4+
using Avalonia.Data.Core.Plugins;
5+
using Avalonia.Markup.Xaml;
6+
using SnowflakesControlSample.ViewModels;
7+
using SnowflakesControlSample.Views;
8+
9+
namespace SnowflakesControlSample;
10+
11+
public partial class App : Application
12+
{
13+
public override void Initialize()
14+
{
15+
AvaloniaXamlLoader.Load(this);
16+
}
17+
18+
public override void OnFrameworkInitializationCompleted()
19+
{
20+
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
21+
{
22+
// Line below is needed to remove Avalonia data validation.
23+
// Without this line you will get duplicate validations from both Avalonia and CT
24+
BindingPlugins.DataValidators.RemoveAt(0);
25+
desktop.MainWindow = new MainWindow
26+
{
27+
DataContext = new SnowflakeGameViewModel(),
28+
};
29+
}
30+
31+
base.OnFrameworkInitializationCompleted();
32+
}
33+
}

0 commit comments

Comments
 (0)