diff --git a/.gitignore b/.gitignore index dfcfd56..cfe3dbe 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ ## ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +# Ignore IDEA files +**/*/.idea + # User-specific files *.rsuser *.suo diff --git a/README.md b/README.md index ddbbf80..7dba088 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ The simplest way to get started is to add this repo as a [submodule](https://git mkdir ./external git submodule add git@github.com:worldbeater/Avalonia.Citrus.git ./external/citrus # Reference the ../external/citrus/src/Avalonia.Citrus/Avalonia.Citrus.csproj project then. -# The ../external/citrus/src/Citrus/Citrus.csproj is the sandbox where you can browse the markup. +# The ../external/citrus/src/Avalonia.Citrus.Sandbox/Avalonia.Citrus.Sandbox.csproj is +# the sandbox where you can browse the markup samples. ``` Then, reference the default theme (or, the night theme) from your `App.xaml` file: @@ -41,4 +42,4 @@ Then, reference the default theme (or, the night theme) from your `App.xaml` fil ``` -Done! Now the templates of all default controls are updated. See the [sandbox project](https://github.com/worldbeater/Avalonia.Citrus/blob/master/src/Citrus/MainWindow.xaml) for more examples. +Done! Now the templates of all default controls are updated. See the [sandbox project](https://github.com/worldbeater/Avalonia.Citrus/blob/master/src/Avalonia.Citrus.Sandbox/MainWindow.xaml) for more examples. diff --git a/src/Avalonia.Citrus.Sandbox/App.xaml b/src/Avalonia.Citrus.Sandbox/App.xaml new file mode 100644 index 0000000..411a071 --- /dev/null +++ b/src/Avalonia.Citrus.Sandbox/App.xaml @@ -0,0 +1,12 @@ + + + + + + diff --git a/src/Citrus/App.xaml.cs b/src/Avalonia.Citrus.Sandbox/App.xaml.cs similarity index 95% rename from src/Citrus/App.xaml.cs rename to src/Avalonia.Citrus.Sandbox/App.xaml.cs index 0c15947..1e05e5b 100644 --- a/src/Citrus/App.xaml.cs +++ b/src/Avalonia.Citrus.Sandbox/App.xaml.cs @@ -1,8 +1,7 @@ -using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -namespace Citrus +namespace Avalonia.Citrus.Sandbox { public class App : Application { diff --git a/src/Citrus/Citrus.csproj b/src/Avalonia.Citrus.Sandbox/Avalonia.Citrus.Sandbox.csproj similarity index 100% rename from src/Citrus/Citrus.csproj rename to src/Avalonia.Citrus.Sandbox/Avalonia.Citrus.Sandbox.csproj diff --git a/src/Citrus/FodyWeavers.xml b/src/Avalonia.Citrus.Sandbox/FodyWeavers.xml similarity index 100% rename from src/Citrus/FodyWeavers.xml rename to src/Avalonia.Citrus.Sandbox/FodyWeavers.xml diff --git a/src/Citrus/FodyWeavers.xsd b/src/Avalonia.Citrus.Sandbox/FodyWeavers.xsd similarity index 100% rename from src/Citrus/FodyWeavers.xsd rename to src/Avalonia.Citrus.Sandbox/FodyWeavers.xsd diff --git a/src/Citrus/MainWindow.xaml b/src/Avalonia.Citrus.Sandbox/MainWindow.xaml similarity index 99% rename from src/Citrus/MainWindow.xaml rename to src/Avalonia.Citrus.Sandbox/MainWindow.xaml index 9aa32e2..51d1f48 100644 --- a/src/Citrus/MainWindow.xaml +++ b/src/Avalonia.Citrus.Sandbox/MainWindow.xaml @@ -1,8 +1,8 @@ + x:Class="Avalonia.Citrus.Sandbox.MainWindow" + Width="920" Height="630"> diff --git a/src/Citrus/MainWindow.xaml.cs b/src/Avalonia.Citrus.Sandbox/MainWindow.xaml.cs similarity index 89% rename from src/Citrus/MainWindow.xaml.cs rename to src/Avalonia.Citrus.Sandbox/MainWindow.xaml.cs index 0e610be..f4da3bf 100644 --- a/src/Citrus/MainWindow.xaml.cs +++ b/src/Avalonia.Citrus.Sandbox/MainWindow.xaml.cs @@ -2,7 +2,7 @@ using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using ReactiveUI; -namespace Citrus +namespace Avalonia.Citrus.Sandbox { public class MainWindow : ReactiveWindow { diff --git a/src/Citrus/MainWindowViewModel.cs b/src/Avalonia.Citrus.Sandbox/MainWindowViewModel.cs similarity index 77% rename from src/Citrus/MainWindowViewModel.cs rename to src/Avalonia.Citrus.Sandbox/MainWindowViewModel.cs index cb62098..b7e33aa 100644 --- a/src/Citrus/MainWindowViewModel.cs +++ b/src/Avalonia.Citrus.Sandbox/MainWindowViewModel.cs @@ -7,7 +7,7 @@ using ReactiveUI.Fody.Helpers; using ReactiveUI.Validation.Extensions; using ReactiveUI.Validation.Helpers; -namespace Citrus +namespace Avalonia.Citrus.Sandbox { public sealed class MainWindowViewModel : ReactiveValidationObject { @@ -24,8 +24,13 @@ namespace Citrus { _window = window; _changeTheme = ReactiveCommand.Create(PerformThemeChange); + + // We add the style to the main window styles section, + // so it will override the default style defined in App.xaml. _window.Styles.Add(_lightStyle); + // This is ReactiveUI.Validation magic, that supports + // INotifyDataErrorInfo error messages. this.ValidationRule(x => x.Message, message => !string.IsNullOrWhiteSpace(message), "This text is not happy to be empty!"); @@ -38,6 +43,9 @@ namespace Citrus private void PerformThemeChange() { + // Here, we change the first style in the main window styles + // section, and the main window instantly refreshes. Remember + // to invoke such methods from the UI thread. switch (_theme) { case Theme.Light: @@ -57,7 +65,7 @@ namespace Citrus private static StyleInclude CreateStyle(string url) => new StyleInclude( - new Uri("resm:Styles?assembly=Citrus")) + new Uri("resm:Styles?assembly=Avalonia.Citrus.Sandbox")) {Source = new Uri(url)}; } } \ No newline at end of file diff --git a/src/Citrus/Program.cs b/src/Avalonia.Citrus.Sandbox/Program.cs similarity index 88% rename from src/Citrus/Program.cs rename to src/Avalonia.Citrus.Sandbox/Program.cs index 03b166f..cf9aa6d 100644 --- a/src/Citrus/Program.cs +++ b/src/Avalonia.Citrus.Sandbox/Program.cs @@ -1,8 +1,7 @@ -using Avalonia; -using Avalonia.Dialogs; +using Avalonia.Dialogs; using Avalonia.ReactiveUI; -namespace Citrus +namespace Avalonia.Citrus.Sandbox { public static class Program { diff --git a/src/Avalonia.Citrus/Avalonia.Citrus.csproj b/src/Avalonia.Citrus/Avalonia.Citrus.csproj index 2183829..8d183d4 100644 --- a/src/Avalonia.Citrus/Avalonia.Citrus.csproj +++ b/src/Avalonia.Citrus/Avalonia.Citrus.csproj @@ -5,18 +5,10 @@ - + + diff --git a/src/Avalonia.Citrus/Citrus.xaml.cs b/src/Avalonia.Citrus/Citrus.xaml.cs deleted file mode 100644 index f5f57fa..0000000 --- a/src/Avalonia.Citrus/Citrus.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus -{ - public class Citrus : Styles - { - public Citrus() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Rust.xaml.cs b/src/Avalonia.Citrus/Rust.xaml.cs deleted file mode 100644 index 33ca904..0000000 --- a/src/Avalonia.Citrus/Rust.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus -{ - public class Rust : Styles - { - public Rust() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Sea.xaml.cs b/src/Avalonia.Citrus/Sea.xaml.cs deleted file mode 100644 index 3405de6..0000000 --- a/src/Avalonia.Citrus/Sea.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus -{ - public class CitrusNight : Styles - { - public CitrusNight() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/BorderStyles.xaml.cs b/src/Avalonia.Citrus/Theme/BorderStyles.xaml.cs deleted file mode 100644 index e020899..0000000 --- a/src/Avalonia.Citrus/Theme/BorderStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class BorderStyles : Styles - { - public BorderStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/ButtonStyles.xaml.cs b/src/Avalonia.Citrus/Theme/ButtonStyles.xaml.cs deleted file mode 100644 index 3913eb7..0000000 --- a/src/Avalonia.Citrus/Theme/ButtonStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class ButtonStyles : Styles - { - public ButtonStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/CalendarStyles.xaml.cs b/src/Avalonia.Citrus/Theme/CalendarStyles.xaml.cs deleted file mode 100644 index ee902ae..0000000 --- a/src/Avalonia.Citrus/Theme/CalendarStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class CalendarStyles : Styles - { - public CalendarStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/CheckBoxStyles.xaml.cs b/src/Avalonia.Citrus/Theme/CheckBoxStyles.xaml.cs deleted file mode 100644 index 9263ac3..0000000 --- a/src/Avalonia.Citrus/Theme/CheckBoxStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class CheckBoxStyles : Styles - { - public CheckBoxStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/ComboBoxStyles.xaml.cs b/src/Avalonia.Citrus/Theme/ComboBoxStyles.xaml.cs deleted file mode 100644 index 32b3428..0000000 --- a/src/Avalonia.Citrus/Theme/ComboBoxStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class ComboBoxStyles : Styles - { - public ComboBoxStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/ExpanderStyles.xaml.cs b/src/Avalonia.Citrus/Theme/ExpanderStyles.xaml.cs deleted file mode 100644 index 14ca732..0000000 --- a/src/Avalonia.Citrus/Theme/ExpanderStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class ExpanderStyles : Styles - { - public ExpanderStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/ListBoxStyles.xaml.cs b/src/Avalonia.Citrus/Theme/ListBoxStyles.xaml.cs deleted file mode 100644 index 6e30f8f..0000000 --- a/src/Avalonia.Citrus/Theme/ListBoxStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class ListBoxStyles : Styles - { - public ListBoxStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/MenuStyles.xaml.cs b/src/Avalonia.Citrus/Theme/MenuStyles.xaml.cs deleted file mode 100644 index df5d4c5..0000000 --- a/src/Avalonia.Citrus/Theme/MenuStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class MenuStyles : Styles - { - public MenuStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/NumericUpDownStyles.xaml.cs b/src/Avalonia.Citrus/Theme/NumericUpDownStyles.xaml.cs deleted file mode 100644 index 598eb8c..0000000 --- a/src/Avalonia.Citrus/Theme/NumericUpDownStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class NumericUpDownStyles : Styles - { - public NumericUpDownStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/ProgressBarStyles.xaml.cs b/src/Avalonia.Citrus/Theme/ProgressBarStyles.xaml.cs deleted file mode 100644 index 06d2a4e..0000000 --- a/src/Avalonia.Citrus/Theme/ProgressBarStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class ProgressBarStyles : Styles - { - public ProgressBarStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/RadioButtonStyles.xaml.cs b/src/Avalonia.Citrus/Theme/RadioButtonStyles.xaml.cs deleted file mode 100644 index e981a9b..0000000 --- a/src/Avalonia.Citrus/Theme/RadioButtonStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class RadioButtonStyles : Styles - { - public RadioButtonStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/SliderStyles.xaml.cs b/src/Avalonia.Citrus/Theme/SliderStyles.xaml.cs deleted file mode 100644 index 82f3cfe..0000000 --- a/src/Avalonia.Citrus/Theme/SliderStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class SliderStyles : Styles - { - public SliderStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/TabControlStyles.xaml.cs b/src/Avalonia.Citrus/Theme/TabControlStyles.xaml.cs deleted file mode 100644 index cbbe37d..0000000 --- a/src/Avalonia.Citrus/Theme/TabControlStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class TabControlStyles : Styles - { - public TabControlStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/TextBlockStyles.xaml.cs b/src/Avalonia.Citrus/Theme/TextBlockStyles.xaml.cs deleted file mode 100644 index 4054f5c..0000000 --- a/src/Avalonia.Citrus/Theme/TextBlockStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class TextBlockStyles : Styles - { - public TextBlockStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/TextBoxStyles.xaml.cs b/src/Avalonia.Citrus/Theme/TextBoxStyles.xaml.cs deleted file mode 100644 index 3ad7b41..0000000 --- a/src/Avalonia.Citrus/Theme/TextBoxStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class TextBoxStyles : Styles - { - public TextBoxStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/ToggleButtonStyles.xaml.cs b/src/Avalonia.Citrus/Theme/ToggleButtonStyles.xaml.cs deleted file mode 100644 index 60d4a1a..0000000 --- a/src/Avalonia.Citrus/Theme/ToggleButtonStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class ToggleButtonStyles : Styles - { - public ToggleButtonStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Avalonia.Citrus/Theme/TreeViewStyles.xaml.cs b/src/Avalonia.Citrus/Theme/TreeViewStyles.xaml.cs deleted file mode 100644 index b7692cf..0000000 --- a/src/Avalonia.Citrus/Theme/TreeViewStyles.xaml.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Avalonia.Markup.Xaml; -using Avalonia.Styling; - -namespace Avalonia.Citrus.Theme -{ - public class TreeViewStyles : Styles - { - public TreeViewStyles() => AvaloniaXamlLoader.Load(this); - } -} \ No newline at end of file diff --git a/src/Citrus.sln b/src/Citrus.sln index 6c69585..b78cbe4 100644 --- a/src/Citrus.sln +++ b/src/Citrus.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Citrus", "Citrus\Citrus.csproj", "{F2095CAF-992A-4B77-8E8A-372571D627FF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Citrus.Sandbox", "Avalonia.Citrus.Sandbox\Avalonia.Citrus.Sandbox.csproj", "{F2095CAF-992A-4B77-8E8A-372571D627FF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Citrus", "Avalonia.Citrus\Avalonia.Citrus.csproj", "{D02EB1E5-0D24-4139-BCCB-C62B13536D82}" EndProject diff --git a/src/Citrus/App.xaml b/src/Citrus/App.xaml deleted file mode 100644 index 8de68d7..0000000 --- a/src/Citrus/App.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - - - -