148 Commits

Author SHA1 Message Date
SKProCH e36cff1d12 Migrate from DirectProperties to StylesProperties in Scroller. Fixes TabControl styles #217
.NET Core / Build solution (push) Has been cancelled
Publish nightly builds / Build and pack (push) Has been cancelled
Publish nightly builds / Merge packages and publish nightly (push) Has been cancelled
2023-02-24 00:56:20 +03:00
SKProCH c55fa6ee2e Fixes and reformat sliders #217 2023-02-23 02:24:29 +03:00
SKProCH 75f5023d90 Bump .NET SDK in other workflows too 2023-02-17 01:03:03 +03:00
SKProCH d53e4da353 Merge pull request #216 from AvaloniaCommunity/avalonia11preview5
Avalonia11-preview5 support
2023-02-16 14:01:21 -08:00
SKProCH dc7392e7a1 Bump .NET SDK version in workflow 2023-02-17 00:58:38 +03:00
SKProCH a0f923ba8c Remove workaround for TextBlock text color does not changing: https://github.com/AvaloniaUI/Avalonia/issues/9675 2023-02-17 00:55:22 +03:00
SKProCH d77ec060cd Fix ListBoxes in demo 2023-02-16 23:52:08 +03:00
SKProCH e092bf6d17 [WIP] Rollback ItemsControls to ItemsPresenters 2023-02-16 23:42:44 +03:00
SKProCH 49472e3ad8 [WIP] Fix MaterialToolKit.xaml styles and other things
Still has problems with ItemsPresenter's and other things
2023-02-16 00:53:28 +03:00
SKProCH f5a09769bb [WIP] Update ShowMeTheXaml version, fix some incompatibilities 2023-02-09 02:49:17 +03:00
SKProCH 802d0065dd Fix almost all API changes (only ShowMeTheXaml remains) 2023-02-05 22:20:43 +03:00
SKProCH 54b431cde3 Install necessary packages 2023-02-05 22:15:03 +03:00
SKProCH 3247e29662 Replaces all ItemsPresenter with ItemsControl 2023-02-05 22:10:22 +03:00
SKProCH 56e7d18a74 Bump dependencies to Avalonia 11 preview5 and some others 2023-02-05 22:00:46 +03:00
SKProCH 38e162e680 Bump version to 3.0.0-avalonia11-preview3 [no nightly]
.NET Core / Build solution (push) Has been cancelled
Publish release / Build and pack (push) Has been cancelled
Publish release / Merge packages and publish release (push) Has been cancelled
2023-01-31 16:11:16 +03:00
SKProCH 684ac35a30 Removed default font size for TextBlock to allow customizing it as part of other controls
#208 #186
2023-01-30 00:19:19 +03:00
SKProCH 9d8f3eb36c Merge pull request #209 from AvaloniaCommunity/progressBarText
Fix for #184 and rework for ProgressBar styles
2023-01-29 10:36:37 -08:00
SKProCH f69df15523 Improve progress indicators demo page 2023-01-29 21:33:37 +03:00
SKProCH e92569e0c0 Format ProgressBar.axaml and add design time preview 2023-01-29 21:25:18 +03:00
SKProCH a26571424a Rework of default ProgressBar theme 2023-01-29 21:09:36 +03:00
SKProCH bd592d0a0b Add proper formatting for ProgressText in circular progress bar 2023-01-28 16:19:24 +03:00
SKProCH a1a24b0beb Change classes to theme in ProgressIndicatorsDemo [no-nightly] 2023-01-26 17:30:33 +03:00
SKProCH 444181210a Merge branch '3.0_major_update' into progressBarText 2023-01-17 17:59:00 +03:00
SKProCH 8c29d02e79 Fix scroll helper buttons content. #206 2023-01-16 00:14:46 +03:00
SKProCH 5cef8c8767 Make button-like RadioButtons demo more obvious [no nightly] 2022-12-31 13:01:34 +03:00
SKProCH ecb8c634fb Fixes TabControl style to support TabControlAssist.TabHeader*Alignment, reformat styles #203 2022-12-17 02:48:55 +03:00
SKProCH 2be2a8367a Merge branch 'dev' into 3.0_major_update [no nightly]
# Conflicts:
#	Material.Demo/MainWindow.axaml
#	Material.Demo/MainWindow.axaml.cs
#	Material.Demo/Material.Demo.csproj
#	Material.Demo/Pages/TreeViewsDemo.axaml
2022-12-16 02:07:18 +03:00
SKProCH 13d79e4868 Updated target framework to net6.0 for demo, updated dependencies [no nightly] 2022-12-16 02:01:55 +03:00
SKProCH f21fde754d Add theme toggling by pressing Material icon in the left drawer 2022-12-16 01:53:03 +03:00
SKProCH 41a22eb8b9 Change .editorconfig [no nightly] 2022-12-16 01:47:38 +03:00
SKProCH dfc02ba85a Add workarounds for TextBlock and TextBox colors while theme changing #200 2022-12-16 01:38:10 +03:00
SKProCH 9aef9e775a Rework first MenuItems, fix command execution for empty MenuItems #201, reformat MenuItem.xaml 2022-12-11 01:21:00 +03:00
SKProCH f8caa3292e Add Invert method for BaseThemeMode 2022-12-04 22:45:14 +03:00
SKProCH 8d78887dd3 Merge branch 'dev' into 3.0_major_update 2022-12-04 14:48:56 +03:00
SKProCH 7dcf401d79 Add .editorconfig [no nightly] 2022-12-04 14:48:27 +03:00
SKProCH bcb2254dcc Make GetBaseTheme consume IReadOnlyTheme, add renamed GetBaseThemeMode method 2022-12-04 14:45:19 +03:00
SKProCH 05756273e1 Merge pull request #199 from kirichenec/inherit-theme-fix
fix: Inherited theme on Windows11 was reversed
2022-12-04 14:40:41 +03:00
kirichenec 4e57cdcbcb fix: Inherited theme on Windows11 was reversed 2022-12-03 15:18:04 +03:00
SKProCH 9592acd052 Implement ShowProgressText for circular ProgressBar #184 2022-12-01 21:31:25 +03:00
CreateLab cccfe71ee9 Merge pull request #196 from AvaloniaCommunity/readOnlyTheme
Add read only theme
2022-11-30 22:39:51 +03:00
SKProCH 29fbe9fb2c Add IReadOnlyTheme and change CurrentTheme to use it 2022-11-28 02:41:36 +03:00
SKProCH e429670d75 Make compability styles included by default 2022-11-27 15:08:01 +03:00
SKProCH c667450372 Fix Ripple effect remains after being simultaneously triggered 2022-11-21 02:00:18 +03:00
SKProCH a8e6c38a14 Merge pull request #194 from Mrxx99/feature/demoapp-icon [no nightly]
Added Window icon for Material.Demo app (Taskbar)
2022-11-19 15:03:42 +03:00
mrxx99 1e6fe92d40 added window icon for Material.Demo app 2022-11-18 23:59:03 +01:00
SKProCH 6cb1be715c Merge branch 'dev' into 3.0_major_update 2022-11-11 13:12:43 +03:00
SKProCH 9331799471 Add touch support for DataGrid #192 2022-11-11 13:12:22 +03:00
appleneko2001 ae5e08bd83 Apply DateTimeOffsetConverter rename 2022-10-29 21:35:01 +09:00
appleneko2001 141ea159f9 Merge remote-tracking branch 'origin/3.0_major_update' into 3.0_major_update
# Conflicts:
#	Material.Demo/Material.Demo.csproj
#	Material.Demo/Program.cs
#	Material.Styles/Resources/Naming/PartNames.cs
2022-10-29 21:29:48 +09:00
appleneko2001 15b983d4d3 Update comments in Scroller.cs 2022-10-29 21:26:35 +09:00
appleneko2001 b855ae48b2 Remove unused control (ScrollerContentPresenter) 2022-10-29 21:26:01 +09:00
appleneko2001 234e2e546c Add a const variable to control UseCompositor param (Demo) 2022-10-29 21:21:42 +09:00
appleneko2001 ab1b364eda Update Snackbar entries (Demo) 2022-10-29 21:21:11 +09:00
appleneko2001 90f53eb971 Remove SimpleTheme and use classes index 2022-10-29 21:19:27 +09:00
appleneko2001 47bc102e61 Change Card theme 2022-10-29 21:13:27 +09:00
appleneko2001 ced6dc07c0 Change NativeMenuBar 2022-10-29 21:13:05 +09:00
appleneko2001 a05dd67e47 Update PartNames 2022-10-29 21:12:11 +09:00
appleneko2001 d3cc1a565c Add Slider classes 2022-10-29 21:11:54 +09:00
appleneko2001 3a7698b849 Fix nullable-related warning on Material.Styles 2022-10-29 21:11:32 +09:00
appleneko2001 a9fb5c2da4 Add ControlTheme for SnackbarHost, add Button control to Snackbar 2022-10-29 21:09:20 +09:00
appleneko2001 a90d113ce4 Add ControlTheme for TabStrip TabStripItem, Change MaterialToolKit indexes 2022-10-29 21:05:41 +09:00
appleneko2001 580c260b6d Add classes index 2022-10-29 21:00:20 +09:00
appleneko2001 eab5579351 Add Slider ControlTheme (WIP) 2022-10-29 20:59:55 +09:00
appleneko2001 dbd3ea1f79 Add TabControl classes 2022-10-29 20:59:13 +09:00
appleneko2001 469e24623e Add ControlTheme for TabControl TabItem 2022-10-29 20:58:55 +09:00
appleneko2001 de45e1196d Update Scroller 2022-10-29 20:56:43 +09:00
appleneko2001 2d618152bf Add ItemsControl ControlTheme 2022-10-29 20:40:17 +09:00
appleneko2001 dd75b4f2b5 Improve snackbar feature 2022-10-29 20:21:38 +09:00
appleneko2001 ecc6548887 Nullable DateTimeToOffsetConverter, add comments and rename 2022-10-29 18:37:11 +09:00
appleneko2001 f86d5a31d9 Null-safe InverseBooleanValueConverter, change namespace 2022-10-29 18:28:56 +09:00
appleneko2001 13d00e47eb Null-safe BrushRoundConverter, change ConvertBack exception 2022-10-29 18:28:09 +09:00
appleneko2001 d21f8aa8f5 Null-safe DatePickerTextConverter.cs 2022-10-29 18:20:51 +09:00
SKProCH d7800b3aeb Merge branch 'dev' into 3.0_major_update 2022-10-26 01:10:23 +03:00
SKProCH 1e0375033a One more part names fixes for compability with Avalonia 11 preview 2 2022-10-25 00:11:14 +03:00
SKProCH a1a20b4bb9 Updates for Avalonia 11 preview 2 2022-10-24 22:10:19 +03:00
SKProCH cb50e40fc4 Allow publishing releases from 'release/**' branches [no nightly]
.NET Core / Build solution (push) Has been cancelled
Publish release / Build and pack (push) Has been cancelled
Publish release / Merge packages and publish release (push) Has been cancelled
2022-10-13 00:34:42 +03:00
SKProCH 5da5d7c5ef Allow publishing nightly from 3.0_major_update branch, update version info [no nightly] 2022-10-13 00:33:13 +03:00
SKProCH 76e1dc3431 Make XamlDisplay Background transparent to proper demo dark theme display 2022-10-13 00:27:12 +03:00
SKProCH 1213184c47 Merge branch 'dev' into 3.0_major_update
# Conflicts:
#	Material.Avalonia/Material.Avalonia.csproj
#	Material.Colors/Material.Colors.csproj
#	Material.DataGrid/Material.DataGrid.csproj
#	Material.Demo/Material.Demo.csproj
#	Material.Dialog/Material.Dialog.csproj
#	Material.Ripple/Material.Ripple.csproj
#	Material.Styles/Material.Styles.csproj
2022-10-13 00:19:45 +03:00
appleneko2001 ec1079d972 register new part names 2022-09-27 02:52:36 +09:00
appleneko2001 e441041aaa update compatibility classes (suppress IDE warning) 2022-09-27 02:51:35 +09:00
appleneko2001 8f3f5ef94f rename RippleEffect content presenter to default one 2022-09-27 02:50:08 +09:00
appleneko2001 009d7d45b3 Add ControlTheme for DataValidationErrors, update TextBox theme 2022-09-27 02:49:14 +09:00
appleneko2001 4e6bedbf39 Lazy load MainWindow state via DemoApp lifetime 2022-09-20 18:08:40 +09:00
appleneko2001 73a7f3977c ProgressBar border brush set null as default value 2022-09-20 18:06:47 +09:00
appleneko2001 d6117f7a5c Improve ScrollBar theme 2022-09-20 18:05:19 +09:00
appleneko2001 5f8dffd4a0 Improve MaterialUnderline theme 2022-09-20 17:53:53 +09:00
appleneko2001 caf36377ec Improve Expander theme 2022-09-20 17:53:30 +09:00
appleneko2001 5eb1b06f10 Register two new part names 2022-09-20 17:49:56 +09:00
appleneko2001 26b87de466 Move BehaviourEffect part name fragment to upper place 2022-09-20 17:49:26 +09:00
appleneko2001 1d90e0b8a0 Add comments for HoverEffect part name 2022-09-20 17:48:43 +09:00
appleneko2001 31d3ac987f Change TextFieldAssist usable for other controls (only properties, no actual implements) 2022-09-20 17:47:16 +09:00
appleneko2001 5a842b8c93 Patch XamlDisplay 2022-09-20 17:45:59 +09:00
appleneko2001 673f87f22f Fix DevTools not shows MainWindow 2022-09-20 17:43:31 +09:00
appleneko2001 60afa4b35e Add ControlTheme for ProgressBar and classes for it 2022-09-20 17:42:29 +09:00
SKProCH b448cf3855 Update ShowMeTheXaml, remove custom styles for XamlDisplay 2022-09-17 20:02:54 +03:00
appleneko2001 c0c9f5c0ca Remove foreground override of ToggleButton on app header 2022-09-16 17:34:48 +09:00
appleneko2001 4faf0a8701 Remove TODO in Material.Demo project file 2022-09-16 17:34:02 +09:00
appleneko2001 43c9241211 Improve icons browser (a little bit) 2022-09-16 17:33:43 +09:00
appleneko2001 30039aa5b7 Use TreeView ControlTheme instead of style 2022-09-16 17:32:44 +09:00
appleneko2001 bf83181f0a Improve style of RadioButton (button variant) and ListBoxItem 2022-09-16 17:32:20 +09:00
appleneko2001 a47b344b5d Let ToggleButton use implicit Foreground property default. 2022-09-16 17:31:40 +09:00
appleneko2001 4c12acef70 Improve RippleEffect style 2022-09-16 17:30:37 +09:00
appleneko2001 9db707056a Add ControlTheme for TreeView and TreeViewItem 2022-09-16 17:30:03 +09:00
appleneko2001 3ca551ee6b Add TextBox classes 2022-09-16 16:46:13 +09:00
appleneko2001 2438479edc Revert PartNames changes and add TODO 2022-09-16 16:45:56 +09:00
appleneko2001 45d69ff6b0 Use IBeam cursor when TextBox hovered by cursor 2022-09-16 16:45:31 +09:00
appleneko2001 0a3b292166 Improve styles of RadioButton, ScrollBar 2022-09-16 16:44:39 +09:00
appleneko2001 bd95dc3da5 Add ControlTheme for ListBox,ListBoxItem and NavDrawer, use them instead of styles 2022-09-16 16:43:10 +09:00
appleneko2001 c278ce0eb8 Revert "Update demo project file, update avalonia on nightly channel"
This reverts commit 5e36f680a6.
2022-09-15 23:41:54 +09:00
appleneko2001 5e36f680a6 Update demo project file, update avalonia on nightly channel 2022-09-15 23:38:34 +09:00
appleneko2001 200a8384a5 Add classes for ScrollViewer 2022-09-15 23:34:01 +09:00
appleneko2001 a578c4ac58 Add ControlTheme for Expander and ToggleButton 2022-09-15 23:33:32 +09:00
appleneko2001 98f9a6ce68 Add No auto hide variant of ScrollViewer, update demo page 2022-09-15 23:32:37 +09:00
appleneko2001 c2b9aab462 (TextBox) Suppress warnings 2022-09-15 19:50:29 +09:00
appleneko2001 73a4685996 (CheckBox) Reorder code fragments 2022-09-15 19:50:06 +09:00
appleneko2001 a3a7453cdc Update PartNames.cs 2022-09-15 19:48:48 +09:00
appleneko2001 8fea5303cf use added control themes instead of styles 2022-09-15 19:48:35 +09:00
appleneko2001 13f60cc99b Redesign scroll bar and ScrollViewer style, Add ControlTheme for them 2022-09-15 19:47:13 +09:00
appleneko2001 57aca5c39b Add ControlTheme for Window 2022-09-15 19:46:07 +09:00
appleneko2001 7a68b3856b ShowMeTheXaml style broken, fixing 2022-09-12 06:04:07 +09:00
appleneko2001 db8f777595 ShowMeTheXaml is updated! Thanks to dev@SKProCH, revert all related changes back 2022-09-12 05:54:45 +09:00
appleneko2001 216db72af0 Update RadioButton (layout, transitions and default size) and CheckBox (default size) styles 2022-09-11 19:07:28 +09:00
appleneko2001 ee2e570d70 Add ButtonClasses and use it in demo 2022-09-11 19:05:20 +09:00
appleneko2001 e3a7682185 Disable Compositor temporarily because glitchy 2022-09-11 11:27:45 +09:00
appleneko2001 4ea43aec61 Use TextBlockClasses, format code 2022-09-11 11:24:50 +09:00
appleneko2001 fa1bc703a3 Add TextBlockClasses, used for compatibility in newer avalonia 2022-09-11 11:24:18 +09:00
appleneko2001 b97f222f1c Disable TextBlock style include 2022-09-11 11:22:29 +09:00
appleneko2001 28fd418804 Add ControlTheme for TextBlock, import font families as static resource, move ControlTheme files to other folder 2022-09-11 11:22:00 +09:00
appleneko2001 10732362b2 Add ShowMeXaml dummy and update demo 2022-09-11 09:25:14 +09:00
appleneko2001 e4ee1671e7 Change Themes imports 2022-09-11 09:24:53 +09:00
appleneko2001 3b97084fac Add ControlTheme for TextBox (incomplete) and Underline 2022-09-11 09:24:03 +09:00
appleneko2001 3f0e101a78 Fix ShadowAssist (Use standard SetValue instead) 2022-09-11 09:00:23 +09:00
appleneko2001 ea537f8bdf Fix SnackbarHost, API break! (targethost nullable and priority thread param no default value!) 2022-09-11 08:59:27 +09:00
appleneko2001 6e61dfb886 SnackbarHost.GetHost name nullable 2022-09-11 08:58:21 +09:00
appleneko2001 a1134d1230 (Ripple) Fix No-Transitions mode by adding property 2022-09-11 08:57:23 +09:00
appleneko2001 d565ee049b (Ripple) Use latest language standards 2022-09-11 08:56:34 +09:00
appleneko2001 e8de141a4e OwnerChanged nullable 2022-09-11 08:35:27 +09:00
appleneko2001 eab891b28c Add TryAttach implementation for Avalonia 11.0 2022-09-11 08:35:14 +09:00
appleneko2001 1be086d3e7 Remove FluentTheme using declarations in Theme classes 2022-09-11 08:34:52 +09:00
appleneko2001 c505c9bad4 Change documentation (bruh) 2022-09-11 08:34:19 +09:00
appleneko2001 754b9a5d63 Add ControlTheme for ToggleSwitch 2022-09-11 08:32:51 +09:00
appleneko2001 a0f14d0ed5 Add ControlTheme for RadioButton 2022-09-11 08:32:30 +09:00
appleneko2001 de87d00b3a Add ControlTheme for CheckBox 2022-09-11 08:32:00 +09:00
appleneko2001 5f39072865 Add ControlTheme for Card 2022-09-11 08:31:50 +09:00
appleneko2001 1102ff28e8 Add ControlTheme for Button 2022-09-11 08:31:40 +09:00
appleneko2001 7ca89ee0be Add ControlTheme for Ripple effect 2022-09-11 08:31:27 +09:00
appleneko2001 383e88e016 Using newest Avalonia 11.0 preview 2022-09-11 08:24:02 +09:00
156 changed files with 7588 additions and 3271 deletions
+168
View File
@@ -0,0 +1,168 @@
# editorconfig.org
# top-most EditorConfig file
root = true
# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
indent_style = space
indent_size = 4
# ReSharper properties
resharper_place_simple_initializer_on_single_line = true
resharper_wrap_before_arrow_with_expressions = false
# C# files
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = none
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# trim_trailing_whitespace = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# prefer var
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true:suggestion
# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# static fields should have s_ prefix
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_style.static_prefix_style.required_prefix = s_
dotnet_naming_style.static_prefix_style.capitalization = camel_case
# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
# use accessibility modifiers
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# Code style defaults
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none
# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
space_within_single_line_array_initializer_braces = true
# Xaml files
[*.{xaml,axaml}]
indent_size = 2
# Xml project files
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
# Xml build files
[*.builds]
indent_size = 2
# Xml files
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2
# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2
[*.json]
indent_size = 2
# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd, bat}]
end_of_line = crlf
+22
View File
@@ -0,0 +1,22 @@
name: .NET Core
on:
push:
branches-ignore:
- 'master'
pull_request:
branches:
- '**:**'
jobs:
build:
runs-on: ubuntu-latest
name: Build solution
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.*
- name: Build with dotnet
run: dotnet build --configuration Release
-44
View File
@@ -1,44 +0,0 @@
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_main --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------
name: main
on: [push, pull_request]
jobs:
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
- name: Run './build.cmd Compile PublishNugetPackage'
run: ./build.cmd Compile PublishNugetPackage
env:
NuGetKey: ${{ secrets.NUGET_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v1
with:
name: nuget
path: Material.Avalonia/bin/artifacts/nuget
+64
View File
@@ -0,0 +1,64 @@
name: Publish nightly builds
on:
push:
branches:
- 'dev'
- '3.0_major_update'
jobs:
build:
name: Build and pack
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'no nightly')"
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.*
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Pack
run: dotnet pack --configuration Release /p:PatchNumber=$GITHUB_RUN_NUMBER-nightly
- name: Collect packages
run: |
mkdir artifacts
cp Config.Numerge.json artifacts/
mkdir -p artifacts/input/
find . -name \*.nupkg -exec cp {} artifacts/input/ \;
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/
numerge:
name: Merge packages and publish nightly
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout Numerge
uses: actions/checkout@v2.3.4
with:
repository: CreateLab/Numerge
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*
- name: Build Numerge
run: dotnet build
- name: Download packages
uses: actions/download-artifact@v2.0.8
with:
name: artifacts
path: artifacts
- name: Merge packages
run: |
mkdir artifacts/output/
dotnet run --project Numerge.Console artifacts/Config.Numerge.json artifacts/input/ artifacts/output/
- name: Publish to Nuget
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.NUGET_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish to GitHub Packages
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/AvaloniaCommunity/index.json --skip-duplicate
+63
View File
@@ -0,0 +1,63 @@
name: Publish release
on:
push:
branches:
- 'master'
- 'release/**'
jobs:
build:
runs-on: ubuntu-latest
name: Build and pack
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.*
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Pack
run: dotnet pack --configuration Release
- name: Collect packages
run: |
mkdir artifacts
cp Config.Numerge.json artifacts/
mkdir -p artifacts/input/
find . -name \*.nupkg -exec cp {} artifacts/input/ \;
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/
numerge:
runs-on: ubuntu-latest
name: Merge packages and publish release
needs: [build]
steps:
- name: Checkout Numerge
uses: actions/checkout@v2.3.4
with:
repository: CreateLab/Numerge
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*
- name: Build Numerge
run: dotnet build
- name: Download packages
uses: actions/download-artifact@v2.0.8
with:
name: artifacts
path: artifacts
- name: Merge packages
run: |
mkdir artifacts/output/
dotnet run --project Numerge.Console artifacts/Config.Numerge.json artifacts/input/ artifacts/output/
- name: Publish to Nuget
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.NUGET_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish to GitHub Packages
run: dotnet nuget push "artifacts/output/Material.Avalonia.*.nupkg" --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/AvaloniaCommunity/index.json --skip-duplicate
-3
View File
@@ -1,3 +0,0 @@
[submodule "build/Numerge"]
path = build/Numerge
url = https://github.com/kekekeks/Numerge.git
-124
View File
@@ -1,124 +0,0 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"definitions": {
"build": {
"type": "object",
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"NuGetKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"CreateIntermediateNugetPackages",
"CreateNugetPackage",
"PublishNugetPackage",
"ZipFiles"
]
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"CreateIntermediateNugetPackages",
"CreateNugetPackage",
"PublishNugetPackage",
"ZipFiles"
]
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
},
"Version": {
"type": "string",
"description": "version"
}
}
}
}
}
-4
View File
@@ -1,4 +0,0 @@
{
"$schema": "./build.schema.json",
"Solution": "Material.Avalonia.sln"
}
-4
View File
@@ -17,16 +17,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Material.DataGrid", "Materi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Material.Dialog", "Material.Dialog\Material.Dialog.csproj", "{4F5F7FFD-B6E2-4C36-B250-D6B8169A0B1A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{A8E3E5E2-C52D-4CB6-B1CC-7D3D60A907CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A8E3E5E2-C52D-4CB6-B1CC-7D3D60A907CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8E3E5E2-C52D-4CB6-B1CC-7D3D60A907CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECB440AE-658B-4602-87CD-BE7FE8285362}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECB440AE-658B-4602-87CD-BE7FE8285362}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECB440AE-658B-4602-87CD-BE7FE8285362}.Release|Any CPU.ActiveCfg = Release|Any CPU
+19 -20
View File
@@ -13,26 +13,20 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>FavIcon.png</PackageIcon>
<Version>3.0.0-avalonia10-preview2</Version>
<VersionPrefix>3.0.0-avalonia11-preview3</VersionPrefix>
<PackageReleaseNotes>
Most likely latest version with Avalonia 0.10.x support
Version 3.0.0-rc0 was replaced with 3.0.0-avalonia10-preview1 (in order to keep version names clear)
- Bump Avalonia version dependency to 0.10.13
- Implement adapting to system base theme mode on Windows
- Improve/redesign Expander, TextBlock, Separator and other styles
- Create ContentExpandControl, used for animate resizing
- Add TransitioningContentControl style support
- Allow use Avalonia.Diagnostics to dialogs when using DEBUG profile
- Attach TextBlock properties to NumericUpDown
- Add padding to alert dialog and text field dialog
- Fix AutoCorrectPositionConverter #172
- Add default value for Slider, correct dots positioning
- Change resources apply logic to avoid colors apply delay while application starting
- Correct HsbConverter.ToColor method
- Add static part names pool
- Add auto-expand feature on NavigationDrawer
- Update contrast color algorithm
- Add InputMethod.IsInputMethodEnabled for TextBox
This is UNSTABLE version, I think what many things do not work properly here, report all bugs to issues at GitHub.
- Fixes (adds a workaround) runtime theme changing bug
- Add IReadOnlyTheme and change CurrentTheme to use it
- Move some styles to ControlTheme
- Improve some styles to proper work with Avalonia 11
- Make compability styles included by default
- Removed default font size for TextBlock to allow customizing it as part of other controls #208 #186
- Rework ProgressBar styles, add ShowProgressText support
- Fix scroll helper buttons content. #206
- Fixes TabControl style to support TabControlAssist.TabHeaderAlignment #203
- Rework first MenuItems, fix command execution for empty MenuItems #201, reformat MenuItem.xaml
- Fix Ripple effect remains after being simultaneously triggered
</PackageReleaseNotes>
</PropertyGroup>
@@ -40,6 +34,11 @@ Version 3.0.0-rc0 was replaced with 3.0.0-avalonia10-preview1 (in order to keep
<None Include="../README.md" Pack="true" PackagePath="/" />
<None Include="../wiki/FavIcon.png" Pack="true" PackagePath="/" />
</ItemGroup>
<!-- For nightly versions-->
<PropertyGroup>
<Version Condition="'$(PatchNumber)' != ''">$(VersionPrefix).$(PatchNumber)</Version>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="**\*.xaml">
@@ -48,7 +47,7 @@ Version 3.0.0-rc0 was replaced with 3.0.0-avalonia10-preview1 (in order to keep
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="11.0.0-preview5"/>
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -17,6 +17,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="11.0.0-preview5"/>
</ItemGroup>
</Project>
+24 -15
View File
@@ -152,9 +152,7 @@
<ControlTemplate>
<Grid Name="PART_Root"
RowDefinitions="*,*,Auto"
ColumnDefinitions="Auto,*">
</Grid>
ColumnDefinitions="Auto,*" />
</ControlTemplate>
</Setter>
</Style>
@@ -169,13 +167,13 @@
ColumnDefinitions="Auto,Auto,Auto,Auto"
RowDefinitions="Auto,*,Auto">
<Rectangle Grid.Column="1" Grid.Row="1" Name="IndentSpacer" />
<ToggleButton Grid.Column="2" Grid.Row="1" Name="ExpanderButton" Margin="2,0,0,0"/>
<Rectangle Grid.Column="1" Grid.Row="1" Name="PART_IndentSpacer" />
<ToggleButton Grid.Column="2" Grid.Row="1" Name="PART_ExpanderButton" Margin="2,0,0,0"/>
<StackPanel Grid.Column="3" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,1,0,1">
<TextBlock Name="PropertyNameElement" Margin="4,0,0,0" IsVisible="{TemplateBinding IsPropertyNameVisible}"/>
<TextBlock Name="PART_PropertyNameElement" Margin="4,0,0,0" IsVisible="{TemplateBinding IsPropertyNameVisible}"/>
<TextBlock Margin="4,0,0,0" Text="{Binding Key}" />
<TextBlock Name="ItemCountElement" Margin="4,0,0,0" IsVisible="{TemplateBinding IsItemCountVisible}"/>
<TextBlock Name="PART_ItemCountElement" Margin="4,0,0,0" IsVisible="{TemplateBinding IsItemCountVisible}"/>
</StackPanel>
<DataGridRowHeader Name="RowHeader" Grid.RowSpan="3" DataGridFrozenGrid.IsFrozen="True"/>
@@ -206,7 +204,6 @@
<Style Selector="DataGrid">
<Setter Property="RowBackground" Value="Transparent" />
<Setter Property="AlternatingRowBackground" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="HeadersVisibility" Value="Column" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
@@ -237,7 +234,11 @@
VerticalAlignment="Bottom" Height="1"
Background="{TemplateBinding BorderBrush}"/>
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1" />
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
<DataGridRowsPresenter.GestureRecognizers>
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
</DataGridRowsPresenter.GestureRecognizers>
</DataGridRowsPresenter>
<Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
<Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
<ScrollBar Name="PART_VerticalScrollbar" Classes="Modern"
@@ -272,7 +273,11 @@
VerticalAlignment="Bottom" Height="1"
Background="{TemplateBinding BorderBrush}"/>
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1" />
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
<DataGridRowsPresenter.GestureRecognizers>
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
</DataGridRowsPresenter.GestureRecognizers>
</DataGridRowsPresenter>
<Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
<Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
<ScrollBar Name="PART_VerticalScrollbar" Grid.Column="2" Grid.Row="1" />
@@ -306,7 +311,11 @@
VerticalAlignment="Bottom" Height="1"
Background="{TemplateBinding BorderBrush}"/>
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1" />
<DataGridRowsPresenter Name="PART_RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1">
<DataGridRowsPresenter.GestureRecognizers>
<ScrollGestureRecognizer CanHorizontallyScroll="True" CanVerticallyScroll="True" />
</DataGridRowsPresenter.GestureRecognizers>
</DataGridRowsPresenter>
<Rectangle Name="PART_BottomRightCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Column="2" Grid.Row="2" />
<Rectangle Name="BottomLeftCorner" Fill="{DynamicResource ThemeControlMidHighBrush}" Grid.Row="2" Grid.ColumnSpan="2" />
<ScrollBar Name="PART_VerticalScrollbar" Classes="Mini"
@@ -325,12 +334,12 @@
</Style>
<Style Selector="DataGrid.DisableHoveringScrollBar ScrollBar:horizontal">
<Setter Property="Margin" Value="0"></Setter>
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}"></Setter>
<Setter Property="Margin" Value="0" />
<Setter Property="Height" Value="{DynamicResource ScrollBarThickness}" />
</Style>
<Style Selector="DataGrid.DisableHoveringScrollBar ScrollBar:vertical">
<Setter Property="Margin" Value="0"></Setter>
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}"></Setter>
<Setter Property="Margin" Value="0" />
<Setter Property="Width" Value="{DynamicResource ScrollBarThickness}" />
</Style>
</Styles>
+2 -2
View File
@@ -21,8 +21,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="11.0.0-preview5"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.0-preview5"/>
</ItemGroup>
<ItemGroup>
+30 -15
View File
@@ -3,19 +3,34 @@
xmlns:themes="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
x:Class="Material.Demo.App">
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml" />
<themes:MaterialTheme BaseTheme="Light"
PrimaryColor="Purple"
SecondaryColor="Indigo" />
<StyleInclude Source="avares://Material.Icons.Avalonia/App.xaml" />
<StyleInclude Source="avares://Material.DataGrid/DataGrid.xaml" />
<StyleInclude Source="avares://ShowMeTheXaml.Avalonia/XamlDisplay.xaml" />
<StyleInclude Source="avares://Material.Demo/MaterialXamlDisplay.axaml" />
<StyleInclude Source="avares://DialogHost.Avalonia/Styles.xaml" />
<Style Selector="showMeTheXaml|XamlDisplay">
<Setter Property="ClipToBounds" Value="False"></Setter>
</Style>
</Application.Styles>
<Application.Styles>
<themes:MaterialTheme BaseTheme="Light"
PrimaryColor="Purple"
SecondaryColor="Indigo" />
<!-- <StyleInclude Source="avares://Material.Styles/Resources/Compatibility/Index.axaml"/> -->
<StyleInclude Source="avares://Material.Icons.Avalonia/App.xaml" />
<StyleInclude Source="avares://Material.DataGrid/DataGrid.xaml" />
<StyleInclude Source="avares://ShowMeTheXaml.Avalonia.AvaloniaEdit/XamlDisplayStyles.axaml"/>
<!-- Patching XamlDisplay -->
<Style Selector="showMeTheXaml|XamlDisplay">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="ClipToBounds" Value="False"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style Selector="showMeTheXaml|XamlDisplay /template/ Popup#XamlPopup > Border">
<Setter Property="CornerRadius" Value="4"/>
</Style>
<Style Selector="showMeTheXaml|XamlDisplay /template/ Popup#XamlPopup > Border > Grid">
<Setter Property="Background" Value="{DynamicResource MaterialDesignCardBackground }"/>
</Style>
<Style Selector="showMeTheXaml|XamlDisplay /template/ Popup#XamlPopup > Border > Grid > Button">
<Setter Property="Theme" Value="{StaticResource FlatButton}"/>
</Style>
</Application.Styles>
</Application>
+11
View File
@@ -1,4 +1,5 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace Material.Demo
@@ -9,5 +10,15 @@ namespace Material.Demo
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}
base.OnFrameworkInitializationCompleted();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

+25
View File
@@ -0,0 +1,25 @@
using Avalonia;
using Avalonia.Controls;
namespace Material.Demo.Dummy
{
/// <summary>
/// Dummy control, used for replacing XamlDisplay temporarily. Only show the controls, no additional xaml shows now.
/// Require ShowMeXaml for Avalonia 11.0
/// </summary>
public class XamlDisplay : ContentControl
{
public static DirectProperty<XamlDisplay, string> UniqueIdProperty =
AvaloniaProperty.RegisterDirect<XamlDisplay, string>(nameof(UniqueId),
a => a.UniqueId,
(a, b) => a.UniqueId = b);
public string UniqueId
{
get => _uniqueId;
set => SetAndRaise(UniqueIdProperty, ref _uniqueId, value);
}
private string _uniqueId = string.Empty;
}
}
+29 -52
View File
@@ -5,20 +5,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Material.Demo.Pages"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:models="clr-namespace:Material.Demo.Models"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Width="1280" Height="720" MinWidth="720"
Icon="/Assets/FavIcon_128x.png"
Title="Material.Demo">
<Window.Styles>
<Style Selector="showMeTheXaml|XamlDisplay">
<Setter Property="Margin" Value="8" />
<!-- Stretch XamlDisplay horizontally -->
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
<Style Selector="TextBlock.Subheadline">
<Setter Property="Margin" Value="0, 16" />
</Style>
@@ -31,22 +23,6 @@
</Style>
</Window.Styles>
<dialogHostAvalonia:DialogHost Identifier="MainDialogHost" >
<dialogHostAvalonia:DialogHost.DialogContentTemplate>
<DataTemplate DataType="models:Sample2Model" >
<StackPanel>
<TextBlock TextAlignment="Center" >Your lucky number:</TextBlock>
<TextBlock Classes="Body1"
TextAlignment="Center"
Text="{Binding Number}" />
<Button Margin="0 8 0 0"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHostAvalonia:DialogHost}, Path=CloseDialogCommand}" >
THANKS, CLOSE
</Button>
</StackPanel>
</DataTemplate>
</dialogHostAvalonia:DialogHost.DialogContentTemplate>
<controls:SnackbarHost HostName="Root" TemplateApplied="TemplatedControl_OnTemplateApplied">
<controls:NavigationDrawer Name="LeftDrawer" Classes="permanent"
LeftDrawerOpened="{Binding ElementName=NavDrawerSwitch, Path=IsChecked, Mode=TwoWay}">
@@ -56,7 +32,8 @@
<controls:ColorZone Mode="Accent" Height="180">
<StackPanel>
<Image Width="120" Height="120" HorizontalAlignment="Center" VerticalAlignment="Top"
Source="avares://Material.Demo/Assets/FavIcon_200x.png" Margin="0,0,0,-8" />
Source="avares://Material.Demo/Assets/FavIcon_200x.png" Margin="0,0,0,-8"
PointerPressed="MaterialIcon_OnPointerPressed" />
<TextBlock Classes="Headline6" Text="Material Design" HorizontalAlignment="Center" />
<TextBlock Classes="Subtitle1" Text="with AvaloniaUI" HorizontalAlignment="Center" />
</StackPanel>
@@ -71,26 +48,26 @@
<Setter Property="IsEnabled" Value="{Binding $self.Content.IsEnabled}" />
</Style>
</ListBox.Styles>
<TextBlock Classes="Body2" Text="Home" />
<TextBlock Classes="Body2" Text="Buttons" />
<TextBlock Classes="Body2" Text="Toggles" />
<TextBlock Classes="Body2" Text="Fields" />
<TextBlock Classes="Body2" Text="ComboBoxes" />
<TextBlock Classes="Body2" Text="Material Icons" />
<TextBlock Classes="Body2" Text="Sliders" />
<TextBlock Classes="Body2" Text="Progress indicators" />
<TextBlock Classes="Body2" Text="Lists" />
<TextBlock Classes="Body2" Text="Expanders" />
<TextBlock Classes="Body2" Text="ColorZones" />
<TextBlock Classes="Body2" Text="Dialogs" />
<TextBlock Classes="Body2" Text="ScrollViewer" />
<TextBlock Classes="Body2" Text="SideSheet" />
<TextBlock Classes="Body2" Text="TabControls" />
<TextBlock Classes="Body2" Text="TreeViews" />
<TextBlock Classes="Body2" Text="Card" />
<TextBlock Classes="Body2" Text="Typography" />
<TextBlock Classes="Body2" Text="Pickers" />
<TextBlock Classes="Body2" Text="Shadows" IsEnabled="False" />
<ListBoxItem>Home</ListBoxItem>
<ListBoxItem>Buttons</ListBoxItem>
<ListBoxItem>Toggles</ListBoxItem>
<ListBoxItem>Fields</ListBoxItem>
<ListBoxItem>ComboBoxes</ListBoxItem>
<ListBoxItem>Material Icons</ListBoxItem>
<ListBoxItem>Sliders</ListBoxItem>
<ListBoxItem>Progress indicators</ListBoxItem>
<ListBoxItem>Lists</ListBoxItem>
<ListBoxItem>Expanders</ListBoxItem>
<ListBoxItem>ColorZones</ListBoxItem>
<ListBoxItem>Dialogs</ListBoxItem>
<ListBoxItem>ScrollViewer</ListBoxItem>
<ListBoxItem>SideSheet</ListBoxItem>
<ListBoxItem>TabControls</ListBoxItem>
<ListBoxItem>TreeViews</ListBoxItem>
<ListBoxItem>Card</ListBoxItem>
<ListBoxItem>Typography</ListBoxItem>
<ListBoxItem>Pickers</ListBoxItem>
<ListBoxItem>Shadows</ListBoxItem>
</ListBox>
</StackPanel>
</ScrollViewer>
@@ -108,7 +85,6 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ToggleButton Name="NavDrawerSwitch"
Foreground="{DynamicResource MaterialDesignBody}"
Width="32" Height="32" Padding="4">
<avalonia:MaterialIcon Kind="Menu" Width="24" Height="24" />
</ToggleButton>
@@ -121,6 +97,11 @@
<avalonia:MaterialIcon Kind="Hand" Width="24" Height="24" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Connect to network" Click="ConnectToNetworkMenuItem_OnClick">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="RocketLaunch" Width="24" Height="24" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Action 1" />
<MenuItem Header="Action 2" />
@@ -217,8 +198,4 @@
</DockPanel>
</controls:NavigationDrawer>
</controls:SnackbarHost>
</dialogHostAvalonia:DialogHost>
</Window>
</Window>
+57 -42
View File
@@ -6,31 +6,27 @@ using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Threading;
using Material.Styles.Controls;
using Material.Styles.Models;
using Material.Styles.Themes;
using Material.Styles.Themes.Base;
namespace Material.Demo
{
public class MainWindow : Window
{
#region Control fields
private ToggleButton NavDrawerSwitch;
namespace Material.Demo {
public class MainWindow : Window {
private readonly List<SnackbarModel> helloSnackBars = new();
private ListBox DrawerList;
private Carousel PageCarousel;
private ScrollViewer mainScroller;
private NavigationDrawer LeftDrawer;
private ScrollViewer mainScroller;
private ToggleButton NavDrawerSwitch;
private Carousel PageCarousel;
#endregion
public MainWindow()
{
public MainWindow() {
InitializeComponent();
this.AttachDevTools(KeyGesture.Parse("Shift+F12"));
this.AttachDevTools();
}
private void InitializeComponent()
{
private void InitializeComponent() {
AvaloniaXamlLoader.Load(this);
#region Control getter and event binding
@@ -48,58 +44,77 @@ namespace Material.Demo
LeftDrawer = this.Get<NavigationDrawer>(nameof(LeftDrawer));
#endregion
}
private void DrawerList_KeyUp(object sender, KeyEventArgs e)
{
private void DrawerList_KeyUp(object sender, KeyEventArgs e) {
if (e.Key == Key.Space || e.Key == Key.Enter)
DrawerSelectionChanged(sender, null);
}
public void DrawerSelectionChanged(object sender, RoutedEventArgs? args)
{
public void DrawerSelectionChanged(object sender, RoutedEventArgs? args) {
if (sender is not ListBox listBox)
return;
if (!listBox.IsFocused && !listBox.IsKeyboardFocusWithin)
return;
try
{
try {
PageCarousel.SelectedIndex = listBox.SelectedIndex;
mainScroller.Offset = Vector.Zero;
mainScroller.VerticalScrollBarVisibility =
listBox.SelectedIndex == 5 ? ScrollBarVisibility.Disabled : ScrollBarVisibility.Auto;
}
catch
{
catch {
// ignored
}
LeftDrawer.OptionalCloseLeftDrawer();
}
private void TemplatedControl_OnTemplateApplied(object? sender, TemplateAppliedEventArgs e)
{
SnackbarHost.Post("Welcome to demo of Material.Avalonia!");
private void TemplatedControl_OnTemplateApplied(object? sender, TemplateAppliedEventArgs e) {
SnackbarHost.Post("Welcome to demo of Material.Avalonia!", null, DispatcherPriority.Normal);
}
private readonly List<SnackbarModel> helloSnackBars = new();
private void HelloButtonMenuItem_OnClick(object? sender, RoutedEventArgs e)
{
var helloSnackBar = new SnackbarModel("Hello, user!", TimeSpan.Zero);
SnackbarHost.Post(helloSnackBar);
helloSnackBars.Add(helloSnackBar);
/// <summary>
/// This method is used for showcase of snackbar.
/// </summary>
private void HelloButtonMenuItem_OnClick(object? sender, RoutedEventArgs e) {
// According to guidelines of Material design, 'endless' snackbar is not recommended.
// They should dismiss after 4 - 10 seconds.
// https://m2.material.io/components/snackbars#behavior
var helloSnackBar = new SnackbarModel("Hello, user!", TimeSpan.FromSeconds(5));
SnackbarHost.Post(helloSnackBar, null, DispatcherPriority.Normal);
}
private void GoodbyeButtonMenuItem_OnClick(object? sender, RoutedEventArgs e)
{
foreach (var snackbarModel in helloSnackBars)
{
SnackbarHost.Remove(snackbarModel);
/// <summary>
/// This method is used for showcase of snackbar.
/// </summary>
private void GoodbyeButtonMenuItem_OnClick(object? sender, RoutedEventArgs e) {
SnackbarHost.Post("See ya next time, user!", null, DispatcherPriority.Normal);
}
/// <summary>
/// This method is used for showcase of snackbar.
/// </summary>
private void ConnectToNetworkMenuItem_OnClick(object? sender, RoutedEventArgs e) {
void Retry() {
SnackbarHost.Post(
new SnackbarModel("Connected to network.", TimeSpan.FromSeconds(5)),
null, DispatcherPriority.Normal);
}
SnackbarHost.Post("See ya next time, user!");
SnackbarHost.Post(
new SnackbarModel("Unable to connect network. Please check everything is fine.",
TimeSpan.FromSeconds(10),
new SnackbarButtonModel {
Text = "Retry",
Action = Retry
}), null, DispatcherPriority.Normal);
}
private void MaterialIcon_OnPointerPressed(object? sender, PointerPressedEventArgs e) {
var materialTheme = Application.Current.LocateMaterialTheme<MaterialTheme>();
materialTheme.BaseTheme = materialTheme.BaseTheme == BaseThemeMode.Light ? BaseThemeMode.Dark : BaseThemeMode.Light;
}
}
}
}
+12 -9
View File
@@ -1,19 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.18" />
<PackageReference Include="Material.Icons.Avalonia" Version="1.0.2" />
<PackageReference Include="ShowMeTheXaml.Avalonia.Generator" Version="1.1.0" />
<PackageReference Include="DialogHost.Avalonia" Version="0.6.0-rc1" />
<PackageReference Include="Avalonia" Version="11.0.0-preview5"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.0-preview5"/>
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="11.0.0-preview5"/>
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview5"/>
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview5"/>
<PackageReference Include="Avalonia.Themes.Simple" Version="11.0.0-preview5"/>
<PackageReference Include="Material.Icons.Avalonia" Version="2.0.0-preview2"/>
<PackageReference Include="DialogHost.Avalonia" Version="0.7.0-preview4"/>
<PackageReference Include="ShowMeTheXaml.Avalonia" Version="1.2.0-avalonia11-preview2"/>
<PackageReference Include="ShowMeTheXaml.Avalonia.AvaloniaEdit" Version="1.2.0-avalonia11-preview2"/>
<PackageReference Include="ShowMeTheXaml.Avalonia.Generator" Version="1.2.0-avalonia11-preview2"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Material.Avalonia\Material.Avalonia.csproj" />
-79
View File
@@ -1,79 +0,0 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
xmlns:assists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles"
xmlns:commands="clr-namespace:Material.Demo.Commands" >
<Styles.Resources>
<commands:TextBoxCopyAllTextCommand x:Key="TextBoxCopyAllTextCommand"/>
</Styles.Resources>
<Style Selector="showMeTheXaml|XamlDisplay" >
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template" >
<ControlTemplate>
<DockPanel>
<DockPanel.Resources>
<showMeTheXaml:AlignmentYConverter x:Key="AlignmentYConverter" />
</DockPanel.Resources>
<Viewbox Name="SourceXamlButton"
Height="16" Width="16"
DockPanel.Dock="Right"
VerticalAlignment="{TemplateBinding XamlButtonAlignment,
Converter={x:Static showMeTheXaml:AlignmentYConverter.Instance}}" >
<Panel Background="Transparent" >
<Path Fill="{TemplateBinding Foreground}"
Data="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" />
</Panel>
</Viewbox>
<Popup Name="XamlPopup"
IsLightDismissEnabled="True" >
<Border CornerRadius="4"
Background="{DynamicResource MaterialDesignCardBackground}"
BorderBrush="{DynamicResource MaterialDesignBody}"
BorderThickness="2"
MaxWidth="800"
MinHeight="100"
MaxHeight="400"
Padding="8" >
<Grid RowDefinitions="*, 8, Auto" >
<TextBox Grid.Row="0"
Name="PART_TextBox"
IsReadOnly="True"
TextWrapping="Wrap"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
assists:TextFieldAssist.Hints="xaml code for this control"
Text="{TemplateBinding XamlText}" />
<Button Grid.Row="2"
Classes="flat"
Content="COPY XAML"
Command="{StaticResource TextBoxCopyAllTextCommand}"
CommandParameter="{Binding ElementName=PART_TextBox}"
HorizontalAlignment="Right" />
</Grid>
</Border>
</Popup>
<Panel DockPanel.Dock="Left" >
<Border BorderThickness="4"
BorderBrush="{TemplateBinding Foreground}"
Opacity="0.5"
IsVisible="{Binding #XamlPopup.IsOpen}"
CornerRadius="2" />
<ContentPresenter Margin="4"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}" />
</Panel>
</DockPanel>
</ControlTemplate>
</Setter>
</Style>
</Styles>
+8 -1
View File
@@ -1,14 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Material.Demo.ViewModels;
using Material.Icons;
namespace Material.Demo.Models
{
public class MaterialIconKindGroup
{
public MaterialIconKindGroup(IEnumerable<string> kinds)
private readonly IconsDemoViewModel _parent;
public MaterialIconKindGroup(IconsDemoViewModel parent, IEnumerable<string> kinds)
{
_parent = parent;
if (kinds is null) throw new ArgumentNullException(nameof(kinds));
var allValues = kinds.ToList();
if (!allValues.Any()) throw new ArgumentException($"{nameof(kinds)} must contain at least one value");
@@ -19,6 +24,8 @@ namespace Material.Demo.Models
.ToArray();
}
public IconsDemoViewModel Parent => _parent;
public string Kind { get; }
public string KindToCopy => $"<avalonia:MaterialIcon Kind=\"{Kind}\" />";
public MaterialIconKind KindValue { get; }
+13 -15
View File
@@ -3,20 +3,18 @@
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"
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles"
xmlns:assist="clr-namespace:Material.Styles.Assists;assembly=Material.Styles"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
x:Class="Material.Demo.Pages.ButtonsDemo">
<StackPanel Margin="16, 0">
<StackPanel.Styles>
<Style Selector="showMeTheXaml|XamlDisplay Button">
<Style Selector="Button">
<Setter Property="IsEnabled"
Value="{Binding ElementName=IsEnabledCheckBox, Path=IsChecked}"/>
</Style>
<Style Selector="showMeTheXaml|XamlDisplay controls|FloatingButton">
<Style Selector="controls|FloatingButton">
<Setter Property="IsEnabled"
Value="{Binding ElementName=IsEnabledCheckBox, Path=IsChecked}"/>
</Style>
@@ -30,16 +28,16 @@
<TextBlock Classes="Headline6 Subheadline2" Text="Regular buttons" />
<StackPanel Orientation="Horizontal">
<showMeTheXaml:XamlDisplay UniqueId="Buttons1">
<Button Classes="Light" Content="Light" ToolTip.Tip='Button with classes "Light"' />
<Button Classes="light" Content="Light" ToolTip.Tip='Button with classes "Light"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="Buttons2">
<Button Content="Mid (Default)" ToolTip.Tip='Regular button without any classes.' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="Buttons3">
<Button Classes="Dark" Content="Dark" ToolTip.Tip='Button with classes "Dark"' />
<Button Classes="dark" Content="Dark" ToolTip.Tip='Button with classes "Dark"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="Buttons4">
<Button Classes="Accent" Content="Accent" ToolTip.Tip='Button with classes "Accent"' />
<Button Classes="accent" Content="Accent" ToolTip.Tip='Button with classes "Accent"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="Buttons5">
<Button Content="Custom corner radius"
@@ -56,21 +54,21 @@
</Style>
</StackPanel.Styles>
<showMeTheXaml:XamlDisplay UniqueId="OutlineButtons0">
<Button Classes="Outline Light" Content="Light" ToolTip.Tip='Button with classes "Light" and "Outline"' />
<Button Theme="{StaticResource OutlineButton}" Classes="light" Content="Light" ToolTip.Tip='Button with classes "Light" and "Outline"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineButtons1">
<Button Classes="Outline" Content="Mid (Default)" ToolTip.Tip='Button with classes "Outline"' />
<Button Theme="{StaticResource OutlineButton}" Content="Mid (Default)" ToolTip.Tip='Button with classes "Outline"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineButtons2">
<Button Classes="Outline Dark" Content="Dark" ToolTip.Tip='Button with classes "Dark" and "Outline"' />
<Button Theme="{StaticResource OutlineButton}" Classes="dark" Content="Dark" ToolTip.Tip='Button with classes "Dark" and "Outline"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineButtons3">
<Button Classes="Outline Accent" Content="Accent"
<Button Theme="{StaticResource OutlineButton}" Classes="accent" Content="Accent"
ToolTip.Tip='Button with classes "Accent" and "Outline"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineButtons4">
<Button Classes="Outline" Content="Custom corner radius"
<Button Theme="{StaticResource OutlineButton}" Content="Custom corner radius"
ToolTip.Tip='Outline button with customized corner radius (16dp).'
CornerRadius="16" />
</showMeTheXaml:XamlDisplay>
@@ -182,10 +180,10 @@
</Style>
</StackPanel.Styles>
<showMeTheXaml:XamlDisplay UniqueId="FlatButtons0">
<Button Classes="Flat" Content="Default" ToolTip.Tip='Regular button with class "Flat"' />
<Button Theme="{StaticResource FlatButton}" Content="Default" ToolTip.Tip='Regular button with class "Flat"' />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="FlatButtons1">
<Button Classes="Flat Accent" Content="Accent" ToolTip.Tip='Button with classes "Accent" and "Flat"' />
<Button Theme="{StaticResource FlatButton}" Classes="accent" Content="Accent" ToolTip.Tip='Button with classes "Accent" and "Flat"' />
</showMeTheXaml:XamlDisplay>
</StackPanel>
+1 -1
View File
@@ -22,7 +22,7 @@
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="DialogHost" />
<StackPanel>
<TextBlock TextWrapping="Wrap" >Top level dialog with custom corner radius, using OpenDialog, passing content via the Parameter. You can pass a view model, provided a corresponding DataTemplate can be found in the scope of the root DialogHost.</TextBlock>
<TextBlock TextWrapping="Wrap" Text="Top level dialog with custom corner radius, using OpenDialog, passing content via the Parameter. You can pass a view model, provided a corresponding DataTemplate can be found in the scope of the root DialogHost."/>
<StackPanel Spacing="8" >
<Button Classes="flat" Click="OpenDialogWithView" >PASS VIEW</Button>
<Button Classes="flat" Click="OpenDialogWithModel" >PASS MODEL</Button>
+10 -2
View File
@@ -1,6 +1,8 @@
using System;
using System.Diagnostics;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using DialogHostAvalonia;
@@ -14,8 +16,6 @@ namespace Material.Demo.Pages
public DialogDemo()
{
InitializeComponent();
DataContext = new DialogDemoViewModel();
}
private void InitializeComponent()
@@ -23,6 +23,14 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
// Lazy Initialize view model
DataContext ??= new DialogDemoViewModel();
base.OnApplyTemplate(e);
}
private void OpenDialogWithView(object? sender, RoutedEventArgs e)
{
DialogHost.Show(this.Resources["Sample2View"]!, "MainDialogHost");
+29 -29
View File
@@ -95,29 +95,29 @@
<StackPanel Orientation="Vertical">
<TextBlock Classes="Headline6 Subheadline2" Text="Single-Line fields" />
<showMeTheXaml:XamlDisplay UniqueId="SingleLineFields0">
<TextBox UseFloatingWatermark="True" Classes="filled"
<TextBox UseFloatingWatermark="True" Theme="{StaticResource FilledTextBox}"
wpf:TextFieldAssist.Label="Filled TextBox" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineFields1">
<TextBox UseFloatingWatermark="False" Classes="filled" Watermark="No floating label" />
<TextBox UseFloatingWatermark="False" Theme="{StaticResource FilledTextBox}" Watermark="No floating label" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineFields2">
<TextBox UseFloatingWatermark="True" Classes="filled revealPasswordButton"
<TextBox UseFloatingWatermark="True" Classes="filled revealPasswordButton" Theme="{StaticResource FilledTextBox}"
wpf:TextFieldAssist.Label="Password"
PasswordChar="*" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineFields3">
<TextBox UseFloatingWatermark="True" Classes="filled clearButton"
<TextBox UseFloatingWatermark="True" Classes="filled clearButton" Theme="{StaticResource FilledTextBox}"
wpf:TextFieldAssist.Label="Text field" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineFields4">
<TextBox UseFloatingWatermark="True" Classes="filled"
<TextBox UseFloatingWatermark="True" Classes="filled" Theme="{StaticResource FilledTextBox}"
wpf:TextFieldAssist.Label="Text field with validation"
wpf:TextFieldAssist.Hints="{StaticResource TextFieldTip1}"
Text="{Binding Numerics}" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineFields5">
<TextBox UseFloatingWatermark="True" Classes="filled" IsEnabled="False"
<TextBox UseFloatingWatermark="True" Classes="filled" Theme="{StaticResource FilledTextBox}" IsEnabled="False"
wpf:TextFieldAssist.Label="Disabled Field"
Text="Hello World!" />
</showMeTheXaml:XamlDisplay>
@@ -125,25 +125,25 @@
<StackPanel Orientation="Vertical">
<TextBlock Classes="Headline6 Subheadline2" Text="Single-Line fields (dense)" />
<showMeTheXaml:XamlDisplay UniqueId="SingleLineDenseFields0">
<TextBox Classes="filled dense" UseFloatingWatermark="False" Watermark="No floating label" />
<TextBox Classes="filled dense" Theme="{StaticResource FilledTextBox}" UseFloatingWatermark="False" Watermark="No floating label" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineDenseFields1">
<TextBox UseFloatingWatermark="True" Classes="filled dense"
<TextBox UseFloatingWatermark="True" Classes="filled dense" Theme="{StaticResource FilledTextBox}"
wpf:TextFieldAssist.Label="Filled dense TextBox" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineDenseFields2">
<TextBox UseFloatingWatermark="True" Classes="filled dense clearButton"
<TextBox UseFloatingWatermark="True" Classes="filled dense clearButton" Theme="{StaticResource FilledTextBox}"
wpf:TextFieldAssist.Label="Dense field with clear button" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineDenseFields3">
<TextBox UseFloatingWatermark="True" Classes="filled dense revealPasswordButton"
<TextBox UseFloatingWatermark="True" Classes="filled dense revealPasswordButton" Theme="{StaticResource FilledTextBox}"
wpf:TextFieldAssist.Label="Password"
PasswordChar="*" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SingleLineDenseFields4">
<TextBox UseFloatingWatermark="True" Classes="filled dense" IsEnabled="False"
<TextBox UseFloatingWatermark="True" Classes="filled dense" Theme="{StaticResource FilledTextBox}" IsEnabled="False"
wpf:TextFieldAssist.Label="Disabled Field"
Text="Hello World!" />
</showMeTheXaml:XamlDisplay>
@@ -160,7 +160,7 @@
<showMeTheXaml:XamlDisplay UniqueId="MultilineFields1">
<TextBox UseFloatingWatermark="True"
wpf:TextFieldAssist.Label="Multiline textfield"
Classes="filled"
Classes="filled" Theme="{StaticResource FilledTextBox}"
AcceptsReturn="True"
TextWrapping="Wrap"
MaxHeight="100"
@@ -188,50 +188,50 @@
<StackPanel Orientation="Vertical">
<TextBlock Classes="Headline6 Subheadline2" Text="Single-Line fields" />
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineFields0">
<TextBox UseFloatingWatermark="True" Classes="outline"
<TextBox UseFloatingWatermark="True" Classes="outline" Theme="{StaticResource OutlineTextBox}"
wpf:TextFieldAssist.Label="Outline TextBox" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineFields1">
<TextBox UseFloatingWatermark="False" Classes="outline" Watermark="No floating label" />
<TextBox UseFloatingWatermark="False" Classes="outline" Theme="{StaticResource OutlineTextBox}" Watermark="No floating label" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineFields2">
<TextBox UseFloatingWatermark="True" Classes="outline revealPasswordButton"
<TextBox UseFloatingWatermark="True" Classes="outline revealPasswordButton" Theme="{StaticResource OutlineTextBox}"
wpf:TextFieldAssist.Label="Password" PasswordChar="*" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineFields3">
<TextBox UseFloatingWatermark="True" Classes="outline clearButton"
<TextBox UseFloatingWatermark="True" Classes="outline clearButton" Theme="{StaticResource OutlineTextBox}"
wpf:TextFieldAssist.Label="Text field" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineFields4">
<TextBox UseFloatingWatermark="True" Classes="outline"
<TextBox UseFloatingWatermark="True" Classes="outline" Theme="{StaticResource OutlineTextBox}"
wpf:TextFieldAssist.Label="Text field with validation"
wpf:TextFieldAssist.Hints="{StaticResource TextFieldTip1}"
Text="{Binding Numerics}"/>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineFields5">
<TextBox UseFloatingWatermark="True" Classes="outline" IsEnabled="False"
<TextBox UseFloatingWatermark="True" Classes="outline" Theme="{StaticResource OutlineTextBox}" IsEnabled="False"
wpf:TextFieldAssist.Label="Disabled Field" Text="Hello World!" />
</showMeTheXaml:XamlDisplay>
</StackPanel>
<StackPanel Orientation="Vertical">
<TextBlock Classes="Headline6 Subheadline2" Text="Single-Line fields (dense)" />
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineDenseFields0">
<TextBox UseFloatingWatermark="False" Classes="outline dense" Watermark="No floating label" />
<TextBox UseFloatingWatermark="False" Classes="outline dense" Theme="{StaticResource OutlineTextBox}" Watermark="No floating label" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineDenseFields1">
<TextBox UseFloatingWatermark="True" Classes="outline dense"
<TextBox UseFloatingWatermark="True" Classes="outline dense" Theme="{StaticResource OutlineTextBox}"
wpf:TextFieldAssist.Label="Outline dense TextBox" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineDenseFields2">
<TextBox UseFloatingWatermark="True" Classes="outline dense clearButton"
<TextBox UseFloatingWatermark="True" Classes="outline dense clearButton" Theme="{StaticResource OutlineTextBox}"
wpf:TextFieldAssist.Label="Dense field with clear button" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineDenseFields3">
<TextBox UseFloatingWatermark="True" Classes="outline dense revealPasswordButton"
<TextBox UseFloatingWatermark="True" Classes="outline dense revealPasswordButton" Theme="{StaticResource OutlineTextBox}"
wpf:TextFieldAssist.Label="Password" PasswordChar="*" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="OutlineSinglelineDenseFields4">
<TextBox UseFloatingWatermark="True" Classes="outline dense" IsEnabled="False"
<TextBox UseFloatingWatermark="True" Classes="outline dense" Theme="{StaticResource OutlineTextBox}" IsEnabled="False"
wpf:TextFieldAssist.Label="Disabled Field" Text="Hello World!" />
</showMeTheXaml:XamlDisplay>
</StackPanel>
@@ -248,7 +248,7 @@
<showMeTheXaml:XamlDisplay UniqueId="OutlineMultilineFields0">
<TextBox UseFloatingWatermark="True"
wpf:TextFieldAssist.Label="Multiline textfield"
Classes="outline"
Classes="outline" Theme="{StaticResource OutlineTextBox}"
MaxHeight="100"
AcceptsReturn="True"
TextWrapping="Wrap"
@@ -276,7 +276,7 @@
<TextBlock Classes="Headline6 Subheadline2" Text="Solo fields" />
<showMeTheXaml:XamlDisplay UniqueId="SoloFields0">
<controls:Card Padding="0" Margin="8">
<TextBox Classes="solo" Watermark="Solo field with Card">
<TextBox Classes="solo" Theme="{StaticResource SoloTextBox}" Watermark="Solo field with Card">
<TextBox.InnerRightContent>
<Button Classes="Flat" Padding="4" Width="{Binding $self.Bounds.Height}"
Content="{avalonia:MaterialIconExt Search, Size=24}" />
@@ -286,7 +286,7 @@
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SoloFields1">
<controls:ColorZone Padding="0" Margin="8">
<TextBox Classes="solo" Watermark="or with ColorZone">
<TextBox Classes="solo" Theme="{StaticResource SoloTextBox}" Watermark="or with ColorZone">
<TextBox.InnerRightContent>
<Button Classes="Flat" Padding="4" Width="{Binding $self.Bounds.Height}"
Content="{avalonia:MaterialIconExt Search, Size=24}" />
@@ -296,7 +296,7 @@
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SoloFields2">
<controls:ColorZone Padding="0" Margin="8">
<TextBox Watermark="Search field" Classes="solo" Margin="0">
<TextBox Watermark="Search field" Classes="solo" Theme="{StaticResource SoloTextBox}" Margin="0">
<TextBox.InnerRightContent>
<Button Width="{Binding $self.Bounds.Height}" Classes="Flat"
Foreground="{DynamicResource MaterialDesignCardBackground}">
@@ -307,7 +307,7 @@
</controls:ColorZone>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SoloFields3">
<TextBox BorderBrush="{Binding $self.Foreground}" BorderThickness="1" Classes="solo"
<TextBox BorderBrush="{Binding $self.Foreground}" BorderThickness="1" Classes="solo" Theme="{StaticResource SoloTextBox}"
Watermark="Search field"
CornerRadius="32" Margin="8">
<TextBox.InnerLeftContent>
@@ -319,7 +319,7 @@
</TextBox>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="SoloFields4">
<TextBox BorderBrush="Black" Margin="8" BorderThickness="1" Classes="solo"
<TextBox BorderBrush="Black" Margin="8" BorderThickness="1" Classes="solo" Theme="{StaticResource SoloTextBox}"
Watermark="No container but use border instead" />
</showMeTheXaml:XamlDisplay>
</StackPanel>
+6 -5
View File
@@ -26,16 +26,17 @@
<StackPanel.Styles>
<Style Selector="Button">
<Setter Property="Margin" Value="4" />
<Setter Property="Theme" Value="{StaticResource FlatButton}"/>
</Style>
</StackPanel.Styles>
<WrapPanel HorizontalAlignment="Center" MaxWidth="600">
<Button Classes="Flat" Content="PROJECT LINK" Command="{Binding Path=OpenProjectRepoLink}" />
<Button Classes="Flat" Content="USE DARK THEME" Command="{Binding Path=UseMaterialUIDarkTheme}" />
<Button Classes="Flat" Content="USE LIGHT THEME" Command="{Binding Path=UseMaterialUILightTheme}" />
<Button Content="PROJECT LINK" Command="{Binding Path=OpenProjectRepoLink}" />
<Button Content="USE DARK THEME" Command="{Binding Path=UseMaterialUIDarkTheme}" />
<Button Content="USE LIGHT THEME" Command="{Binding Path=UseMaterialUILightTheme}" />
</WrapPanel>
<WrapPanel HorizontalAlignment="Center" MaxWidth="600">
<Button Classes="Flat" Content="SWITCH TRANSITIONS" Command="{Binding Path=SwitchTransition}" />
<Button Classes="Flat" Content="ABOUT AVALONIAUI" Command="{Binding Path=ShowAboutAvaloniaUI}" />
<Button Content="SWITCH TRANSITIONS" Command="{Binding Path=SwitchTransition}" />
<Button Content="ABOUT AVALONIAUI" Command="{Binding Path=ShowAboutAvaloniaUI}" />
</WrapPanel>
</StackPanel>
<!-- Features listing is disabled. -->
+21 -4
View File
@@ -1,4 +1,6 @@
using Avalonia.Controls;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Dialogs;
using Avalonia.Markup.Xaml;
using Material.Dialog;
@@ -8,6 +10,8 @@ namespace Material.Demo.Pages
{
public class Home : UserControl
{
private MainWindow? _window;
public Home()
{
// Sadly I don't have much time to update this listing
@@ -51,6 +55,19 @@ namespace Material.Demo.Pages
DataContext = this;
}
protected override void OnInitialized()
{
if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime app)
return;
if(app.MainWindow is not MainWindow w)
return;
_window = w;
base.OnInitialized();
}
//public ObservableCollection<FeatureStatusModels> Features { get; private set; }
public void UseMaterialUIDarkTheme() => GlobalCommand.UseMaterialUIDarkTheme();
@@ -61,12 +78,12 @@ namespace Material.Demo.Pages
public void SwitchTransition()
{
var state = !TransitionAssist.GetDisableTransitions(Program.MainWindow);
TransitionAssist.SetDisableTransitions(Program.MainWindow, state);
var state = !TransitionAssist.GetDisableTransitions(_window!);
TransitionAssist.SetDisableTransitions(_window!, state);
DialogHelper.DisableTransitions = state;
}
public void ShowAboutAvaloniaUI() => new AboutAvaloniaDialog().ShowDialog(Program.MainWindow);
public void ShowAboutAvaloniaUI() => new AboutAvaloniaDialog().ShowDialog(_window!);
private void InitializeComponent()
{
+105 -72
View File
@@ -8,13 +8,57 @@
xmlns:demo="clr-namespace:Material.Demo"
xmlns:converters="clr-namespace:Material.Demo.Converters"
xmlns:system="clr-namespace:System;assembly=System.Runtime.Extensions"
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles"
xmlns:assists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Material.Demo.Pages.IconsDemo">
<UserControl.Resources>
<converters:StringJoinConverter x:Key="StringJoinConverter" Separator="{x:Static system:Environment.NewLine}" />
<converters:StringJoinConverter x:Key="StringJoinConverter"
Separator="{x:Static system:Environment.NewLine}" />
<RecyclingElementFactory x:Key="MaterialIconElementTemplate">
<RecyclingElementFactory.Templates>
<DataTemplate x:Key="Template" DataType="models:MaterialIconKindGroup">
<demo:SelectionWrapper DataSource="{Binding }"
CurrentSelected="{Binding Parent.SelectedGroup, Mode=TwoWay}"
ToolTip.Tip="{Binding Aliases, Converter={StaticResource StringJoinConverter}}"
Background="Transparent">
<Panel>
<Border Name="pointerOverBorder"
Background="{DynamicResource MaterialDesignBody}" />
<Border Name="selectedBorder"
Background="{DynamicResource MaterialDesignBody}" />
<Grid RowDefinitions="*, Auto" Margin="8" Height="64" Width="64">
<avalonia:MaterialIcon Grid.Row="0"
Kind="{Binding Kind}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width="32"
Height="32" />
<TextBlock Grid.Row="1" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" MaxWidth="64"
Text="{Binding Kind}"
HorizontalAlignment="Center" />
</Grid>
</Panel>
<demo:SelectionWrapper.Styles>
<Style Selector="demo|SelectionWrapper > Panel > Border#pointerOverBorder">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="demo|SelectionWrapper > Panel > Border#selectedBorder">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="demo|SelectionWrapper:pointerover > Panel > Border#pointerOverBorder">
<Setter Property="Opacity" Value="0.06" />
</Style>
<Style Selector="demo|SelectionWrapper:selected > Panel > Border#selectedBorder">
<Setter Property="Opacity" Value="0.12" />
</Style>
</demo:SelectionWrapper.Styles>
</demo:SelectionWrapper>
</DataTemplate>
</RecyclingElementFactory.Templates>
</RecyclingElementFactory>
</UserControl.Resources>
<Design.DataContext>
<viewModels:IconsDemoViewModel />
@@ -27,56 +71,20 @@
HorizontalScrollBarVisibility="Disabled">
<StackPanel VerticalAlignment="Top">
<ItemsRepeater Items="{Binding Kinds}"
HorizontalAlignment="Stretch">
ItemTemplate="{StaticResource MaterialIconElementTemplate}"
HorizontalAlignment="Stretch">
<ItemsRepeater.Layout>
<UniformGridLayout />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate DataType="models:MaterialIconKindGroup">
<demo:SelectionWrapper DataSource="{Binding .}"
CurrentSelected="{Binding $parent[UserControl].DataContext.SelectedGroup, Mode=TwoWay}"
ToolTip.Tip="{Binding Aliases, Converter={StaticResource StringJoinConverter}}"
Background="Transparent">
<Grid>
<Border Name="pointerOverBorder"
Background="{DynamicResource MaterialDesignBody}" />
<Border Name="selectedBorder"
Background="{DynamicResource MaterialDesignBody}" />
<Grid RowDefinitions="*, Auto" Margin="8" Height="64" Width="64">
<avalonia:MaterialIcon Grid.Row="0"
Kind="{Binding Kind}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Width="32"
Height="32" />
<TextBlock Grid.Row="1" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" MaxWidth="64"
Text="{Binding Kind}"
HorizontalAlignment="Center" />
</Grid>
</Grid>
<demo:SelectionWrapper.Styles>
<Style Selector="demo|SelectionWrapper Border#pointerOverBorder">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="demo|SelectionWrapper Border#selectedBorder">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="demo|SelectionWrapper:pointerover Border#pointerOverBorder">
<Setter Property="Opacity" Value="0.06" />
</Style>
<Style Selector="demo|SelectionWrapper:selectednow Border#selectedBorder">
<Setter Property="Opacity" Value="0.12" />
</Style>
</demo:SelectionWrapper.Styles>
</demo:SelectionWrapper>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</StackPanel>
</ScrollViewer>
</Panel>
<controls:ColorZone Mode="Standard" Padding="8" assists:ShadowAssist.ShadowDepth="Depth2">
<controls:ColorZone Grid.Row="0"
Mode="Standard"
Padding="8"
assists:ShadowAssist.ShadowDepth="Depth2">
<StackPanel Margin="16,8,16,0">
<TextBlock Classes="Headline4" Text="Material Icons" />
<TextBlock Classes="Subtitle1 Subheadline" TextWrapping="Wrap" Text="Material.Avalonia using Material.Icons.Avalonia and Material.Icons packages to provide icons for Material design. You can always use them freely in your application with Material.Avalonia!" />
@@ -85,44 +93,69 @@
<controls:ColorZone Grid.Row="2" Padding="8" Mode="Standard" assists:ShadowAssist.ShadowDepth="Depth2">
<Grid Margin="8" ColumnDefinitions="*,Auto,*,16,Auto">
<controls:ColorZone Mode="Inverted" CornerRadius="32" BorderBrush="Transparent"
ToolTip.Tip="Enter to search, ignore case">
<TextBox KeyDown="Search_OnKeyDown" Watermark="Search" Name="SearchBox" Classes="Solo"
Text="{Binding SearchText}" Margin="0">
<TextBox.InnerRightContent>
<Button Width="{Binding $self.Bounds.Height}"
Name="SearchButton" Foreground="{DynamicResource MaterialDesignCardBackground}"
Classes="Flat" Command="{Binding SearchCommand}"
CommandParameter="{Binding ElementName=SearchBox, Path=Text}" CornerRadius="0">
<avalonia:MaterialIcon Kind="Magnify" Width="20" Height="20"/>
</Button>
</TextBox.InnerRightContent>
</TextBox>
</controls:ColorZone>
<TextBox Grid.Column="0" Name="SearchBox" ToolTip.Tip="Enter to search, ignore case"
ClipToBounds="True"
BorderBrush="{Binding $self.Foreground}"
BorderThickness="1"
Classes="solo"
CornerRadius="32"
KeyDown="Search_OnKeyDown"
Watermark="Search"
Text="{Binding SearchText}" Margin="0">
<TextBox.InnerLeftContent>
<avalonia:MaterialIcon Kind="Magnify" Width="20" Height="20"
Margin="8,0"/>
</TextBox.InnerLeftContent>
<TextBox.InnerRightContent>
<Button Width="{Binding $self.Bounds.Height}"
Name="SearchButton" Foreground="{DynamicResource MaterialDesignCardBackground}"
Classes="flat" Command="{Binding SearchCommand}"
CommandParameter="{Binding ElementName=SearchBox, Path=Text}" CornerRadius="0">
<avalonia:MaterialIcon Kind="ArrowRightBottom" Width="20" Height="20"/>
</Button>
</TextBox.InnerRightContent>
</TextBox>
<TextBlock Grid.Column="1" Margin="16 0" Classes="Subtitle1"
VerticalAlignment="Center" Text="Usage:"/>
<controls:ColorZone Grid.Column="2" Mode="Inverted" CornerRadius="32" BorderBrush="Transparent" >
<TextBox GotFocus="TextBox_OnGotFocus" IsReadOnly="True" Classes="Solo" Margin="0"
Text="{Binding SelectedGroup.KindToCopy, FallbackValue='&lt;avalonia:MaterialIcon Kind=&quot;&quot; \/>'}">
<TextBox.InnerRightContent>
<Button Width="{Binding $self.Bounds.Height}" Foreground="{DynamicResource MaterialDesignCardBackground}"
Classes="Flat" Command="{Binding CopyToClipboardCommand, Mode=OneTime}"
CommandParameter="{Binding SelectedGroup.Kind}" CornerRadius="0">
<avalonia:MaterialIcon Kind="ContentCopy" Width="20" Height="20"/>
</Button>
</TextBox.InnerRightContent>
</TextBox>
</controls:ColorZone>
<TextBox Grid.Column="2" GotFocus="TextBox_OnGotFocus"
ClipToBounds="True"
CornerRadius="32"
IsReadOnly="True"
Classes="solo"
Margin="0"
BorderBrush="{Binding $self.Foreground}"
BorderThickness="1"
Text="{Binding SelectedGroup.KindToCopy,
FallbackValue='&lt;avalonia:MaterialIcon Kind=&quot;&quot; \/>'}">
<TextBox.InnerLeftContent>
<avalonia:MaterialIcon Kind="Xml" Width="20" Height="20"
Margin="8,0"/>
</TextBox.InnerLeftContent>
<TextBox.InnerRightContent>
<Button Width="{Binding $self.Bounds.Height}"
Foreground="{DynamicResource MaterialDesignCardBackground}"
Classes="flat" Command="{Binding CopyToClipboardCommand, Mode=OneTime}"
CommandParameter="{Binding SelectedGroup.Kind, FallbackValue='{x:Null}'}" CornerRadius="0">
<avalonia:MaterialIcon Kind="ContentCopy" Width="20" Height="20"/>
</Button>
</TextBox.InnerRightContent>
</TextBox>
<Grid Grid.Column="4" ColumnDefinitions="Auto,8,Auto" IsVisible="{Binding SelectedGroup, Converter={x:Static ObjectConverters.IsNotNull}}">
<Grid Grid.Column="4"
ColumnDefinitions="Auto,8,Auto"
IsVisible="{Binding SelectedGroup, Converter={x:Static ObjectConverters.IsNotNull}}">
<TextBlock Classes="Subtitle1"
VerticalAlignment="Center"
Text="Preview:"/>
<avalonia:MaterialIcon Grid.Column="2" Width="32" Height="32"
Kind="{Binding SelectedGroup.KindValue}" VerticalAlignment="Center" />
Kind="{Binding SelectedGroup.KindValue, FallbackValue=Help}"
VerticalAlignment="Center" />
</Grid>
</Grid>
</controls:ColorZone>
+5 -6
View File
@@ -3,7 +3,6 @@
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"
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
x:Class="Material.Demo.Pages.ListsDemo">
@@ -19,13 +18,13 @@
<showMeTheXaml:XamlDisplay UniqueId="Lists0">
<controls:Card Padding="0,4">
<ListBox Width="300">
<TextBlock Text="Item 1" />
<TextBlock Text="Item 2" />
<TextBlock Text="Item 3" />
<TextBlock Text="Item 4" />
<ListBoxItem Content="Item 1" />
<ListBoxItem Content="Item 2" />
<ListBoxItem Content="Item 3" />
<ListBoxItem Content="Item 4" />
</ListBox>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
</StackPanel>
</UserControl>
</UserControl>
+56 -14
View File
@@ -3,20 +3,14 @@
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"
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
x:Class="Material.Demo.Pages.ProgressIndicatorDemo">
<StackPanel Margin="16, 0">
<TextBlock Classes="Headline4 Subheadline" Text="Progress Indicator" />
<WrapPanel>
<StackPanel>
<StackPanel.Styles>
<Style Selector="ProgressBar">
<Setter Property="Width" Value="300" />
</Style>
</StackPanel.Styles>
<TextBlock Classes="Headline6 Subheadline2" Text="Linear progress bars" />
<StackPanel Width="200">
<TextBlock Classes="Headline6 Subheadline2" Text="Linear" HorizontalAlignment="Center" />
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicators0">
<ProgressBar Value="0" />
</showMeTheXaml:XamlDisplay>
@@ -24,18 +18,39 @@
<ProgressBar Value="30" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicators2">
<ProgressBar IsIndeterminate="True" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicators3">
<ProgressBar Value="{Binding Progress}" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicators3">
<ProgressBar Value="{Binding Progress}" ShowProgressText="True" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicators4">
<ProgressBar Value="{Binding Progress}" Classes="no-transitions" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicators5">
<ProgressBar IsIndeterminate="True" />
</showMeTheXaml:XamlDisplay>
<UniformGrid Columns="5" Height="200">
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicatorsVertical1">
<ProgressBar Orientation="Vertical" Value="30" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicatorsVertical2">
<ProgressBar Orientation="Vertical" Value="{Binding Progress}" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicatorsVertical3">
<ProgressBar Orientation="Vertical" Value="{Binding Progress}" ShowProgressText="True" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicatorsVertical4">
<ProgressBar Orientation="Vertical" Value="{Binding Progress}" Classes="no-transitions" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ProgressIndicatorsVertical5">
<ProgressBar Orientation="Vertical" IsIndeterminate="True" />
</showMeTheXaml:XamlDisplay>
</UniformGrid>
</StackPanel>
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="Circular progress bars" />
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="Circular" HorizontalAlignment="Center" />
<showMeTheXaml:XamlDisplay UniqueId="CircularProgressBar0">
<ProgressBar Classes="circular" Value="30" Margin="4" />
</showMeTheXaml:XamlDisplay>
@@ -58,6 +73,12 @@
</controls:Card>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="CircularProgressBar4">
<controls:Card CornerRadius="24" Padding="4" Margin="4" HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressBar Classes="circular" Height="100" Width="100" Value="{Binding Progress}" />
</controls:Card>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="CircularProgressBar5">
<controls:Card CornerRadius="24" Padding="4" Margin="4" HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
@@ -65,6 +86,27 @@
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="With progress" HorizontalAlignment="Center" />
<showMeTheXaml:XamlDisplay UniqueId="CircularShowProgressTextProgressBar1">
<ProgressBar Classes="circular" Value="{Binding Progress}" ShowProgressText="True" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="CircularShowProgressTextProgressBar2">
<controls:Card CornerRadius="24" Padding="4" Margin="4" HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressBar Classes="circular" Height="100" Width="100" ShowProgressText="True"
Value="{Binding Progress}" />
</controls:Card>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="CircularShowProgressTextProgressBar3">
<controls:Card CornerRadius="24" Padding="4" Margin="4" HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<ProgressBar Classes="circular no-transitions" ShowProgressText="True" Value="{Binding Progress}" />
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
</WrapPanel>
</StackPanel>
</UserControl>
</UserControl>
+6 -18
View File
@@ -17,23 +17,10 @@
<TextBlock Classes="Headline4 Subheadline" Text="ScrollViewer" />
<WrapPanel HorizontalAlignment="Stretch">
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="ScrollViewer with classic scrollbar" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewer0">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
Classes="Classic">
<pages:Home />
</ScrollViewer>
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="ScrollViewer with modern scrollbar" />
<TextBlock Classes="Headline6 Subheadline2" Text="ScrollViewer (standard mode)" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewer1">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
@@ -42,13 +29,14 @@
</controls:Card>
</showMeTheXaml:XamlDisplay>
</StackPanel>
<StackPanel>
<TextBlock Classes="Headline6 Subheadline2" Text="ScrollViewer with mini scrollbar" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewer2">
<TextBlock Classes="Headline6 Subheadline2" Text="ScrollViewer (No auto-hide mode)" />
<showMeTheXaml:XamlDisplay UniqueId="ScrollViewer0">
<controls:Card Width="400" Height="300" VerticalAlignment="Top" Padding="0">
<ScrollViewer HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
Classes="MiniBar">
Classes="classic no-auto-hide">
<pages:Home />
</ScrollViewer>
</controls:Card>
+30 -28
View File
@@ -8,8 +8,9 @@
<StackPanel Margin="0, 0" >
<StackPanel.Styles>
<Style Selector="StackPanel.Content Slider" >
<Setter Property="Maximum" Value="100" />
<Setter Property="Minimum" Value="0" />
<!-- BUG: Cannot set direct property * in * because the style has an activator -->
<!-- <Setter Property="Maximum" Value="100" /> -->
<!-- <Setter Property="Minimum" Value="0" /> -->
</Style>
<Style Selector="StackPanel.Content Slider:horizontal" >
<Setter Property="Width" Value="300" />
@@ -17,7 +18,8 @@
<Style Selector="StackPanel.Content > TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="16,0" />
<Setter Property="Text" Value="{Binding $parent.Children[0].Content.Value}" />
<!-- BUG: Cannot set direct property * in * because the style has an activator -->
<!-- <Setter Property="Text" Value="{Binding $parent.Children[0].Content.Value}" /> -->
</Style>
<Style Selector="StackPanel.Content">
<Setter Property="Margin" Value="4 2" />
@@ -32,30 +34,30 @@
when dragging thumb could contains a long numerics with decimal point. -->
<StackPanel Classes="Content" Orientation="Horizontal">
<showMeTheXaml:XamlDisplay UniqueId="RegularSlider0">
<Slider Classes="material-v1" ToolTip.Tip="Just show me my tooltip!" />
<Slider Theme="{StaticResource MaterialSliderV1}" ToolTip.Tip="Just show me my tooltip!" />
</showMeTheXaml:XamlDisplay>
<TextBlock MinWidth="120" />
</StackPanel>
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="RegularSlider1" >
<Slider Classes="material-v1"
IsSnapToTickEnabled="True"
TickFrequency="1" />
<Slider Theme="{StaticResource MaterialSliderV1}"
IsSnapToTickEnabled="True"
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
</StackPanel>
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="RegularSlider2" >
<Slider Classes="material-v1 Accent"
IsSnapToTickEnabled="True"
TickFrequency="1" />
<Slider Theme="{StaticResource MaterialSliderV1}" Classes="Accent"
IsSnapToTickEnabled="True"
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
</StackPanel>
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="RegularSlider3" >
<Slider Classes="material-v1 Accent"
IsEnabled="False" Value="20" />
<Slider Theme="{StaticResource MaterialSliderV1}" Classes="Accent"
IsEnabled="False" Value="20" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
</StackPanel>
@@ -65,7 +67,6 @@
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="ModernSlider0" >
<Slider IsSnapToTickEnabled="True"
Classes=""
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
@@ -73,7 +74,7 @@
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="ModernSlider1" >
<Slider IsSnapToTickEnabled="True"
Classes=" Accent"
Classes="Accent"
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
@@ -81,7 +82,7 @@
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="ModernSlider2" >
<Slider IsSnapToTickEnabled="True"
Classes=" Ticks"
Classes="Ticks"
TickFrequency="10" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
@@ -90,7 +91,7 @@
<showMeTheXaml:XamlDisplay UniqueId="ModernSlider3" >
<Slider IsEnabled="False" Value="20"
IsSnapToTickEnabled="True"
Classes=" Ticks"
Classes="Ticks"
TickFrequency="10" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
@@ -101,7 +102,8 @@
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="BubbleSlider0" >
<Slider IsSnapToTickEnabled="True"
Classes="material-v1 Discrete"
Theme="{StaticResource MaterialSliderV1}"
Classes="Discrete"
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
@@ -148,30 +150,30 @@
<StackPanel Orientation="Horizontal" >
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="RegularVSlider0" >
<Slider Classes="material-v1" />
<Slider Theme="{StaticResource MaterialSliderV1}" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
</StackPanel>
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="RegularVSlider1" >
<Slider Classes="material-v1"
IsSnapToTickEnabled="True"
TickFrequency="1" />
<Slider Theme="{StaticResource MaterialSliderV1}"
IsSnapToTickEnabled="True"
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
</StackPanel>
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="RegularVSlider2" >
<Slider Classes="material-v1 Accent"
IsSnapToTickEnabled="True"
TickFrequency="1" />
<Slider Theme="{StaticResource MaterialSliderV1}" Classes="Accent"
IsSnapToTickEnabled="True"
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
</StackPanel>
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="RegularVSlider3" >
<Slider Classes="material-v1 Accent"
IsEnabled="False" Value="20" />
<Slider Theme="{StaticResource MaterialSliderV1}" Classes="Accent"
IsEnabled="False" Value="20" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
</StackPanel>
@@ -223,7 +225,7 @@
<StackPanel Classes="Content" Orientation="Horizontal" >
<showMeTheXaml:XamlDisplay UniqueId="BubbleVSlider0" >
<Slider IsSnapToTickEnabled="True"
Classes="material-v1 Discrete"
Theme="{StaticResource MaterialSliderV1}" Classes="Discrete"
TickFrequency="1" />
</showMeTheXaml:XamlDisplay>
<TextBlock />
@@ -256,4 +258,4 @@
</StackPanel>
</WrapPanel>
</StackPanel>
</UserControl>
</UserControl>
+45 -36
View File
@@ -3,7 +3,6 @@
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="600"
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles"
xmlns:assist="clr-namespace:Material.Styles.Assists;assembly=Material.Styles"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
@@ -29,7 +28,7 @@
<ToggleSwitch Content="You can't switch me!" IsEnabled="False" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="RegularToggles3">
<ToggleSwitch Content="Accent color" IsChecked="True" Classes="Accent" />
<ToggleSwitch Content="Accent color" IsChecked="True" Classes="accent" />
</showMeTheXaml:XamlDisplay>
</StackPanel>
@@ -77,10 +76,10 @@
</Style>
</StackPanel.Styles>
<showMeTheXaml:XamlDisplay UniqueId="Checkboxes3">
<CheckBox Content="This is checkbox!" Classes="Accent" />
<CheckBox Content="This is checkbox!" Classes="accent" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="Checkboxes4">
<CheckBox Content="This is checkbox!" Classes="Accent" IsChecked="True"
<CheckBox Content="This is checkbox!" Classes="accent" IsChecked="True"
assist:SelectionControlAssist.Size="24" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="Checkboxes5">
@@ -112,13 +111,13 @@
</Style>
</StackPanel.Styles>
<showMeTheXaml:XamlDisplay UniqueId="RadioButtons3">
<RadioButton Classes="Accent" GroupName="2" Content="This is radiobutton!" />
<RadioButton Classes="accent" GroupName="2" Content="This is radiobutton!" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="RadioButtons4">
<RadioButton Classes="Accent" GroupName="2" Content="This is radiobutton!" IsChecked="True" />
<RadioButton Classes="accent" GroupName="2" Content="This is radiobutton!" IsChecked="True" />
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="RadioButtons5">
<RadioButton Classes="Accent" GroupName="2" Content="Uncheckable" IsChecked="False" IsEnabled="False" />
<RadioButton Classes="accent" GroupName="2" Content="Uncheckable" IsChecked="False" IsEnabled="False" />
</showMeTheXaml:XamlDisplay>
</StackPanel>
@@ -126,13 +125,13 @@
<TextBlock Classes="Headline6 Subheadline2" Text="RadioButton (button-like)" />
<StackPanel Orientation="Horizontal">
<StackPanel.Styles>
<Style Selector="RadioButton.Button">
<Style Selector="RadioButton">
<Setter Property="ToolTip.Tip"
Value='RadioButton with "Button" classes in StackPanel container with Card widget' />
Value='RadioButton with "RadioButton" theme in StackPanel container with Card widget' />
</Style>
<Style Selector="RadioButton.Button.Accent">
<Style Selector="RadioButton.accent">
<Setter Property="ToolTip.Tip"
Value='RadioButton with "Button" and "Accent" classes in StackPanel container with Card widget' />
Value='RadioButton with "RadioButton" theme and "Accent" class in StackPanel container with Card widget' />
</Style>
<Style Selector="avalonia|MaterialIcon">
<Setter Property="Width" Value="24" />
@@ -142,32 +141,42 @@
<StackPanel Orientation="Vertical">
<showMeTheXaml:XamlDisplay UniqueId="RadioButtonsCard0">
<controls:Card Padding="0" InsideClipping="True">
<StackPanel Orientation="Horizontal">
<RadioButton Classes="Button" GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignLeft}" />
<RadioButton Classes="Button" GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignCenter}"
IsChecked="True" />
<RadioButton Classes="Button" GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignRight}"
IsEnabled="False" />
<RadioButton Classes="Button" GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignJustify}" />
<controls:Card.Styles>
<Style Selector="RadioButton">
<Setter Property="Theme" Value="{StaticResource RadioButton}" />
</Style>
</controls:Card.Styles>
<StackPanel Orientation="Horizontal">
<RadioButton GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignLeft}" />
<RadioButton GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignCenter}"
IsChecked="True" />
<RadioButton GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignRight}"
IsEnabled="False" />
<RadioButton GroupName="3"
Content="{avalonia:MaterialIconExt Kind=FormatAlignJustify}" />
</StackPanel>
</controls:Card>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="RadioButtonsCard1">
<controls:Card Padding="0" InsideClipping="True" Margin="0,16,0,0">
<StackPanel Orientation="Horizontal">
<RadioButton Classes="Button Accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignLeft}" />
<RadioButton Classes="Button Accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignCenter}" IsChecked="True" />
<RadioButton Classes="Button Accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignRight}" IsEnabled="False" />
<RadioButton Classes="Button Accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignJustify}" />
<controls:Card.Styles>
<Style Selector="RadioButton">
<Setter Property="Theme" Value="{StaticResource RadioButton}" />
</Style>
</controls:Card.Styles>
<StackPanel Orientation="Horizontal">
<RadioButton Classes="accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignLeft}" />
<RadioButton Classes="accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignCenter}" IsChecked="True" />
<RadioButton Classes="accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignRight}" IsEnabled="False" />
<RadioButton Classes="accent" GroupName="4"
Content="{avalonia:MaterialIconExt Kind=FormatAlignJustify}" />
</StackPanel>
</controls:Card>
</showMeTheXaml:XamlDisplay>
@@ -190,21 +199,21 @@
<showMeTheXaml:XamlDisplay UniqueId="ToggleButtons3">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Margin="0 0 8 0">Icon:</TextBlock>
<TextBlock VerticalAlignment="Center" Margin="0 0 8 0" Text="Icon:"/>
<ToggleButton Classes="Icon">
<avalonia:MaterialIcon Kind="Globe"></avalonia:MaterialIcon>
<avalonia:MaterialIcon Kind="Globe" />
</ToggleButton>
</StackPanel>
</showMeTheXaml:XamlDisplay>
<showMeTheXaml:XamlDisplay UniqueId="ToggleButtons4">
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Margin="0 0 8 0">Icon NoFeedback:</TextBlock>
<TextBlock VerticalAlignment="Center" Margin="0 0 8 0" Text="Icon NoFeedback:"/>
<ToggleButton Classes="Icon NoFeedback">
<avalonia:MaterialIcon Kind="Globe"></avalonia:MaterialIcon>
<avalonia:MaterialIcon Kind="Globe" />
</ToggleButton>
</StackPanel>
</showMeTheXaml:XamlDisplay>
</StackPanel>
</StackPanel>
</UserControl>
</UserControl>
+3 -3
View File
@@ -3,7 +3,6 @@
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"
xmlns:styles="clr-namespace:Material.Styles;assembly=Material.Styles"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
x:Class="Material.Demo.Pages.TreeViewsDemo">
@@ -30,7 +29,7 @@
<TreeViewItem>
<TreeViewItem.Header>
<Grid ColumnDefinitions="Auto, 8, *">
<avalonia:MaterialIcon Kind="DesktopMac" />
<avalonia:MaterialIcon Kind="AppleFinder" />
<TextBlock Text="Apple MacOS" Grid.Column="2" />
</Grid>
</TreeViewItem.Header>
@@ -127,4 +126,5 @@
</controls:Card>
</WrapPanel>
</StackPanel>
</UserControl>
</UserControl>
+9 -29
View File
@@ -1,50 +1,30 @@
using System;
using Avalonia;
using Avalonia.Controls;
using ShowMeTheXaml;
namespace Material.Demo
{
internal class Program
{
public static MainWindow MainWindow { get; private set; }
namespace Material.Demo {
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.
// STA thread is required for IME system.
[STAThread]
public static void Main(string[] args)
{
BuildAvaloniaApp().Start(AppMain, args);
public static void Main(string[] args) {
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); //Start(AppMain, args);
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
{
public static AppBuilder BuildAvaloniaApp() {
return AppBuilder.Configure<App>()
.LogToTrace()
.UsePlatformDetect()
.With(new X11PlatformOptions
{
.With(new X11PlatformOptions {
EnableMultiTouch = true,
UseDBusMenu = true,
EnableIme = true
})
.With(new Win32PlatformOptions
{
EnableMultitouch = true
})
.UseXamlDisplay()
.LogToTrace();
}
// Your application's entry point. Here you can initialize your MVVM framework, DI
// container, etc.
private static void AppMain(Application app, string[] args)
{
MainWindow = new MainWindow();
app.Run(MainWindow);
.UseXamlDisplay();
}
}
}
}
+4 -4
View File
@@ -5,7 +5,7 @@ using Avalonia.Controls.Metadata;
namespace Material.Demo
{
[PseudoClasses("selectednow")]
[PseudoClasses("selected")]
public class SelectionWrapper : UserControl
{
static SelectionWrapper()
@@ -32,11 +32,11 @@ namespace Material.Demo
{
if (args.NewValue.Value)
{
selectionWrapper.PseudoClasses.Add(":selectednow");
selectionWrapper.PseudoClasses.Add(":selected");
}
else
{
selectionWrapper.PseudoClasses.Remove(":selectednow");
selectionWrapper.PseudoClasses.Remove(":selected");
}
}
});
@@ -50,7 +50,7 @@ namespace Material.Demo
public void UpdateSelectedNow()
{
SelectedNow = DataSource != null && DataSource == CurrentSelected;
SelectedNow = DataSource == CurrentSelected;
}
public static readonly StyledProperty<object> DataSourceProperty =
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using Material.Dialog;
@@ -13,11 +14,20 @@ namespace Material.Demo.ViewModels
{
private TimeSpan _previousTimePickerResult = TimeSpan.Zero;
private DateTime _previousDatePickerResult = DateTime.Now;
private readonly MainWindow? _window;
public DialogDemoItemViewModel[] StandaloneDialogItems { get; }
public DialogDemoViewModel()
{
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime app)
{
if(app.MainWindow is not MainWindow w)
return;
_window = w;
}
StandaloneDialogItems = new[]
{
new DialogDemoItemViewModel("Simple Dialog", Dialog1),
@@ -39,7 +49,7 @@ namespace Material.Demo.ViewModels
SupportingText = "Enjoy Material Design in AvaloniaUI!",
StartupLocation = WindowStartupLocation.CenterOwner
});
var result = await dialog.ShowDialog(Program.MainWindow);
var result = await dialog.ShowDialog(_window);
yield return $"Result: {result.GetResult}";
}
@@ -65,7 +75,7 @@ namespace Material.Demo.ViewModels
Result = "delete"
}
}
}).ShowDialog(Program.MainWindow);
}).ShowDialog(_window);
yield return $"Result: {result.GetResult}";
}
@@ -92,7 +102,7 @@ namespace Material.Demo.ViewModels
Result = "delete"
}
}
}).ShowDialog(Program.MainWindow);
}).ShowDialog(_window);
yield return $"Result: {result.GetResult}";
@@ -105,7 +115,7 @@ namespace Material.Demo.ViewModels
StartupLocation = WindowStartupLocation.CenterOwner,
DialogHeaderIcon = Dialog.Icons.DialogIconKind.Success,
Borderless = true,
}).ShowDialog(Program.MainWindow);
}).ShowDialog(_window);
}
}
@@ -134,7 +144,7 @@ namespace Material.Demo.ViewModels
}
}
});
var result = await dialog.ShowDialog(Program.MainWindow);
var result = await dialog.ShowDialog(_window);
yield return $"Result: {result.GetResult}";
}
@@ -184,7 +194,7 @@ namespace Material.Demo.ViewModels
IsPositive = true
}
}
}).ShowDialog(Program.MainWindow);
}).ShowDialog(_window);
yield return $"Result: {result.GetResult}";
@@ -242,7 +252,7 @@ namespace Material.Demo.ViewModels
IsPositive = true
}
},
}).ShowDialog(Program.MainWindow);
}).ShowDialog(_window);
yield return $"Result: {result.GetResult}";
@@ -268,7 +278,7 @@ namespace Material.Demo.ViewModels
IsPositive = true
}
}
}).ShowDialog(Program.MainWindow);
}).ShowDialog(_window);
yield return $"Result: {result.GetResult}";
@@ -296,7 +306,7 @@ namespace Material.Demo.ViewModels
IsPositive = true
}
}
}).ShowDialog(Program.MainWindow);
}).ShowDialog(_window);
yield return $"Result: {result.GetResult}";
+33 -21
View File
@@ -1,9 +1,10 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Threading;
using Material.Demo.Models;
using Material.Icons;
@@ -12,7 +13,7 @@ namespace Material.Demo.ViewModels
public class IconsDemoViewModel : ViewModelBase
{
private IEnumerable<MaterialIconKindGroup>? _kinds;
private Lazy<List<MaterialIconKindGroup>> _materialIconKinds;
private readonly Lazy<List<MaterialIconKindGroup>> _materialIconKinds;
private MaterialIconKindGroup? _selectedGroup;
private string? _searchText;
@@ -21,23 +22,14 @@ namespace Material.Demo.ViewModels
_materialIconKinds = new Lazy<List<MaterialIconKindGroup>>(() =>
Enum.GetNames(typeof(MaterialIconKind))
.GroupBy(k => (MaterialIconKind) Enum.Parse(typeof(MaterialIconKind), k))
.Select(g => new MaterialIconKindGroup(g))
.Select(g => new MaterialIconKindGroup(this, g))
.OrderBy(x => x.Kind)
.ToList());
SearchCommand = new RelayCommand(async o =>
{
if (string.IsNullOrWhiteSpace(SearchText))
Kinds = _materialIconKinds.Value;
else
{
Kinds = new List<MaterialIconKindGroup>();
Kinds = await Task.Run(() =>
_materialIconKinds.Value
.Where(x => x.Aliases.Any(a =>
a.IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) >= 0))
.ToList());
}
});
CopyToClipboardCommand = new RelayCommand(o =>
Application.Current?.Clipboard?.SetTextAsync($"<avalonia:MaterialIcon Kind=\"{o}\" />"));
SearchCommand = new RelayCommand(DoSearchAsync);
}
public IEnumerable<MaterialIconKindGroup> Kinds
@@ -70,10 +62,30 @@ namespace Material.Demo.ViewModels
}
}
public RelayCommand SearchCommand { get; set; }
public RelayCommand SearchCommand { get; }
public RelayCommand CopyToClipboardCommand { get; set; } =
new RelayCommand(o =>
Application.Current.Clipboard.SetTextAsync($"<avalonia:MaterialIcon Kind=\"{o}\" />"));
public RelayCommand CopyToClipboardCommand { get; }
private async void DoSearchAsync(object args)
{
if (string.IsNullOrWhiteSpace(SearchText))
Kinds = _materialIconKinds.Value;
else
{
var list = new ObservableCollection<MaterialIconKindGroup>();
Kinds = list;
foreach (var data in _materialIconKinds.Value
.Where(x => x.Aliases
.Any(a => a.Contains(SearchText, StringComparison.CurrentCultureIgnoreCase))))
{
await Dispatcher.UIThread.InvokeAsync(delegate
{
list.Add(data);
});
}
}
}
}
}
+32 -46
View File
@@ -2,82 +2,68 @@
using Avalonia.Controls.Primitives;
using Avalonia.Media;
namespace Material.Dialog.Icons
{
public class DialogIcon : TemplatedControl
{
static DialogIcon()
{
}
namespace Material.Dialog.Icons {
public class DialogIcon : TemplatedControl {
public static readonly StyledProperty<DialogIconKind> KindProperty
= AvaloniaProperty.Register<DialogIcon, DialogIconKind>(nameof(Kind),
notifying: KindPropertyChangedCallback);
private static void KindPropertyChangedCallback(IAvaloniaObject sender, bool before)
{
((DialogIcon) sender).UpdateData();
((DialogIcon) sender).UpdateColor();
}
/// <summary>
/// Gets or sets the icon to display.
/// </summary>
public DialogIconKind Kind
{
get => GetValue(KindProperty);
set => SetValue(KindProperty, value);
}
public static readonly StyledProperty<StreamGeometry> DataProperty
= AvaloniaProperty.Register<DialogIcon, StreamGeometry>(nameof(Data));
/// <summary>
/// Gets the icon path data for the current <see cref="Kind"/>.
/// </summary>
public StreamGeometry Data
{
get => GetValue(DataProperty);
private set => SetValue(DataProperty, value);
}
public static readonly StyledProperty<bool> UseRecommendColorProperty
= AvaloniaProperty.Register<DialogIcon, bool>(nameof(UseRecommendColor), true,
notifying: UseRecommendColorPropertyChangedCallback);
static DialogIcon() { }
public bool UseRecommendColor
{
/// <summary>
/// Gets or sets the icon to display.
/// </summary>
public DialogIconKind Kind {
get => GetValue(KindProperty);
set => SetValue(KindProperty, value);
}
/// <summary>
/// Gets the icon path data for the current <see cref="Kind"/>.
/// </summary>
public StreamGeometry Data {
get => GetValue(DataProperty);
private set => SetValue(DataProperty, value);
}
public bool UseRecommendColor {
get => GetValue(UseRecommendColorProperty);
set => SetValue(UseRecommendColorProperty, value);
}
private static void UseRecommendColorPropertyChangedCallback(IAvaloniaObject sender, bool before)
{
((DialogIcon) sender).UpdateColor();
private static void KindPropertyChangedCallback(AvaloniaObject sender, bool before) {
((DialogIcon)sender).UpdateData();
((DialogIcon)sender).UpdateColor();
}
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
private static void UseRecommendColorPropertyChangedCallback(AvaloniaObject sender, bool before) {
((DialogIcon)sender).UpdateColor();
}
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) {
base.OnApplyTemplate(e);
UpdateData();
}
private void UpdateData()
{
private void UpdateData() {
string data = null;
DialogIconsDataFactory.DataIndex.Value?.TryGetValue(Kind, out data);
var g = StreamGeometry.Parse(data);
this.Data = g;
}
private void UpdateColor()
{
if (UseRecommendColor == true)
{
private void UpdateColor() {
if (UseRecommendColor == true) {
string color = null;
DialogIconsDataFactory.RecommendColorIndex.Value?.TryGetValue(Kind, out color);
Foreground = SolidColorBrush.Parse(color);
}
}
}
}
}
+3 -2
View File
@@ -15,8 +15,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="11.0.0-preview5"/>
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="11.0.0-preview5"/>
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview5"/>
</ItemGroup>
<ItemGroup>
+38 -51
View File
@@ -1,68 +1,72 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Material.Dialog.Interfaces;
using Material.Dialog.ViewModels;
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Presenters;
using Avalonia.Markup.Xaml;
using Avalonia.Threading;
using Material.Dialog.Interfaces;
using Material.Dialog.ViewModels;
namespace Material.Dialog.Views
{
public class TextFieldDialog : Window, IDialogWindowResult<TextFieldDialogResult>, IHasNegativeResult
{
public TextFieldDialogResult Result { get; set; }
public TextFieldDialog()
{
namespace Material.Dialog.Views {
public class TextFieldDialog : Window, IDialogWindowResult<TextFieldDialogResult>, IHasNegativeResult {
public TextFieldDialog() {
Result = new TextFieldDialogResult();
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
Closed += TextFieldDialog_Closed;
Opened += TextFieldDialog_Opened;
}
public TextFieldDialogResult Result { get; set; }
private void TextFieldDialog_Closed(object sender, EventArgs e)
{
public TextFieldDialogResult GetResult() {
if (!(DataContext is TextFieldDialogViewModel viewModel))
return null;
return viewModel.DialogResult switch {
TextFieldDialogResult vm => vm,
// ReSharper disable once ConvertTypeCheckPatternToNullCheck
DialogResult basicViewModel => new TextFieldDialogResult(basicViewModel.GetResult,
Array.Empty<TextFieldResult>()),
_ => null
};
}
public void SetNegativeResult(DialogResult result) => Result.result = result.GetResult;
private void TextFieldDialog_Closed(object sender, EventArgs e) {
Opened -= TextFieldDialog_Opened;
Closed -= TextFieldDialog_Closed;
}
private void TextFieldDialog_Opened(object sender, EventArgs e)
{
private void TextFieldDialog_Opened(object sender, EventArgs e) {
if (!(DataContext is TextFieldDialogViewModel vm))
return;
//vm.ButtonClick.RaiseCanExecute();
var fields = this.Find<ItemsControl>("PART_Fields");
Dispatcher.UIThread.InvokeAsync(delegate
{
Dispatcher.UIThread.InvokeAsync(delegate {
if (fields is null)
return;
int index = 0;
foreach (var item in fields.ItemContainerGenerator.Containers)
{
foreach (var item in fields.GetRealizedContainers()) {
var fieldViewModel = vm.TextFields[index];
if (item.ContainerControl is ContentPresenter presenter)
{
if (presenter.Child is TextBox field)
{
// TODO: Check if this works fine due to container generator changes
if (item is ContentPresenter presenter) {
if (presenter.Child is TextBox field) {
var classes = fieldViewModel.Classes;
if (classes != null)
{
foreach (var @class in classes.Split(' '))
{
if (classes != null) {
foreach (var @class in classes.Split(' ')) {
if (@class != "")
field.Classes.Add(@class);
}
@@ -75,23 +79,6 @@ namespace Material.Dialog.Views
});
}
public TextFieldDialogResult GetResult()
{
if (!(DataContext is TextFieldDialogViewModel viewModel))
return null;
return viewModel.DialogResult switch
{
TextFieldDialogResult vm => vm,
// ReSharper disable once ConvertTypeCheckPatternToNullCheck
DialogResult basicViewModel => new TextFieldDialogResult(basicViewModel.GetResult,
Array.Empty<TextFieldResult>()),
_ => null
};
}
public void SetNegativeResult(DialogResult result) => Result.result = result.GetResult;
private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
}
}
}
+2 -1
View File
@@ -9,6 +9,7 @@
<PackageProjectUrl>https://github.com/AvaloniaUtils/material.avalonia</PackageProjectUrl>
<RepositoryUrl>https://github.com/AvaloniaUtils/material.avalonia</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
@@ -23,7 +24,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="11.0.0-preview5"/>
</ItemGroup>
</Project>
+73 -13
View File
@@ -1,5 +1,6 @@
using System;
using Avalonia;
using Avalonia.Animation;
using Avalonia.Animation.Easings;
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
@@ -10,31 +11,59 @@ namespace Material.Ripple
{
public class Ripple : Ellipse
{
private static Easing _easing = new CircularEaseOut();
public static Easing Easing
{
get => _easing;
set => _easing = value;
set
{
_easing = value;
UpdateTransitions();
}
}
public static readonly TimeSpan Duration = new TimeSpan(0, 0, 0, 0, 500);
public static TimeSpan Duration
{
get => _duration;
set
{
_duration = value;
UpdateTransitions();
}
}
public static Transitions RippleTransitions;
private static Easing _easing = new CircularEaseOut();
private static TimeSpan _duration = new(0, 0, 0, 0, 500);
private double maxDiam;
private double endX, endY;
public Ripple(double outerWidth, double outerHeight)
private readonly double _maxDiam;
private readonly double _endX;
private readonly double _endY;
static Ripple()
{
UpdateTransitions();
}
public Ripple(double outerWidth, double outerHeight, bool transitions = true)
{
Width = 0;
Height = 0;
maxDiam = Math.Sqrt(Math.Pow(outerWidth, 2) + Math.Pow(outerHeight, 2));
endY = maxDiam - outerHeight;
endX = maxDiam - outerWidth;
_maxDiam = Math.Sqrt(Math.Pow(outerWidth, 2) + Math.Pow(outerHeight, 2));
_endY = _maxDiam - outerHeight;
_endX = _maxDiam - outerWidth;
HorizontalAlignment = HorizontalAlignment.Left;
VerticalAlignment = VerticalAlignment.Top;
Opacity = 1;
if (!transitions)
return;
Transitions = RippleTransitions;
}
public void SetupInitialValues(PointerPressedEventArgs e, Control parent)
@@ -45,14 +74,45 @@ namespace Material.Ripple
public void RunFirstStep()
{
Width = maxDiam;
Height = maxDiam;
Margin = new Thickness(-endX / 2, -endY / 2, 0, 0);
Width = _maxDiam;
Height = _maxDiam;
Margin = new Thickness(-_endX / 2, -_endY / 2, 0, 0);
}
public void RunSecondStep()
{
Opacity = 0;
}
private static void UpdateTransitions()
{
RippleTransitions = new Transitions
{
new ThicknessTransition
{
Duration = Duration,
Easing = Easing,
Property = MarginProperty
},
new DoubleTransition
{
Duration = Duration,
Easing = Easing,
Property = WidthProperty
},
new DoubleTransition
{
Duration = Duration,
Easing = Easing,
Property = HeightProperty
},
new DoubleTransition
{
Duration = Duration,
Easing = Easing,
Property = OpacityProperty
}
};
}
}
}
+37 -19
View File
@@ -11,11 +11,21 @@ namespace Material.Ripple
{
public class RippleEffect : ContentControl
{
public bool UseTransitions
{
get => GetValue(UseTransitionsProperty);
set => SetValue(UseTransitionsProperty, value);
}
public static readonly StyledProperty<bool> UseTransitionsProperty =
AvaloniaProperty.Register<RippleEffect, bool>(nameof(UseTransitions));
// ReSharper disable once InconsistentNaming
private Canvas PART_RippleCanvasRoot;
private Ripple _last;
private byte _pointers;
private bool _isCancelled;
public RippleEffect()
{
@@ -25,35 +35,42 @@ namespace Material.Ripple
AddHandler(PointerCaptureLostEvent, PointerCaptureLostHandler);
}
private void PointerPressedHandler(object sender, PointerPressedEventArgs e)
{
if (!IsAllowedRaiseRipple)
return;
private void PointerPressedHandler(object sender, PointerPressedEventArgs e) {
_isCancelled = false;
Dispatcher.UIThread.InvokeAsync(delegate
{
if (!IsAllowedRaiseRipple)
return;
if (_pointers != 0)
return;
if (_pointers != 0)
return;
// Only first pointer can arrive a ripple
_pointers++;
var r = CreateRipple(e, RaiseRippleCenter);
_last = r;
// Only first pointer can arrive a ripple
_pointers++;
var r = CreateRipple(e, RaiseRippleCenter);
_last = r;
// Attach ripple instance to canvas
PART_RippleCanvasRoot.Children.Add(r);
r.RunFirstStep();
// Attach ripple instance to canvas
PART_RippleCanvasRoot.Children.Add(r);
r.RunFirstStep();
if (_isCancelled) {
RemoveLastRipple();
}
}, DispatcherPriority.Composition);
}
private void LostFocusHandler(object sender, RoutedEventArgs e) {
_isCancelled = true;
RemoveLastRipple();
}
private void PointerReleasedHandler(object sender, PointerReleasedEventArgs e)
{
private void PointerReleasedHandler(object sender, PointerReleasedEventArgs e) {
_isCancelled = true;
RemoveLastRipple();
}
private void PointerCaptureLostHandler(object sender, PointerCaptureLostEventArgs e)
{
private void PointerCaptureLostHandler(object sender, PointerCaptureLostEventArgs e) {
_isCancelled = true;
RemoveLastRipple();
}
@@ -77,7 +94,7 @@ namespace Material.Ripple
void RemoveRippleTask(Task arg1, object arg2)
{
Dispatcher.UIThread.InvokeAsync(delegate { PART_RippleCanvasRoot.Children.Remove(r); });
Dispatcher.UIThread.InvokeAsync(delegate { PART_RippleCanvasRoot.Children.Remove(r); }, DispatcherPriority.Composition);
}
// Remove ripple from canvas to finalize ripple instance
@@ -96,8 +113,9 @@ namespace Material.Ripple
{
var w = Bounds.Width;
var h = Bounds.Height;
var t = UseTransitions;
var r = new Ripple(w, h)
var r = new Ripple(w, h, t)
{
Fill = RippleFill
};
+2 -9
View File
@@ -24,14 +24,7 @@
<!-- Transitions -->
<Style Selector="cc|RippleEffect:not(.no-transitions) /template/ Canvas#PART_RippleCanvasRoot > cc|Ripple">
<Setter Property="Transitions">
<Transitions>
<ThicknessTransition Property="Margin" Duration="{x:Static cc:Ripple.Duration}" Easing="{x:Static cc:Ripple.Easing}"/>
<DoubleTransition Property="Width" Duration="{x:Static cc:Ripple.Duration}" Easing="{x:Static cc:Ripple.Easing}"/>
<DoubleTransition Property="Height" Duration="{x:Static cc:Ripple.Duration}" Easing="{x:Static cc:Ripple.Easing}"/>
<DoubleTransition Property="Opacity" Duration="{x:Static cc:Ripple.Duration}" Easing="{x:Static cc:Ripple.Easing}"/>
</Transitions>
</Setter>
<Style Selector="cc|RippleEffect:not(.no-transitions)">
<Setter Property="UseTransitions" Value="True"/>
</Style>
</Styles>
+35
View File
@@ -0,0 +1,35 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Material.Ripple">
<ControlTheme x:Key="{x:Type cc:RippleEffect}"
TargetType="cc:RippleEffect">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="RippleOpacity" Value="0.6"/>
<Setter Property="RippleFill" Value="White"/>
<Setter Property="IsAllowedRaiseRipple" Value="True"/>
<Setter Property="Template">
<ControlTemplate>
<Panel ClipToBounds="True">
<ContentPresenter Name="PART_ContentPresenter"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
Padding="{TemplateBinding Padding}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
<Canvas Name="PART_RippleCanvasRoot"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False"
Opacity="{TemplateBinding RippleOpacity}"/>
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^:not(.no-transitions)">
<Setter Property="UseTransitions" Value="True"/>
</Style>
</ControlTheme>
</ResourceDictionary>
@@ -1,4 +1,5 @@
using System;
using System.Reactive.Disposables;
using System.Reactive.Subjects;
using System.Threading;
using System.Threading.Tasks;
@@ -13,23 +14,23 @@ namespace Material.Styles.Additional.Animations
/// </summary>
public class ControllableAnimationBase : AvaloniaObject, IAnimation
{
public static readonly DirectProperty<ControllableAnimationBase, Animation> AnimationProperty =
AvaloniaProperty.RegisterDirect<ControllableAnimationBase, Animation>(
public static readonly DirectProperty<ControllableAnimationBase, Animation?> AnimationProperty =
AvaloniaProperty.RegisterDirect<ControllableAnimationBase, Animation?>(
nameof(_animation),
o => o._animation,
(o, v) => o._animation = v);
private Animation _animation;
private Animation? _animation;
[Content]
public Animation Animation
public Animation? Animation
{
get => _animation;
set => SetAndRaise(AnimationProperty, ref _animation, value);
}
public virtual IDisposable Apply(Animatable control, IClock clock, IObservable<bool> match,
Action onComplete = null)
public virtual IDisposable Apply(Animatable control, IClock? clock, IObservable<bool> match,
Action? onComplete = null)
{
var previous = false;
var observable = new Subject<bool>();
@@ -38,13 +39,13 @@ namespace Material.Styles.Additional.Animations
OnNext(observable, previous, b);
previous = b;
});
return Animation.Apply(control, clock, observable, onComplete);
return Animation?.Apply(control, clock, observable, onComplete) ?? Disposable.Empty;
}
public virtual Task RunAsync(Animatable control, IClock clock,
CancellationToken cancellationToken = new CancellationToken())
CancellationToken cancellationToken = default)
{
return Animation.RunAsync(control, clock, cancellationToken);
return Animation?.RunAsync(control, clock, cancellationToken) ?? Task.CompletedTask;
}
internal virtual void OnNext(Subject<bool> match, bool previous, bool obj)
@@ -1,4 +1,5 @@
using System;
using System.Reactive.Disposables;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using Avalonia.Animation;
@@ -12,12 +13,17 @@ namespace Material.Styles.Additional.Animations
// Required WaitTillEnd == true
public TimeSpan DelayBetweenReverse { get; set; } = TimeSpan.Zero;
public override IDisposable Apply(Animatable control, IClock clock, IObservable<bool> match,
Action onComplete = null)
public override IDisposable Apply(Animatable control, IClock? clock, IObservable<bool> match,
Action? onComplete = null)
{
if(Animation is null)
return Disposable.Empty;
var reversedAnimation = new Animation
{
Delay = Animation.Delay, Duration = Animation.Duration, Easing = Animation.Easing,
Delay = Animation.Delay,
Duration = Animation.Duration,
Easing = Animation.Easing,
FillMode = Animation.FillMode,
IterationCount = new IterationCount(1), SpeedRatio = Animation.SpeedRatio
};
@@ -35,10 +41,12 @@ namespace Material.Styles.Additional.Animations
// Applying reversed animation
var reversedObserver = new Subject<bool>();
var timeOut = Task.CompletedTask;
match.Subscribe(async b =>
// TODO: fix code
match.Subscribe(async delegate(bool b)
{
if (lastValue == b) return;
if (lastValue == b)
return;
lastValue = b;
if (b)
{
+2 -2
View File
@@ -85,7 +85,7 @@ namespace Material.Styles.Assists
}
public static void SetShadowDepth(AvaloniaObject element, ShadowDepth value)
=> element.SetValue<ShadowDepth>(ShadowDepthProperty, value);
=> element.SetValue(ShadowDepthProperty, value);
public static ShadowDepth GetShadowDepth(AvaloniaObject element)
=> element.GetValue<ShadowDepth>(ShadowDepthProperty);
@@ -139,7 +139,7 @@ namespace Material.Styles.Assists
}
public static void SetDarken(AvaloniaObject element, bool value)
=> element.SetValue<bool>(DarkenProperty, value);
=> element.SetValue(DarkenProperty, value);
public static bool GetDarken(AvaloniaObject element)
=> element.GetValue<bool>(DarkenProperty);
+5 -5
View File
@@ -1,13 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
namespace Material.Styles.Assists
{
public static class TextFieldAssist
{
public static readonly AvaloniaProperty<string?> HintsProperty =
AvaloniaProperty.RegisterAttached<TextBox, string?>(
"Hints", typeof(TextBox));
AvaloniaProperty.RegisterAttached<TemplatedControl, string?>(
"Hints", typeof(TemplatedControl));
public static void SetHints(AvaloniaObject element, string? value) =>
element.SetValue(HintsProperty, value);
@@ -16,8 +16,8 @@ namespace Material.Styles.Assists
element.GetValue<string?>(HintsProperty);
public static readonly AvaloniaProperty<string?> LabelProperty =
AvaloniaProperty.RegisterAttached<TextBox, string?>(
"Label", typeof(TextBox));
AvaloniaProperty.RegisterAttached<TemplatedControl, string?>(
"Label", typeof(TemplatedControl));
public static void SetLabel(AvaloniaObject element, string? value) =>
element.SetValue(LabelProperty, value);
+2 -2
View File
@@ -13,8 +13,8 @@
<Setter Property="HeaderBackground" Value="Transparent" />
<Setter Property="Template">
<ControlTemplate>
<Panel Name="Root" ClipToBounds="True">
<CalendarItem Name="CalendarItem"
<Panel Name="PART_Root" ClipToBounds="True">
<CalendarItem Name="PART_CalendarItem"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
+5 -5
View File
@@ -31,12 +31,12 @@
<Grid Name="CalendarHeader"
Margin="8,16,8,12"
ColumnDefinitions="*, 24, Auto, 24, Auto">
<Button Name="HeaderButton"
<Button Name="PART_HeaderButton"
Grid.Column="0"
IsEnabled="False"
Classes="material-calendar-header-button flat" />
<Button Name="PreviousButton"
<Button Name="PART_PreviousButton"
Grid.Column="2"
Classes="material-calendar-nav-button flat">
<Button.Content>
@@ -44,7 +44,7 @@
</Button.Content>
</Button>
<Button Name="NextButton"
<Button Name="PART_NextButton"
Grid.Column="4"
Classes="material-calendar-nav-button flat">
<Button.Content>
@@ -53,7 +53,7 @@
</Button>
</Grid>
<Grid Name="MonthView"
<Grid Name="PART_MonthView"
Grid.Row="1"
Classes="material-calendar-view"
MinHeight="200"
@@ -61,7 +61,7 @@
ColumnDefinitions="32,32,32,32,32,32,32">
</Grid>
<Grid Name="YearView"
<Grid Name="PART_YearView"
Grid.Row="1"
Classes="material-calendar-view"
MinHeight="290"
+11 -11
View File
@@ -1,16 +1,16 @@
<Style xmlns="https://github.com/avaloniaui" Selector="Carousel">
<Setter Property="Template">
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<CarouselPresenter IsVirtualized="{TemplateBinding IsVirtualized}"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
Margin="{TemplateBinding Padding}"
SelectedIndex="{TemplateBinding SelectedIndex}"
PageTransition="{TemplateBinding PageTransition}" />
</Border>
<ScrollViewer Name="PART_ScrollViewer"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsPresenter Name="PART_ItemsPresenter"
ItemsPanel="{TemplateBinding ItemsPanel}"
Margin="{TemplateBinding Padding}" />
</ScrollViewer>
</ControlTemplate>
</Setter>
</Style>
</Style>
+7 -78
View File
@@ -71,79 +71,14 @@
MaxHeight="{TemplateBinding MaxDropDownHeight}"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}">
<ScrollViewer Name="{x:Static naming:PartNames.PartScrollViewer}">
<ItemsPresenter Name="{x:Static naming:PartNames.PartItemsPresenter}"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
<ItemsPresenter Name="{x:Static naming:PartNames.PartItemsPresenter}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</controls:Card>
</Popup>
</Panel>
</Panel>
</Border>
<!-- deprecated style
<Grid Name="templateRoot"
Background="{TemplateBinding Background}"
ClipToBounds="False">
<Grid ColumnDefinitions="*,Auto" ClipToBounds="False">
<ToggleButton Name="toggle"
Classes="ComboBoxToggleButton"
BorderThickness="0"
Background="Transparent"
Focusable="False"
BorderBrush="{DynamicResource MaterialDesignTextBoxBorder}"
IsChecked="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
Grid.ColumnSpan="2" />
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"
UseLayoutRounding="{TemplateBinding UseLayoutRounding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Name="InputRoot"
HorizontalAlignment="Stretch">
<TextBlock Name="placeholderText" Text="{TemplateBinding PlaceholderText}"
TextAlignment="Left" FontFamily="{TemplateBinding FontFamily}" Margin="0,4" />
<ContentPresenter Name="contentPresenter"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding ItemTemplate}"
HorizontalContentAlignment="Left"
Margin="0, 4" />
</Grid>
</Grid>
<Popup Name="PART_Popup"
IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
VerticalOffset="0"
Margin="-8"
WindowManagerAddShadowHint="False"
PlacementTarget="{Binding ElementName=templateRoot}"
IsLightDismissEnabled="True"
UseLayoutRounding="True"
ClipToBounds="False">
<cc:Card assists:ShadowAssist.ShadowDepth="Depth1"
Margin="4,0,4,4"
CornerRadius="0,0,4,4"
Padding="0">
<ScrollViewer Background="{Binding Background, ElementName=PART_Popup}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
MinHeight="1">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
</ScrollViewer>
</cc:Card>
</Popup>
</Grid>
</Grid>
-->
</ControlTemplate>
</Setter>
</Style>
@@ -348,11 +283,8 @@
<ScrollViewer Background="{Binding Background, ElementName=PART_Popup}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
MinHeight="1">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
<ItemsPresenter Name="PART_ItemsPresenter"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</controls:Card>
</Popup>
@@ -448,11 +380,8 @@
<ScrollViewer Background="{Binding Background, ElementName=PART_Popup}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
MinHeight="1">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
<ItemsPresenter Name="PART_ItemsPresenter"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</controls:Card>
</Popup>
@@ -516,4 +445,4 @@
</StackPanel>
</Border>
</Design.PreviewWith>
</Styles>
</Styles>
@@ -0,0 +1,39 @@
using System;
using System.Windows.Input;
using Material.Styles.Controls;
using Material.Styles.Models;
namespace Material.Styles.Commands
{
/// <summary>
/// This class used for snackbar button.
/// </summary>
internal class SnackbarCommand : ICommand
{
private readonly SnackbarHost _host;
private readonly SnackbarModel _model;
public SnackbarCommand(SnackbarHost host, SnackbarModel model)
{
_host = host;
_model = model;
}
public bool CanExecute(object parameter) => true;
public void Execute(object parameter)
{
try
{
_model.Button?.Action?.Invoke();
_host.SnackbarModels.Remove(_model);
}
catch
{
// ignored
}
}
public event EventHandler? CanExecuteChanged;
}
}
+3 -5
View File
@@ -20,10 +20,8 @@
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Name="{x:Static naming:PartNames.PartScrollViewer}">
<ItemsPresenter Name="{x:Static naming:PartNames.PartItemsPresenter}"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"/>
<ItemsPresenter Name="{x:Static naming:PartNames.PartItemsPresenter}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</Border>
</ControlTemplate>
@@ -48,4 +46,4 @@
<Style Selector="ContextMenu /template/ ItemsPresenter#PART_ItemsPresenter" >
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue" />
</Style>
</Styles>
</Styles>
+29 -51
View File
@@ -7,10 +7,8 @@ using Avalonia.Media;
using Avalonia.Threading;
using Material.Styles.Themes;
namespace Material.Styles.Controls
{
public enum ColorZoneMode
{
namespace Material.Styles.Controls {
public enum ColorZoneMode {
Standard,
Inverted,
PrimaryLight,
@@ -22,26 +20,22 @@ namespace Material.Styles.Controls
Custom
}
public class ColorZone : ContentControl
{
public class ColorZone : ContentControl {
public static readonly StyledProperty<ColorZoneMode> ModeProperty =
AvaloniaProperty.Register<ColorZone, ColorZoneMode>(nameof(Mode));
public ColorZoneMode Mode
{
private IDisposable? _subscription;
static ColorZone() {
ModeProperty.Changed.Subscribe(OnNext);
}
public ColorZoneMode Mode {
get => GetValue(ModeProperty);
set => SetValue(ModeProperty, value);
}
private IDisposable? _subscription;
static ColorZone()
{
ModeProperty.Changed.Subscribe(OnNext);
}
private static void OnNext(AvaloniaPropertyChangedEventArgs<ColorZoneMode> arg)
{
private static void OnNext(AvaloniaPropertyChangedEventArgs<ColorZoneMode> arg) {
if (arg.Sender is not ColorZone control)
return;
@@ -49,8 +43,7 @@ namespace Material.Styles.Controls
control.OnThemeChanged(resources);
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) {
OnModeChanged(null);
DisposeSubscription();
@@ -61,26 +54,22 @@ namespace Material.Styles.Controls
base.OnAttachedToVisualTree(e);
}
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) {
DisposeSubscription();
base.OnDetachedFromVisualTree(e);
}
private void DisposeSubscription()
{
private void DisposeSubscription() {
_subscription?.Dispose();
_subscription = null;
}
private void OnThemeChanged(MaterialThemeBase theme)
{
private void OnThemeChanged(MaterialThemeBase theme) {
Dispatcher.UIThread.InvokeAsync(delegate { OnModeChanged(theme); });
}
private void OnModeChanged(MaterialThemeBase? theme)
{
private void OnModeChanged(MaterialThemeBase? theme) {
var colorZone = this;
theme ??= Application.Current!.LocateMaterialTheme<MaterialTheme>();
@@ -88,59 +77,50 @@ namespace Material.Styles.Controls
var foregroundProperty = TemplatedControl.ForegroundProperty;
switch (colorZone.Mode)
{
case ColorZoneMode.Standard:
{
switch (colorZone.Mode) {
case ColorZoneMode.Standard: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "MaterialDesignPaper"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "MaterialDesignBody"));
}
break;
case ColorZoneMode.Inverted:
{
case ColorZoneMode.Inverted: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "MaterialDesignBody"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "MaterialDesignPaper"));
}
break;
case ColorZoneMode.Light:
{
case ColorZoneMode.Light: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "MaterialDesignLightBackground"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "MaterialDesignLightForeground"));
}
break;
case ColorZoneMode.Dark:
{
case ColorZoneMode.Dark: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "MaterialDesignDarkBackground"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "MaterialDesignDarkForeground"));
}
break;
case ColorZoneMode.PrimaryLight:
{
case ColorZoneMode.PrimaryLight: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "PrimaryHueLightBrush"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "PrimaryHueLightForegroundBrush"));
}
break;
case ColorZoneMode.PrimaryMid:
{
case ColorZoneMode.PrimaryMid: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "PrimaryHueMidBrush"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "PrimaryHueMidForegroundBrush"));
}
break;
case ColorZoneMode.PrimaryDark:
{
case ColorZoneMode.PrimaryDark: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "PrimaryHueDarkBrush"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "PrimaryHueDarkForegroundBrush"));
}
break;
case ColorZoneMode.Accent:
{
case ColorZoneMode.Accent: {
SetValueInternal(BackgroundProperty, GetBrushResource(resources, "SecondaryHueMidBrush"));
SetValueInternal(foregroundProperty, GetBrushResource(resources, "SecondaryHueMidForegroundBrush"));
}
@@ -154,14 +134,12 @@ namespace Material.Styles.Controls
}
}
private void SetValueInternal(AvaloniaProperty property, object? value)
{
private void SetValueInternal(AvaloniaProperty property, object? value) {
SetValue(property, value, BindingPriority.Style);
}
private static IBrush? GetBrushResource(IResourceNode theme, string name)
{
if (!theme.TryGetResource(name, out var resource))
private static IBrush? GetBrushResource(IResourceNode theme, string name) {
if (!theme.TryGetResource(name, null, out var resource))
return null;
if (resource is IBrush brush)
@@ -170,4 +148,4 @@ namespace Material.Styles.Controls
return null;
}
}
}
}
@@ -20,7 +20,7 @@ namespace Material.Styles.Controls.Extensions
Size = size;
}
[ConstructorArgument("kind")] public string Kind { get; set; }
[ConstructorArgument("kind")] public string? Kind { get; set; }
[ConstructorArgument("size")] public double? Size { get; set; }
@@ -28,14 +28,14 @@ namespace Material.Styles.Controls.Extensions
{
var result = new MaterialInternalIcon
{
Kind = Kind
Kind = Kind ?? string.Empty
};
if (Size.HasValue)
{
result.Height = Size.Value;
result.Width = Size.Value;
}
if (!Size.HasValue)
return result;
result.Height = Size.Value;
result.Width = Size.Value;
return result;
}
@@ -9,22 +9,22 @@ namespace Material.Styles.Controls
{
public class MaterialInternalIcon : TemplatedControl
{
private static readonly Lazy<IDictionary<string, string>> _dataSetInstance = new(IconsDataSet.CreateDataSet);
private static readonly Lazy<IDictionary<string, string>> DataSetInstance = new(IconsDataSet.CreateDataSet);
static MaterialInternalIcon()
{
KindProperty.Changed.Subscribe(args => (args.Sender as MaterialInternalIcon)?.UpdateData());
}
public static readonly AvaloniaProperty<string> KindProperty =
AvaloniaProperty.Register<MaterialInternalIcon, string>(nameof(Kind));
public static readonly AvaloniaProperty<string?> KindProperty =
AvaloniaProperty.Register<MaterialInternalIcon, string?>(nameof(Kind));
/// <summary>
/// Gets or sets the icon to display.
/// </summary>
public string Kind
public string? Kind
{
get => (string) GetValue(KindProperty);
get => GetValue(KindProperty) as string;
set => SetValue(KindProperty, value);
}
@@ -62,10 +62,9 @@ namespace Material.Styles.Controls
if (Kind is null)
return;
string data = null;
if (_dataSetInstance.Value?.TryGetValue(Kind, out data) ?? false)
if (DataSetInstance.Value?.TryGetValue(Kind, out var data) ?? false)
Data = Geometry.Parse(data);
else
Data = null;
}
@@ -9,10 +9,10 @@ namespace Material.Styles.Controls
/// <summary>
/// Defines the <see cref="IdleBrush"/> property.
/// </summary>
public static readonly StyledProperty<IBrush> IdleBrushProperty =
AvaloniaProperty.Register<MaterialUnderline, IBrush>(nameof(IdleBrush));
public static readonly StyledProperty<IBrush?> IdleBrushProperty =
AvaloniaProperty.Register<MaterialUnderline, IBrush?>(nameof(IdleBrush));
public IBrush IdleBrush
public IBrush? IdleBrush
{
get => GetValue(IdleBrushProperty);
set => SetValue(IdleBrushProperty, value);
@@ -21,10 +21,10 @@ namespace Material.Styles.Controls
/// <summary>
/// Defines the <see cref="ActiveBrush"/> property.
/// </summary>
public static readonly StyledProperty<IBrush> ActiveBrushProperty =
AvaloniaProperty.Register<MaterialUnderline, IBrush>(nameof(ActiveBrush));
public static readonly StyledProperty<IBrush?> ActiveBrushProperty =
AvaloniaProperty.Register<MaterialUnderline, IBrush?>(nameof(ActiveBrush));
public IBrush ActiveBrush
public IBrush? ActiveBrush
{
get => GetValue(ActiveBrushProperty);
set => SetValue(ActiveBrushProperty, value);
File diff suppressed because it is too large Load Diff
@@ -1,66 +0,0 @@
#nullable enable
using System;
using Avalonia;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
namespace Material.Styles.Controls
{
/// <summary>
/// Presents a scrolling view of content inside a <see cref="Scroller"/>.
/// </summary>
public class ScrollerContentPresenter : ScrollContentPresenter
{
protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
{
// Scroll Horizontally default when content width greater than viewport width
// and the height of content is less equal than viewport height
if (Extent.Width > Viewport.Width)
{
var scrollable = Child as ILogicalScrollable;
bool isLogical = scrollable?.IsLogicalScrollEnabled == true;
double x = Offset.X;
double y = Offset.Y;
double width = isLogical ? scrollable!.ScrollSize.Width : 50;
x += -e.Delta.Y * width;
x = Math.Max(x, 0);
x = Math.Min(x, Extent.Width - Viewport.Width);
Offset = new Vector(x, y);
e.Handled = true;
}
/*if (Extent.Height > Viewport.Height || Extent.Width > Viewport.Width)
{
var scrollable = Child as ILogicalScrollable;
bool isLogical = scrollable?.IsLogicalScrollEnabled == true;
double x = Offset.X;
double y = Offset.Y;
if (Extent.Height > Viewport.Height)
{
double height = isLogical ? scrollable!.ScrollSize.Height : 50;
y += -e.Delta.Y * height;
y = Math.Max(y, 0);
y = Math.Min(y, Extent.Height - Viewport.Height);
}
if (Extent.Width > Viewport.Width)
{
double width = isLogical ? scrollable!.ScrollSize.Width : 50;
x += -e.Delta.X * width;
x = Math.Max(x, 0);
x = Math.Min(x, Extent.Width - Viewport.Width);
}
Offset = new Vector(x, y);
e.Handled = true;
}*/
}
}
}
+43 -10
View File
@@ -8,6 +8,7 @@ using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Layout;
using Avalonia.Threading;
using Material.Styles.Commands;
using Material.Styles.Models;
namespace Material.Styles.Controls
@@ -74,6 +75,15 @@ namespace Material.Styles.Controls
public static readonly StyledProperty<VerticalAlignment> SnackbarVerticalAlignmentProperty =
AvaloniaProperty.Register<SnackbarHost, VerticalAlignment>(nameof(SnackbarVerticalAlignment),
VerticalAlignment.Bottom);
public int SnackbarMaxCounts
{
get => GetValue(SnackbarMaxCountsProperty);
set => SetValue(SnackbarMaxCountsProperty, value);
}
public static readonly StyledProperty<int> SnackbarMaxCountsProperty =
AvaloniaProperty.Register<SnackbarHost, int>(nameof(SnackbarMaxCounts), 1);
static SnackbarHost()
{
@@ -96,7 +106,7 @@ namespace Material.Styles.Controls
return SnackbarHostDictionary.First().Key;
}
private static SnackbarHost GetHost(string name)
private static SnackbarHost GetHost(string? name)
{
if (name is null)
throw new ArgumentNullException(nameof(name));
@@ -111,8 +121,8 @@ namespace Material.Styles.Controls
/// <param name="text">message text.</param>
/// <param name="targetHost">the snackbar host that you wanted to use.</param>
/// <param name="priority">the priority of current task.</param>
public static void Post(string text, string? targetHost = null,
DispatcherPriority priority = DispatcherPriority.Normal) =>
public static void Post(string text, string? targetHost,
DispatcherPriority priority) =>
Post(new SnackbarModel(text), targetHost, priority);
/// <summary>
@@ -121,8 +131,8 @@ namespace Material.Styles.Controls
/// <param name="model">snackbar data model.</param>
/// <param name="targetHost">the snackbar host that you wanted to use.</param>
/// <param name="priority">the priority of current task.</param>
public static void Post(SnackbarModel model, string? targetHost = null,
DispatcherPriority priority = DispatcherPriority.Normal)
public static void Post(SnackbarModel model, string? targetHost,
DispatcherPriority priority)
{
if (string.IsNullOrEmpty(targetHost))
targetHost = GetFirstHostName();
@@ -154,7 +164,24 @@ namespace Material.Styles.Controls
timer.Start();
}
Dispatcher.UIThread.Post(delegate { host.SnackbarModels.Add(model); }, priority);
if (model.Button != null)
{
model.Command = new SnackbarCommand(host, model);
}
Dispatcher.UIThread.Post(delegate
{
var max = host.SnackbarMaxCounts;
var collection = host.SnackbarModels;
while (collection.Count >= max)
{
var m = collection.First();
collection.Remove(m);
}
host.SnackbarModels.Add(model);
}, priority);
}
/// <summary>
@@ -163,8 +190,8 @@ namespace Material.Styles.Controls
/// <param name="model">snackbar data model.</param>
/// <param name="targetHost">the snackbar host that you wanted to use.</param>
/// <param name="priority">the priority of current task.</param>
public static void Remove(SnackbarModel model, string targetHost = null,
DispatcherPriority priority = DispatcherPriority.Normal)
public static void Remove(SnackbarModel model, string? targetHost,
DispatcherPriority priority)
{
if (string.IsNullOrEmpty(targetHost))
targetHost = GetFirstHostName();
@@ -175,12 +202,18 @@ namespace Material.Styles.Controls
throw new ArgumentNullException(nameof(targetHost),
$"The target host named \"{targetHost}\" is not exist.");
Dispatcher.UIThread.Post(delegate { host.SnackbarModels.Remove(model); }, priority);
host.RemoveSnackbarModel(model, priority);
}
private static void OnSnackbarDurationExpired(SnackbarHost host, SnackbarModel model)
{
Dispatcher.UIThread.Post(delegate { host.SnackbarModels.Remove(model); });
host.RemoveSnackbarModel(model, DispatcherPriority.Background);
}
private void RemoveSnackbarModel(SnackbarModel model,
DispatcherPriority priority)
{
Dispatcher.UIThread.Post(delegate { SnackbarModels.Remove(model); }, priority);
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
+13 -10
View File
@@ -44,13 +44,13 @@ namespace Material.Styles.Controls
/// <summary>
/// Defines the <see cref="InactiveBrush"/> property.
/// </summary>
public static readonly StyledProperty<IBrush> InactiveBrushProperty =
AvaloniaProperty.Register<TickBar, IBrush>(nameof(InactiveBrush));
public static readonly StyledProperty<IBrush?> InactiveBrushProperty =
AvaloniaProperty.Register<TickBar, IBrush?>(nameof(InactiveBrush));
/// <summary>
/// Brush used to draw the TickBar's Ticks on inactive track.
/// </summary>
public IBrush InactiveBrush
public IBrush? InactiveBrush
{
get => GetValue(InactiveBrushProperty);
set => SetValue(InactiveBrushProperty, value);
@@ -59,13 +59,13 @@ namespace Material.Styles.Controls
/// <summary>
/// Defines the <see cref="ActiveBrush"/> property.
/// </summary>
public static readonly StyledProperty<IBrush> ActiveBrushProperty =
AvaloniaProperty.Register<TickBar, IBrush>(nameof(ActiveBrush));
public static readonly StyledProperty<IBrush?> ActiveBrushProperty =
AvaloniaProperty.Register<TickBar, IBrush?>(nameof(ActiveBrush));
/// <summary>
/// Brush used to draw the TickBar's Ticks on active track.
/// </summary>
public IBrush ActiveBrush
public IBrush? ActiveBrush
{
get => GetValue(ActiveBrushProperty);
set => SetValue(ActiveBrushProperty, value);
@@ -245,15 +245,18 @@ namespace Material.Styles.Controls
(startPoint, endPoint) = (endPoint, startPoint);
}
var inactiveBrush = InactiveBrush.ToImmutable();
var activeBrush = ActiveBrush.ToImmutable();
var inactiveBrush = InactiveBrush?.ToImmutable();
var activeBrush = ActiveBrush?.ToImmutable();
void DrawTick(IBrush brush, Point centerPoint, double radius)
void DrawTick(IBrush? brush, Point centerPoint, double radius)
{
if (brush == null)
return;
dc.DrawEllipse(brush, null, centerPoint, radius, radius);
}
IBrush PickBrushByRange(double c)
IBrush? PickBrushByRange(double c)
{
if (c < left)
return reverse ? inactiveBrush : activeBrush;
@@ -1,5 +1,6 @@
using System;
using System.Globalization;
using Avalonia.Data;
using Avalonia.Data.Converters;
using Avalonia.Media;
@@ -8,13 +9,15 @@ namespace Material.Styles.Converters
public class BrushRoundConverter : IValueConverter
{
public static readonly IValueConverter Instance = new BrushRoundConverter();
public Brush HighValue { get; set; } = new SolidColorBrush(Brushes.White.Color);
public Brush LowValue { get; set; } = new SolidColorBrush(Brushes.Black.Color);
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (!(value is SolidColorBrush solidColorBrush)) return null;
if (value is not SolidColorBrush solidColorBrush)
return BindingOperations.DoNothing;
var color = solidColorBrush.Color;
@@ -23,9 +26,9 @@ namespace Material.Styles.Converters
return brightness < 123 ? LowValue : HighValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
throw new NotSupportedException("This converter used for logical color picking, no convert back support!");
}
}
}
@@ -9,19 +9,19 @@ namespace Material.Styles.Converters
{
public class DatePickerTextConverter : IMultiValueConverter
{
public static DatePickerTextConverter Instance { get; } = new DatePickerTextConverter();
public static DatePickerTextConverter Instance { get; } = new();
public object Convert(IList<object> values, Type targetType, object parameter, CultureInfo culture)
public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// ReSharper disable once HeuristicUnreachableCode
try
{
return values[0] is UnsetValueType || values[0] == null
? "Not selected"
: ((DateTimeOffset) values[0]).ToString((string) values[1]);
: values[0] is DateTimeOffset offset
? offset.ToString(values[1] as string)
: BindingOperations.DoNothing;
}
catch (Exception)
catch
{
return BindingOperations.DoNothing;
}
@@ -0,0 +1,50 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace Material.Styles.Converters
{
/// <summary>
/// Used for convert <see cref="DateTimeOffset"/> to <see cref="DateTime"/>, or reveal operation.
/// </summary>
public class DateTimeOffsetConverter : IValueConverter
{
/// <summary>
/// <p>Single instance of this converter. Recommend use it rather than create a new one.</p>
/// <p>Usage in avaloniaUI: Converter='{x:Static converters:DateTimeOffsetConverter.Instance}'</p>
/// </summary>
public static DateTimeOffsetConverter Instance { get; } = new();
/// <summary>
/// Convert <see cref="DateTimeOffset"/> to <see cref="DateTime"/>
/// </summary>
/// <param name="value"><see cref="DateTimeOffset"/> instance.</param>
/// <param name="targetType">Ignored</param>
/// <param name="parameter">Ignored</param>
/// <param name="culture">Ignored</param>
/// <returns>Returns <see cref="DateTime"/> or value object if not <see cref="DateTimeOffset"/>.</returns>
public object? Convert(object? value, Type? targetType, object? parameter, CultureInfo? culture)
{
if (value is DateTimeOffset offset)
return offset.Date;
return value;
}
/// <summary>
/// Convert <see cref="DateTime"/> to <see cref="DateTimeOffset"/>
/// </summary>
/// <param name="value"><see cref="DateTime"/> instance.</param>
/// <param name="targetType">Ignored</param>
/// <param name="parameter">Ignored</param>
/// <param name="culture">Ignored</param>
/// <returns>Returns <see cref="DateTimeOffset"/> or value object if not <see cref="DateTime"/>.</returns>
public object? ConvertBack(object? value, Type? targetType, object? parameter, CultureInfo? culture)
{
if (value is DateTime dateTime)
return new DateTimeOffset(dateTime);
return value;
}
}
}
@@ -1,31 +0,0 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace Material.Styles.Converters
{
public class DateTimeToOffsetConverter : IValueConverter
{
public static DateTimeToOffsetConverter Instance { get; } = new DateTimeToOffsetConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DateTimeOffset offset)
{
return offset.Date;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DateTime dateTime)
{
return new DateTimeOffset(dateTime);
}
return value;
}
}
}
@@ -9,7 +9,7 @@ namespace Material.Styles.Converters
{
public class GetPlatformHotkeyConfigServiceConverter : IValueConverter
{
private PlatformHotkeyConfiguration _config;
private readonly PlatformHotkeyConfiguration? _config;
public GetPlatformHotkeyConfigServiceConverter()
{
@@ -21,6 +21,9 @@ namespace Material.Styles.Converters
if (parameter is not string kind)
return null;
if (_config == null)
return null;
var gestures = kind switch
{
"copy" => _config.Copy,
@@ -35,9 +38,12 @@ namespace Material.Styles.Converters
return gestures?.FirstOrDefault();
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
/// <summary>
/// Unsupported procedure. Dont use it.
/// </summary>
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
}
@@ -2,18 +2,18 @@ using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace Material.Styles
namespace Material.Styles.Converters
{
internal class InverseBooleanValueConverter : IValueConverter
{
public bool Default { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is bool b ? !b : Default;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is bool b ? !b : !Default;
}
+17 -13
View File
@@ -7,26 +7,30 @@ using Avalonia.Data.Converters;
namespace Material.Styles.Converters
{
/// <summary>
/// Converter for NavigationDrawer use.
/// Converter for NavigationDrawer use. It create Margin by values.
/// </summary>
public class MarginCreator : IMultiValueConverter
{
public const double Offset = -8;
public object Convert(IList<object> values, Type targetType, object parameter, CultureInfo culture)
public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if ((values[0] is double left))
return createMargin(left: -left + Offset);
if ((values[1] is double up))
return createMargin(up: -up + Offset);
if ((values[2] is double right))
return createMargin(right: -right + Offset);
if ((values[3] is double down))
return createMargin(down: -down + Offset);
return createMargin();
if (values[0] is double left)
return CreateMargin(left: -left + Offset);
if (values[1] is double up)
return CreateMargin(up: -up + Offset);
if (values[2] is double right)
return CreateMargin(right: -right + Offset);
if (values[3] is double down)
return CreateMargin(down: -down + Offset);
return CreateMargin();
}
public static Thickness createMargin(double left = 0, double up = 0, double right = 0, double down = 0) =>
new Thickness(left, up, right, down);
private static Thickness CreateMargin(double left = 0, double up = 0, double right = 0, double down = 0) =>
new(left, up, right, down);
}
}
@@ -0,0 +1,16 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace Material.Styles.Converters;
public sealed class ProgressBarIntermediateOffsetConverter : IValueConverter {
/// <inheritdoc />
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) {
return (double)value! * System.Convert.ToDouble(parameter, NumberFormatInfo.InvariantInfo);
}
/// <inheritdoc />
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) {
throw new NotSupportedException();
}
}
@@ -4,21 +4,16 @@ using Avalonia.Controls;
using Avalonia.Controls.Presenters;
using Avalonia.Data.Converters;
namespace Material.Styles.Converters
{
internal class WrapContentIntoContentPresenterConverter : IValueConverter
{
public static WrapContentIntoContentPresenterConverter Instance { get; } =
new WrapContentIntoContentPresenterConverter();
namespace Material.Styles.Converters {
internal class WrapContentIntoContentPresenterConverter : IValueConverter {
public static WrapContentIntoContentPresenterConverter Instance { get; } = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is IControl ? value : new ContentPresenter() {Content = value};
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) {
return value is Control ? value : new ContentPresenter { Content = value };
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) {
throw new NotSupportedException();
}
}
}
}
+4 -4
View File
@@ -26,9 +26,9 @@
<ControlTemplate>
<Panel>
<!-- This controls required by avalonia code behind -->
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="DayText" />
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="MonthText" />
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="YearText" />
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="{x:Static naming:PartNames.AvaloniaDayText}" />
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="{x:Static naming:PartNames.AvaloniaMonthText}" />
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="{x:Static naming:PartNames.AvaloniaYearText}" />
<!-- TODO: Make TextBox writeable -->
<!-- TODO: allow use different text boxes style-->
@@ -58,7 +58,7 @@
<controls:Card Name="{x:Static naming:PartNames.PartCard}">
<Calendar
SelectedDate="{TemplateBinding SelectedDate,
Mode=TwoWay, Converter={x:Static converters:DateTimeToOffsetConverter.Instance}}"/>
Mode=TwoWay, Converter={x:Static converters:DateTimeOffsetConverter.Instance}}"/>
</controls:Card>
</Popup>
</Panel>
+13 -7
View File
@@ -1,10 +1,16 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ItemsControl">
<Setter Property="Template">
<ControlTemplate>
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}" />
</ControlTemplate>
<ControlTemplate>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Padding="{TemplateBinding Padding}">
<ItemsPresenter Name="PART_ItemsPresenter"
AreVerticalSnapPointsRegular="{TemplateBinding AreVerticalSnapPointsRegular}"
AreHorizontalSnapPointsRegular="{TemplateBinding AreHorizontalSnapPointsRegular}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</Border>
</ControlTemplate>
</Setter>
</Style>
</Style>
+3 -9
View File
@@ -18,11 +18,8 @@
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
Margin="{TemplateBinding Padding}"
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
Margin="{TemplateBinding Padding}" />
</ScrollViewer>
</Border>
</ControlTemplate>
@@ -36,13 +33,10 @@
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
Margin="{TemplateBinding Padding}"
VirtualizationMode="{TemplateBinding VirtualizationMode}"/>
Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter>
</Style>
</Styles>
</Styles>
+2 -1
View File
@@ -55,7 +55,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.13" />
<PackageReference Include="Avalonia" Version="11.0.0-preview5"/>
<PackageReference Include="System.Reactive" Version="5.0.0"/>
</ItemGroup>
</Project>
+147 -101
View File
@@ -1,109 +1,155 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Material.Styles.MaterialToolKit">
<Styles.Resources>
<SolidColorBrush x:Key="MaterialDesignLightBackground" Color="#FFFAFAFA"/>
<SolidColorBrush x:Key="MaterialDesignLightForeground" Color="#DD000000"/>
<SolidColorBrush x:Key="MaterialDesignDarkBackground" Color="#FF303030"/>
<SolidColorBrush x:Key="MaterialDesignDarkForeground" Color="#FFFAFAFA"/>
<SolidColorBrush x:Key="MaterialDesignDarkSeparatorBackground" Color="#1F000000" />
<SolidColorBrush x:Key="MaterialDesignLightSeparatorBackground" Color="#1FFFFFFF" />
</Styles.Resources>
<!--custom controls-->
<StyleInclude Source="avares://Material.Styles/FloatingButton.xaml" />
<StyleInclude Source="avares://Material.Styles/Card.xaml"/>
<StyleInclude Source="avares://Material.Styles/ColorZone.xaml"/>
<StyleInclude Source="avares://Material.Styles/NavigationDrawer.xaml"/>
<StyleInclude Source="avares://Material.Styles/MaterialUnderline.xaml"/>
<StyleInclude Source="avares://Material.Styles/SnackbarHost.xaml"/>
<StyleInclude Source="avares://Material.Styles/MaterialInternalIcon.axaml"/>
<StyleInclude Source="avares://Material.Styles/CircleClockPickerCell.axaml"/>
<StyleInclude Source="avares://Material.Styles/CircleClockPicker.axaml"/>
<!-- Basic controls -->
<!-- Buttons -->
<StyleInclude Source="avares://Material.Styles/Button.xaml" />
<StyleInclude Source="avares://Material.Styles/ButtonSpinner.xaml" />
<StyleInclude Source="avares://Material.Styles/ToggleButton.xaml" />
<StyleInclude Source="avares://Material.Styles/ToggleSwitch.xaml" />
<StyleInclude Source="avares://Material.Styles/RadioButton.xaml" />
<StyleInclude Source="avares://Material.Styles/RepeatButton.xaml" />
<!-- Uncommented -->
<StyleInclude Source="avares://Material.Styles/AutoCompleteBox.xaml" />
<StyleInclude Source="avares://Material.Styles/CalendarButton.xaml" />
<StyleInclude Source="avares://Material.Styles/CalendarDayButton.xaml" />
<StyleInclude Source="avares://Material.Styles/CalendarItem.xaml" />
<StyleInclude Source="avares://Material.Styles/Carousel.xaml" />
<StyleInclude Source="avares://Material.Styles/CheckBox.xaml" />
<StyleInclude Source="avares://Material.Styles/ComboBox.xaml" />
<StyleInclude Source="avares://Material.Styles/ComboBoxItem.xaml" />
<StyleInclude Source="avares://Material.Styles/ContentControl.xaml" />
<StyleInclude Source="avares://Material.Styles/ContentExpandControl.axaml" />
<StyleInclude Source="avares://Material.Styles/ContextMenu.xaml" />
<StyleInclude Source="avares://Material.Styles/DataValidationErrors.xaml" />
<StyleInclude Source="avares://Material.Styles/DatePicker.xaml" />
<StyleInclude Source="avares://Material.Styles/EmbeddableControlRoot.xaml" />
<StyleInclude Source="avares://Material.Styles/FlyoutPresenter.axaml" />
<StyleInclude Source="avares://Material.Styles/FocusAdorner.xaml" />
<StyleInclude Source="avares://Material.Styles/GridSplitter.xaml" />
<StyleInclude Source="avares://Material.Styles/ItemsControl.xaml" />
<StyleInclude Source="avares://Material.Styles/Label.axaml" />
<StyleInclude Source="avares://Material.Styles/ListBox.xaml" />
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/FontFamily.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/Window.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TextBlock.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/DataValidationErrors.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/MaterialUnderline.axaml" />
<!-- Seems like we cant reference something from other projects... -->
<!-- I think what we need to move ripple to this project -->
<ResourceInclude Source="avares://Material.Ripple/Theme.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/Button.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ToggleSwitch.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ToggleButton.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/Expander.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/CheckBox.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/RadioButton.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ItemsControl.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TextBox.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ScrollBar.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ScrollViewer.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ListBox.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ListBoxItem.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TreeView.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TreeViewItem.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/NavigationDrawer.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/Scroller.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TabControl.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TabItem.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TabStrip.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TabStripItem.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ProgressBar.axaml" />
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/Slider.axaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="MaterialDesignLightBackground" Color="#FFFAFAFA" />
<SolidColorBrush x:Key="MaterialDesignLightForeground" Color="#DD000000" />
<SolidColorBrush x:Key="MaterialDesignDarkBackground" Color="#FF303030" />
<SolidColorBrush x:Key="MaterialDesignDarkForeground" Color="#FFFAFAFA" />
<SolidColorBrush x:Key="MaterialDesignDarkSeparatorBackground" Color="#1F000000" />
<SolidColorBrush x:Key="MaterialDesignLightSeparatorBackground" Color="#1FFFFFFF" />
</ResourceDictionary>
</Styles.Resources>
<!-- Above: for Avalonia 0.10 -->
<!--custom controls-->
<StyleInclude Source="avares://Material.Styles/FloatingButton.xaml" />
<StyleInclude Source="avares://Material.Styles/Card.xaml" />
<StyleInclude Source="avares://Material.Styles/ColorZone.xaml" />
<!--<StyleInclude Source="avares://Material.Styles/NavigationDrawer.xaml"/>-->
<!--<StyleInclude Source="avares://Material.Styles/MaterialUnderline.xaml"/>-->
<StyleInclude Source="avares://Material.Styles/SnackbarHost.xaml" />
<StyleInclude Source="avares://Material.Styles/MaterialInternalIcon.axaml" />
<StyleInclude Source="avares://Material.Styles/CircleClockPickerCell.axaml" />
<StyleInclude Source="avares://Material.Styles/CircleClockPicker.axaml" />
<!-- Basic controls -->
<!-- Buttons -->
<!--<StyleInclude Source="avares://Material.Styles/Button.xaml" /> -->
<StyleInclude Source="avares://Material.Styles/ButtonSpinner.xaml" />
<!--<StyleInclude Source="avares://Material.Styles/ToggleButton.xaml" /> -->
<!--<StyleInclude Source="avares://Material.Styles/ToggleSwitch.xaml" />-->
<!--<StyleInclude Source="avares://Material.Styles/RadioButton.xaml" />-->
<StyleInclude Source="avares://Material.Styles/RepeatButton.xaml" />
<!-- Uncommented -->
<StyleInclude Source="avares://Material.Styles/AutoCompleteBox.xaml" />
<StyleInclude Source="avares://Material.Styles/CalendarButton.xaml" />
<StyleInclude Source="avares://Material.Styles/CalendarDayButton.xaml" />
<StyleInclude Source="avares://Material.Styles/CalendarItem.xaml" />
<StyleInclude Source="avares://Material.Styles/Carousel.xaml" />
<!--<StyleInclude Source="avares://Material.Styles/CheckBox.xaml" />-->
<StyleInclude Source="avares://Material.Styles/ComboBox.xaml" />
<StyleInclude Source="avares://Material.Styles/ComboBoxItem.xaml" />
<StyleInclude Source="avares://Material.Styles/ContentControl.xaml" />
<StyleInclude Source="avares://Material.Styles/ContentExpandControl.axaml" />
<StyleInclude Source="avares://Material.Styles/ContextMenu.xaml" />
<!-- <StyleInclude Source="avares://Material.Styles/DataValidationErrors.xaml" /> -->
<StyleInclude Source="avares://Material.Styles/DatePicker.xaml" />
<StyleInclude Source="avares://Material.Styles/EmbeddableControlRoot.xaml" />
<StyleInclude Source="avares://Material.Styles/FlyoutPresenter.axaml" />
<StyleInclude Source="avares://Material.Styles/FocusAdorner.xaml" />
<StyleInclude Source="avares://Material.Styles/GridSplitter.xaml" />
<!--<StyleInclude Source="avares://Material.Styles/ItemsControl.xaml" />-->
<StyleInclude Source="avares://Material.Styles/Label.axaml" />
<!--
<StyleInclude Source="avares://Material.Styles/ListBox.xaml" />
<StyleInclude Source="avares://Material.Styles/ListBoxItem.xaml" />
<StyleInclude Source="avares://Material.Styles/Menu.xaml" />
<StyleInclude Source="avares://Material.Styles/MenuItem.xaml" />
<StyleInclude Source="avares://Material.Styles/NativeMenuBar.xaml" />
<StyleInclude Source="avares://Material.Styles/NotificationCard.xaml" />
<StyleInclude Source="avares://Material.Styles/NumericUpDown.xaml" />
<StyleInclude Source="avares://Material.Styles/OverlayPopupHost.xaml" />
<StyleInclude Source="avares://Material.Styles/PopupRoot.xaml" />
<StyleInclude Source="avares://Material.Styles/ProgressBar.xaml" />
<StyleInclude Source="avares://Material.Styles/ScrollBar.xaml" />
<StyleInclude Source="avares://Material.Styles/Separator.xaml" />
<StyleInclude Source="avares://Material.Styles/SplitView.xaml" />
<StyleInclude Source="avares://Material.Styles/TabControl.xaml" />
<StyleInclude Source="avares://Material.Styles/TabStrip.xaml" />
-->
<StyleInclude Source="avares://Material.Styles/Menu.xaml" />
<StyleInclude Source="avares://Material.Styles/MenuItem.xaml" />
<StyleInclude Source="avares://Material.Styles/NativeMenuBar.xaml" />
<StyleInclude Source="avares://Material.Styles/NotificationCard.xaml" />
<StyleInclude Source="avares://Material.Styles/NumericUpDown.xaml" />
<StyleInclude Source="avares://Material.Styles/OverlayPopupHost.xaml" />
<StyleInclude Source="avares://Material.Styles/PopupRoot.xaml" />
<!-- <StyleInclude Source="avares://Material.Styles/ProgressBar.xaml" /> -->
<!-- <StyleInclude Source="avares://Material.Styles/ScrollBar.xaml" /> -->
<StyleInclude Source="avares://Material.Styles/Separator.xaml" />
<StyleInclude Source="avares://Material.Styles/SplitView.xaml" />
<!-- <StyleInclude Source="avares://Material.Styles/TabControl.xaml" /> -->
<!--
<StyleInclude Source="avares://Material.Styles/TabStrip.xaml" />
<StyleInclude Source="avares://Material.Styles/TabStripItem.xaml" />
<StyleInclude Source="avares://Material.Styles/TextBlock.xaml" />
-->
<!-- <StyleInclude Source="avares://Material.Styles/TextBlock.xaml" />-->
<StyleInclude Source="avares://Material.Styles/ToolTip.xaml" />
<StyleInclude Source="avares://Material.Styles/TreeView.xaml" />
<StyleInclude Source="avares://Material.Styles/UserControl.xaml" />
<StyleInclude Source="avares://Material.Styles/WindowNotificationManager.xaml" />
<!-- Complex controls -->
<StyleInclude Source="avares://Material.Styles/Calendar.xaml" />
<StyleInclude Source="avares://Material.Styles/ScrollViewer.xaml" />
<StyleInclude Source="avares://Material.Styles/Scroller.xaml" />
<StyleInclude Source="avares://Material.Styles/Slider.xaml" />
<StyleInclude Source="avares://Material.Styles/TextBox.xaml" />
<StyleInclude Source="avares://Material.Styles/Window.xaml" />
<StyleInclude Source="avares://Material.Ripple/RippleEffect.xaml" />
<!-- Controls (High-priority) -->
<StyleInclude Source="avares://Material.Styles/Expander.xaml" />
<StyleInclude Source="avares://Material.Styles/ToolTip.xaml" />
<!--<StyleInclude Source="avares://Material.Styles/TreeView.xaml" />-->
<StyleInclude Source="avares://Material.Styles/UserControl.xaml" />
<StyleInclude Source="avares://Material.Styles/WindowNotificationManager.xaml" />
<!-- Custom controls (High-priority) -->
<StyleInclude Source="avares://Material.Styles/SideSheet.xaml"/>
<StyleInclude Source="avares://Material.Styles/TransitioningContentControl.axaml"/>
<!-- DialogHost.Avalonia -->
<!-- dialog host style have been removed for avoid unnecessary package linking -->
<!-- you can still add it manually https://github.com/AvaloniaUtils/DialogHost.Avalonia -->
</Styles>
<!-- Complex controls -->
<StyleInclude Source="avares://Material.Styles/Calendar.xaml" />
<!--<StyleInclude Source="avares://Material.Styles/ScrollViewer.xaml" />-->
<!--<StyleInclude Source="avares://Material.Styles/Scroller.xaml" />-->
<!--<StyleInclude Source="avares://Material.Styles/Slider.xaml" />-->
<!--<StyleInclude Source="avares://Material.Styles/TextBox.xaml" />-->
<!--<StyleInclude Source="avares://Material.Styles/Window.xaml" /> -->
<!-- <StyleInclude Source="avares://Material.Ripple/RippleEffect.xaml" /> -->
<!-- Controls (High-priority) -->
<!-- <StyleInclude Source="avares://Material.Styles/Expander.xaml" /> -->
<!-- Custom controls (High-priority) -->
<StyleInclude Source="avares://Material.Styles/SideSheet.xaml" />
<StyleInclude Source="avares://Material.Styles/TransitioningContentControl.axaml" />
<!-- DialogHost.Avalonia -->
<!-- dialog host style have been removed for avoid unnecessary package linking -->
<!-- you can still add it manually https://github.com/AvaloniaUtils/DialogHost.Avalonia -->
</Styles>
+4 -6
View File
@@ -6,13 +6,11 @@
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}">
<ScrollViewer>
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
KeyboardNavigation.TabNavigation="Continue" />
<ItemsPresenter Name="PART_ItemsPresenter"
ItemsPanel="{TemplateBinding ItemsPanel}"
KeyboardNavigation.TabNavigation="Continue" />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter>
</Style>
</Style>
+171 -176
View File
@@ -4,12 +4,12 @@
xmlns:sys="clr-namespace:System;assembly=netstandard"
xmlns:ripple="clr-namespace:Material.Ripple;assembly=Material.Ripple"
xmlns:controls="clr-namespace:Material.Styles.Controls">
<Styles.Resources>
<conv:PlatformKeyGestureConverter x:Key="KeyGestureConverter" />
</Styles.Resources>
<Styles.Resources>
<conv:PlatformKeyGestureConverter x:Key="KeyGestureConverter" />
</Styles.Resources>
<!-- Previous MenuItem style and layout -->
<!--
<!-- Previous MenuItem style and layout -->
<!--
<Style Selector="MenuItem">
<Setter Property="Height" Value="48" />
<Setter Property="BorderThickness" Value="0" />
@@ -91,186 +91,181 @@
</Setter>
</Style>-->
<Style Selector="MenuItem">
<Setter Property="Height" Value="48" />
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="PART_MenuItemRootBorder" Height="{TemplateBinding Height}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Panel>
<Border Name="PART_MenuItemHighlighter"
Background="{DynamicResource MaterialDesignBody}" />
<ripple:RippleEffect Name="PART_Ripple"
RippleFill="{DynamicResource MaterialDesignFlatButtonRipple}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGT" />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<ContentPresenter Name="PART_Icon"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNotNull}}"
Content="{TemplateBinding Icon}">
</ContentPresenter>
<ContentPresenter Name="PART_HeaderPresenter"
VerticalAlignment="Center"
Content="{TemplateBinding Header}">
<ContentPresenter.DataTemplates>
<DataTemplate DataType="sys:String">
<AccessText Text="{CompiledBinding }" />
</DataTemplate>
</ContentPresenter.DataTemplates>
</ContentPresenter>
</StackPanel>
<Style Selector="MenuItem">
<Setter Property="Height" Value="48" />
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="PART_MenuItemRootBorder" Height="{TemplateBinding Height}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Panel>
<Border Name="PART_MenuItemHighlighter"
Background="{DynamicResource MaterialDesignBody}" />
<ripple:RippleEffect Name="PART_Ripple"
RippleFill="{DynamicResource MaterialDesignFlatButtonRipple}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGT" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<ContentPresenter Name="PART_Icon"
HorizontalAlignment="Center"
VerticalAlignment="Center"
<TextBlock Name="PART_InputGestureText"
Margin="24, 0, 0, 0"
Grid.Column="2"
Text="{TemplateBinding InputGesture, Converter={StaticResource KeyGestureConverter}}"
VerticalAlignment="Center" />
IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNotNull}}"
Content="{TemplateBinding Icon}" />
<ContentPresenter Name="PART_HeaderPresenter"
VerticalAlignment="Center"
Content="{TemplateBinding Header}">
<ContentPresenter.DataTemplates>
<DataTemplate DataType="sys:String">
<AccessText Text="{CompiledBinding }" />
</DataTemplate>
</ContentPresenter.DataTemplates>
</ContentPresenter>
</StackPanel>
<Path Grid.Column="0" Name="check"
Fill="{TemplateBinding Foreground}"
Data="F1M10,1.2L4.7,9.1 4.5,9.1 0,5.2 1.3,3.5 4.3,6.1 8.3,0 10,1.2z"
IsVisible="False"
Margin="4"
VerticalAlignment="Center" />
<TextBlock Name="PART_InputGestureText"
Margin="24, 0, 0, 0"
Grid.Column="2"
Text="{TemplateBinding InputGesture, Converter={StaticResource KeyGestureConverter}}"
VerticalAlignment="Center" />
<Path Name="rightArrow"
Data="M0,0L4,3.5 0,7z"
Margin="10,0,0,0"
Fill="{TemplateBinding Foreground}"
VerticalAlignment="Center"
Grid.Column="3" />
<!-- Pull request #143 from tpetruk/fix-context-menus -->
<!-- ... IsLightDismissEnabled="False" ... -->
<Popup Grid.Column="0" Name="PART_Popup"
PlacementMode="Right"
IsLightDismissEnabled="False"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">
<controls:Card Padding="0">
<Border Name="PART_MainBorder"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer>
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
Margin="0 8" />
</ScrollViewer>
</Border>
</controls:Card>
</Popup>
</Grid>
</ripple:RippleEffect>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</Style>
<!-- Default style: MenuItem icon -->
<Style Selector="MenuItem /template/ ContentPresenter#PART_Icon">
<Setter Property="Width" Value="24"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Margin" Value="0, 0, 24, 0"/>
</Style>
<Path Grid.Column="0" Name="check"
Fill="{TemplateBinding Foreground}"
Data="F1M10,1.2L4.7,9.1 4.5,9.1 0,5.2 1.3,3.5 4.3,6.1 8.3,0 10,1.2z"
IsVisible="False"
Margin="4"
VerticalAlignment="Center" />
<Style Selector="MenuItem:separator">
<Setter Property="Template">
<ControlTemplate>
<Separator Background="{DynamicResource PrimaryHueMidBrush}"
Margin="0, 8"
Height="1" />
</ControlTemplate>
</Setter>
</Style>
<Path Name="rightArrow"
Data="M0,0L4,3.5 0,7z"
Margin="10,0,0,0"
Fill="{TemplateBinding Foreground}"
VerticalAlignment="Center"
Grid.Column="3" />
<!-- Pull request #143 from tpetruk/fix-context-menus -->
<!-- ... IsLightDismissEnabled="False" ... -->
<Popup Grid.Column="0" Name="PART_Popup"
PlacementMode="Right"
IsLightDismissEnabled="False"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">
<controls:Card Padding="0">
<Border Name="PART_MainBorder"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer>
<ItemsPresenter Name="PART_ItemsPresenter"
ItemsPanel="{TemplateBinding ItemsPanel}"
Margin="0 8" />
</ScrollViewer>
</Border>
</controls:Card>
</Popup>
</Grid>
</ripple:RippleEffect>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="Menu > MenuItem">
<Setter Property="Padding" Value="4" />
<Setter Property="Foreground"
Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TemplatedControl}}, Path=Foreground}" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="root"
BorderThickness="{TemplateBinding BorderThickness}">
<Panel>
<ToggleButton Name="PART_HeaderPresenter" Classes="Flat TransparentBack ConstantForeground"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Foreground="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"
IsChecked="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"
Content="{TemplateBinding Header}"
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}}">
<ToggleButton.Styles>
<Style Selector="ToggleButton AccessText">
<Setter Property="Foreground" Value="{TemplateBinding Foreground}" />
</Style>
</ToggleButton.Styles>
<ToggleButton.DataTemplates>
<DataTemplate DataType="sys:String">
<AccessText Text="{Binding}" />
</DataTemplate>
</ToggleButton.DataTemplates>
</ToggleButton>
<!-- Default style: MenuItem icon -->
<Style Selector="MenuItem /template/ ContentPresenter#PART_Icon">
<Setter Property="Width" Value="24" />
<Setter Property="Height" Value="24" />
<Setter Property="Margin" Value="0, 0, 24, 0" />
</Style>
<Popup Name="PART_Popup"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"
IsLightDismissEnabled="False"
WindowManagerAddShadowHint="False">
<controls:Card Padding="0" Margin="8">
<Border Name="MainBorder"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer>
<ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}"
Margin="0,8" />
</ScrollViewer>
</Border>
</controls:Card>
</Popup>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="MenuItem:separator">
<Setter Property="Template">
<ControlTemplate>
<Separator Background="{DynamicResource PrimaryHueMidBrush}"
Margin="0, 8"
Height="1" />
</ControlTemplate>
</Setter>
</Style>
<Style Selector="MenuItem /template/ Border#PART_MenuItemHighlighter">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="Menu > MenuItem">
<Setter Property="Padding" Value="16 0" />
<Setter Property="Foreground"
Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TemplatedControl}}, Path=Foreground}" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="root"
BorderThickness="{TemplateBinding BorderThickness}">
<Panel>
<Border Name="PART_MenuItemHighlighter"
Background="{DynamicResource MaterialDesignBody}"
CornerRadius="4" />
<ripple:RippleEffect Name="PART_Ripple"
RippleFill="{DynamicResource MaterialDesignFlatButtonRipple}">
<Panel>
<ContentPresenter Name="PART_HeaderPresenter"
VerticalAlignment="Center"
Content="{TemplateBinding Header}"
Margin="{TemplateBinding Padding}">
<ContentPresenter.DataTemplates>
<DataTemplate DataType="sys:String">
<AccessText Text="{CompiledBinding }" />
</DataTemplate>
</ContentPresenter.DataTemplates>
</ContentPresenter>
<Popup Name="PART_Popup"
PlacementMode="Bottom"
IsLightDismissEnabled="True"
WindowManagerAddShadowHint="False"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">
<controls:Card Padding="0">
<Border Name="PART_MainBorder"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer>
<ItemsPresenter Name="PART_ItemsPresenter"
ItemsPanel="{TemplateBinding ItemsPanel}"
Margin="0 8" />
</ScrollViewer>
</Border>
</controls:Card>
</Popup>
</Panel>
</ripple:RippleEffect>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="MenuItem:not(.Menu):not(:disabled):selected /template/ Border#PART_MenuItemHighlighter">
<Setter Property="Opacity" Value="0.13" />
</Style>
<Style Selector="MenuItem /template/ Border#PART_MenuItemHighlighter">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="MenuItem:not(.Menu):disabled">
<Setter Property="Opacity" Value="0.56" />
</Style>
<Style Selector="MenuItem:not(.Menu):not(:disabled):selected /template/ Border#PART_MenuItemHighlighter">
<Setter Property="Opacity" Value="0.13" />
</Style>
<Style Selector="Menu > MenuItem">
<Setter Property="Focusable" Value="False" />
</Style>
<Style Selector="MenuItem:not(.Menu):disabled">
<Setter Property="Opacity" Value="0.56" />
</Style>
<Style Selector="MenuItem:empty /template/ Path#rightArrow">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="Menu > MenuItem">
<Setter Property="Focusable" Value="False" />
</Style>
<Style Selector="MenuItem AccessText">
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Regular" />
<Setter Property="FontFamily" Value="avares://Material.Styles/Fonts/Roboto#Roboto" />
</Style>
</Styles>
<Style Selector="MenuItem:empty /template/ Path#rightArrow">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="MenuItem AccessText">
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Regular" />
<Setter Property="FontFamily" Value="avares://Material.Styles/Fonts/Roboto#Roboto" />
</Style>
</Styles>
@@ -0,0 +1,12 @@
using System;
namespace Material.Styles.Models
{
public class SnackbarButtonModel
{
public string Text { get; set; } = string.Empty;
public Action? Action { get; set; }
public override string ToString() => Text;
}
}
+22 -16
View File
@@ -1,38 +1,44 @@
using System;
using Avalonia.Layout;
using System.Windows.Input;
namespace Material.Styles.Models
{
public class SnackbarModel
{
public SnackbarModel(object content, Orientation orientation = Orientation.Horizontal)
public SnackbarModel(object content)
{
_content = content;
_orientation = orientation;
//_button = button;
}
public SnackbarModel(object content, TimeSpan duration, Orientation orientation = Orientation.Horizontal) :
this(content, orientation)
public SnackbarModel(object content, TimeSpan? duration) :
this(content)
{
_duration = duration;
if(duration.HasValue)
_duration = duration.Value;
}
public SnackbarModel(object content, TimeSpan? duration, SnackbarButtonModel button) :
this(content, duration)
{
_button = button;
}
private ICommand? _buttonCommand;
private object _content;
private readonly object _content;
public object Content => _content;
private Orientation _orientation;
public Orientation Orientation => _orientation;
private readonly SnackbarButtonModel? _button;
public SnackbarButtonModel? Button => _button;
// Still not sure I should use control instead of method call
// because I want more flexible button property on snackbar but
// that means we cant dismiss snackbar after pressed button.
private object _button;
public object Button => _button;
public ICommand? Command
{
get => _buttonCommand;
internal set => _buttonCommand = value;
}
// Setting duration to TimeSpan.Zero, will make it stay forever/til you manually delete it
private TimeSpan _duration = TimeSpan.FromSeconds(5);
private readonly TimeSpan _duration = TimeSpan.FromSeconds(5);
public TimeSpan Duration => _duration;
}
}
+2 -2
View File
@@ -1,9 +1,9 @@
<Style xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:styles="clr-namespace:Material.Styles"
xmlns:converters="clr-namespace:Material.Styles.Converters"
Selector="NativeMenuBar">
<Style.Resources>
<styles:InverseBooleanValueConverter x:Key="AvaloniaThemesDefaultNativeMenuBarInverseBooleanValueConverter"
<converters:InverseBooleanValueConverter x:Key="AvaloniaThemesDefaultNativeMenuBarInverseBooleanValueConverter"
Default="True" />
</Style.Resources>
<Setter Property="Template">
+11 -1
View File
@@ -10,7 +10,7 @@
<Style Selector="ProgressBar">
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkBrush}" />
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
@@ -281,6 +281,12 @@
<Arc Name="PART_Arc"
Stroke="{TemplateBinding Foreground}"/>
<Viewbox Name="PART_ProgressText" MaxHeight="50"
VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="4">
<TextBlock Text="{Binding $parent[ProgressBar].Value}"></TextBlock>
</Viewbox>
<!-- create a dummy indicator to avoid avaloniaUI crash -->
<Border Name="{x:Static naming:PartNames.AvaloniaProgressBarIndicator}"
@@ -293,6 +299,10 @@
</Setter>
</Style>
<Style Selector="ProgressBar[ShowProgressText=False].circular /template/ Viewbox#PART_ProgressText">
<Setter Property="IsVisible" Value="False"></Setter>
</Style>
<Style Selector="ProgressBar.circular /template/ Arc#PART_Animation">
<Setter Property="StrokeThickness" Value="4" />
@@ -0,0 +1,34 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/Button.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector="Button.flat">
<Setter Property="Theme" Value="{StaticResource FlatButton}"/>
</Style>
<Style Selector="Button.outline">
<Setter Property="Theme" Value="{StaticResource OutlineButton}"/>
</Style>
<Style Selector="Button.icon">
<Setter Property="Theme" Value="{StaticResource IconButton}"/>
</Style>
<Style Selector="Button.Flat">
<Setter Property="Theme" Value="{StaticResource FlatButton}"/>
</Style>
<Style Selector="Button.Outline">
<Setter Property="Theme" Value="{StaticResource OutlineButton}"/>
</Style>
<Style Selector="Button.Icon">
<Setter Property="Theme" Value="{StaticResource IconButton}"/>
</Style>
</Styles>
@@ -0,0 +1,19 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<!--
You want apply all old classes compatibility? no problem!
Add above line to your styles of App.axaml
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/Index.axaml"/>
-->
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/ScrollViewerClasses.axaml"/>
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/TextBlockClasses.axaml"/>
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/TextBoxClasses.axaml"/>
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/ButtonClasses.axaml"/>
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/SliderClasses.axaml"/>
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/TabControlClasses.axaml"/>
<StyleInclude Source="avares://Material.Styles/Resources/Compatibility/ProgressBarClasses.axaml"/>
</Styles>
@@ -0,0 +1,18 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ProgressBar.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector="ProgressBar.circular">
<Setter Property="Theme" Value="{StaticResource CircularProgressBar}" />
</Style>
<Style Selector="ProgressBar.Circular">
<Setter Property="Theme" Value="{StaticResource CircularProgressBar}" />
</Style>
</Styles>
@@ -0,0 +1,18 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/ScrollViewer.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector="ScrollViewer.classic">
<Setter Property="Theme" Value="{StaticResource NoAutoHideScrollViewer}"/>
</Style>
<Style Selector="ScrollViewer.no-auto-hide">
<Setter Property="Theme" Value="{StaticResource NoAutoHideScrollViewer}"/>
</Style>
</Styles>
@@ -0,0 +1,21 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/Slider.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector="Slider.discrete, Slider.Discrete">
<Setter Property="Theme" Value="{StaticResource MaterialDiscreteSliderV2}"/>
</Style>
<Style Selector="Slider.material-v1">
<Setter Property="Theme" Value="{StaticResource MaterialSliderV1}"/>
</Style>
<Style Selector="Slider.material-v1.discrete">
</Style>
</Styles>
@@ -0,0 +1,14 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TabControl.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector="TabControl.Scrollable, TabControl.scrollable">
<Setter Property="Control.Theme" Value="{StaticResource ScrollableTabControl}"/>
</Style>
</Styles>
@@ -0,0 +1,114 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TextBlock.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector=":is(Control).Caption">
<Setter Property="Theme" Value="{StaticResource CaptionTextBlock}"/>
</Style>
<Style Selector=":is(Control).Body1">
<Setter Property="Theme" Value="{StaticResource Body1TextBlock}"/>
</Style>
<Style Selector=":is(Control).Body2">
<Setter Property="Theme" Value="{StaticResource Body2TextBlock}"/>
</Style>
<Style Selector=":is(Control).Overline">
<Setter Property="Theme" Value="{StaticResource OverlineTextBlock}"/>
</Style>
<Style Selector=":is(Control).Subtitle1">
<Setter Property="Theme" Value="{StaticResource Subtitle1TextBlock}"/>
</Style>
<Style Selector=":is(Control).Subtitle2">
<Setter Property="Theme" Value="{StaticResource Subtitle2TextBlock}"/>
</Style>
<Style Selector=":is(Control).Headline6">
<Setter Property="Theme" Value="{StaticResource Headline6TextBlock}"/>
</Style>
<Style Selector=":is(Control).Headline5">
<Setter Property="Theme" Value="{StaticResource Headline5TextBlock}"/>
</Style>
<Style Selector=":is(Control).Headline4">
<Setter Property="Theme" Value="{StaticResource Headline4TextBlock}"/>
</Style>
<Style Selector=":is(Control).Headline3">
<Setter Property="Theme" Value="{StaticResource Headline3TextBlock}"/>
</Style>
<Style Selector=":is(Control).Headline2">
<Setter Property="Theme" Value="{StaticResource Headline2TextBlock}"/>
</Style>
<Style Selector=":is(Control).Headline1">
<Setter Property="Theme" Value="{StaticResource Headline1TextBlock}"/>
</Style>
<Style Selector=":is(Control).Link">
<Setter Property="Theme" Value="{StaticResource LinkTextBlock}"/>
</Style>
<Style Selector=":is(Control).caption">
<Setter Property="Theme" Value="{StaticResource CaptionTextBlock}"/>
</Style>
<Style Selector=":is(Control).body1">
<Setter Property="Theme" Value="{StaticResource Body1TextBlock}"/>
</Style>
<Style Selector=":is(Control).body2">
<Setter Property="Theme" Value="{StaticResource Body2TextBlock}"/>
</Style>
<Style Selector=":is(Control).overline">
<Setter Property="Theme" Value="{StaticResource OverlineTextBlock}"/>
</Style>
<Style Selector=":is(Control).subtitle1">
<Setter Property="Theme" Value="{StaticResource Subtitle1TextBlock}"/>
</Style>
<Style Selector=":is(Control).subtitle2">
<Setter Property="Theme" Value="{StaticResource Subtitle2TextBlock}"/>
</Style>
<Style Selector=":is(Control).headline6">
<Setter Property="Theme" Value="{StaticResource Headline6TextBlock}"/>
</Style>
<Style Selector=":is(Control).headline5">
<Setter Property="Theme" Value="{StaticResource Headline5TextBlock}"/>
</Style>
<Style Selector=":is(Control).headline4">
<Setter Property="Theme" Value="{StaticResource Headline4TextBlock}"/>
</Style>
<Style Selector=":is(Control).headline3">
<Setter Property="Theme" Value="{StaticResource Headline3TextBlock}"/>
</Style>
<Style Selector=":is(Control).headline2">
<Setter Property="Theme" Value="{StaticResource Headline2TextBlock}"/>
</Style>
<Style Selector=":is(Control).headline1">
<Setter Property="Theme" Value="{StaticResource Headline1TextBlock}"/>
</Style>
<Style Selector=":is(Control).link">
<Setter Property="Theme" Value="{StaticResource LinkTextBlock}"/>
</Style>
</Styles>
@@ -0,0 +1,22 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Styles.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Material.Styles/Resources/Themes/TextBox.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Styles.Resources>
<Style Selector="TextBox.filled">
<Setter Property="Theme" Value="{StaticResource FilledTextBox}"/>
</Style>
<Style Selector="TextBox.outline">
<Setter Property="Theme" Value="{StaticResource OutlineTextBox}"/>
</Style>
<Style Selector="TextBox.solo">
<Setter Property="Theme" Value="{StaticResource SoloTextBox}"/>
</Style>
</Styles>
+77 -11
View File
@@ -24,11 +24,25 @@
public static string PartContentPanel => "PART_ContentPanel";
public static string PartInnerBorder => "PART_InnerBorder";
/// <summary>
/// General use.
/// Please use this name on templated border of controls that have feedback on hovered by cursor
/// </summary>
public static string PartHoverEffect => "PART_HoverEffect";
public static string PartScrollViewer => "PART_ScrollViewer";
/// <summary>
/// General use.
/// Please use this name on templated border of controls that have behaviours (Selected / Clicked behaviour or etc.)
/// </summary>
public static string PartBehaviourEffect => "PART_BehaviourEffect";
/// <summary>
/// Use this name on Ripple layer control,
/// which gives visual feedback to user after click control like <see cref="Avalonia.Controls.Button"/>.
/// </summary>
public static string PartRipple => "PART_Ripple";
#endregion
@@ -49,10 +63,16 @@
public static string PartLabelRootBorder => "PART_LabelRootBorder";
public static string PartErrorPresenter => "PART_ErrorPresenter";
#endregion
#region For Slider
#region For Slider, ScrollBar
public static string PartProgressLayer => "PART_ProgressLayer";
public static string PartSliderTick => "PART_SliderTick";
/// <summary>
/// <p>This name is used for AvaloniaUI integration (Required).</p>
/// Use this name on track of slider.
@@ -62,7 +82,23 @@
public static string PartTrackBorderBar => "PART_TrackBorderBar";
public static string PartThumb => "PART_Thumb";
public static string PartSliderThumb => "PART_SliderThumb";
/// <summary>
/// Use this name on RepeatButton of track of scrollbar to scroll up (decrease steps view).
/// </summary>
public static string PartLineUpButton => "PART_LineUpButton";
/// <summary>
/// Use this name on RepeatButton of track of scrollbar to scroll down (increase steps view).
/// </summary>
public static string PartLineDownButton => "PART_LineDownButton";
public static string PartPageUpButton => "PART_PageUpButton";
public static string PartPageDownButton => "PART_PageDownButton";
/// <summary>
/// <p>This name is used for AvaloniaUI integration.</p>
@@ -94,13 +130,13 @@
/// <p>This name is used for AvaloniaUI integration.</p>
/// Use this name on canvas of ToggleSwitch to get a zone for draggable knob
/// </summary>
public static string AvaloniaSwitchKnob => "SwitchKnob";
public static string AvaloniaSwitchKnob => "PART_SwitchKnob";
/// <summary>
/// <p>This name is used for AvaloniaUI integration.</p>
/// Use this name on panel under of canvas of ToggleSwitch to get a draggable knob
/// </summary>
public static string AvaloniaMovingKnobs => "MovingKnobs";
public static string AvaloniaMovingKnobs => "PART_MovingKnobs";
#endregion
@@ -113,22 +149,52 @@
/// </summary>
public static string AvaloniaProgressBarIndicator => "PART_Indicator";
public static string PartInactiveState => "PART_InactiveState";
public static string PartActiveState => "PART_ActiveState";
#endregion
#region For DatePicker
/// <summary>
/// <p>This name is used for AvaloniaUI integration.</p>
/// Use this name on TextBlock for displaying day text by avalonia
/// </summary>
public static string AvaloniaDayText = "PART_DayTextBlock";
/// <summary>
/// <p>This name is used for AvaloniaUI integration.</p>
/// Use this name on TextBlock for displaying month text by avalonia
/// </summary>
public static string AvaloniaMonthText = "PART_MonthTextBlock";
/// <summary>
/// <p>This name is used for AvaloniaUI integration.</p>
/// Use this name on TextBlock for displaying year text by avalonia
/// </summary>
public static string AvaloniaYearText = "PART_YearTextBlock";
#endregion
public static string PartInputGestureText => "PART_InputGestureText";
public static string PartVisualLayer => "VisualLayer";
/// <summary>
/// General use.
/// Please use this name on templated border of controls that have behaviours (Selected / Hovered / Clicked behaviour or etc.)
/// </summary>
public static string PartBehaviourEffect => "PART_BehaviourEffect";
public static string PartExpanderButton => "PART_ExpanderButton";
public static string PartPopup => "PART_Popup";
public static string PartCard => "PART_Card";
/// <summary>
/// Use this name on container pane of tabs, which wrapped ItemsPresenter by pane of TabControl template.
/// </summary>
public static string PartTabsPanel => "PART_TabsPanel";
/// <summary>
/// Use this name on primary separator of any control template.
/// </summary>
public static string PartSeparator => "PART_Separator";
}
}
@@ -0,0 +1,228 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ripple="clr-namespace:Material.Ripple;assembly=Material.Ripple"
xmlns:naming="clr-namespace:Material.Styles.Resources.Naming"
xmlns:assists="clr-namespace:Material.Styles.Assists"
xmlns:system="clr-namespace:System;assembly=netstandard"
xmlns:converters="clr-namespace:Material.Styles.Converters">
<system:Double x:Key="ButtonHoveredOpacity" >0.12</system:Double>
<system:Double x:Key="ButtonDisabledOpacity" >0.38</system:Double>
<system:Double x:Key="ButtonPressedOpacity" >0.26</system:Double>
<converters:BrushRoundConverter x:Key="BrushRoundConverter" />
<ControlTheme x:Key="{x:Type Button}"
TargetType="Button" >
<Setter Property="CornerRadius" Value="4" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidForegroundBrush}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Padding" Value="16 8" />
<Setter Property="assists:ShadowAssist.ShadowDepth" Value="Depth1" />
<Setter Property="assists:ButtonAssist.HoverColor"
Value="{Binding Foreground,
Converter={StaticResource BrushRoundConverter}, RelativeSource={RelativeSource Self}}" />
<Setter Property="assists:ButtonAssist.ClickFeedbackColor" Value="#000000" />
<Setter Property="TextBlock.FontWeight" Value="Medium" />
<Setter Property="TextBlock.FontSize" Value="14" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="Template" >
<ControlTemplate>
<Border Name="{x:Static naming:PartNames.PartRootBorder}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
assists:ShadowAssist.ShadowDepth="{TemplateBinding assists:ShadowAssist.ShadowDepth}" >
<Panel Name="{x:Static naming:PartNames.PartRootPanel}" >
<Border Name="{x:Static naming:PartNames.PartHoverEffect}"
Background="{TemplateBinding assists:ButtonAssist.HoverColor}"
CornerRadius="{TemplateBinding CornerRadius}" />
<Border CornerRadius="{TemplateBinding CornerRadius}"
ClipToBounds="True" >
<ripple:RippleEffect Name="{x:Static naming:PartNames.PartRipple}"
RippleFill="{TemplateBinding assists:ButtonAssist.ClickFeedbackColor}"
RippleOpacity="{StaticResource ButtonPressedOpacity}" >
<ContentPresenter Name="{x:Static naming:PartNames.PartContentPresenter}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</ripple:RippleEffect>
</Border>
</Panel>
</Border>
</ControlTemplate>
</Setter>
<!-- Transitions -->
<Style Selector="^:not(.no-transitions) /template/ Border#PART_RootBorder" >
<Setter Property="Transitions" >
<Transitions>
<DoubleTransition Duration="0.1" Property="Opacity" Easing="CircularEaseOut" />
<BrushTransition Duration="0.25" Property="Background" Easing="CircularEaseOut"/>
<BrushTransition Duration="0.25" Property="BorderBrush" Easing="CircularEaseOut"/>
</Transitions>
</Setter>
</Style>
<Style Selector="^:not(.no-transitions) /template/ Border#PART_HoverEffect" >
<Setter Property="Transitions" >
<Transitions>
<DoubleTransition Duration="0:0:0.25" Property="Opacity" Easing="LinearEasing" />
</Transitions>
</Setter>
</Style>
<!-- Colour variants -->
<Style Selector="^.light" >
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueLightForegroundBrush}" />
</Style>
<Style Selector="^.dark" >
<Setter Property="Background" Value="{DynamicResource PrimaryHueDarkBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueDarkBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkForegroundBrush}" />
</Style>
<Style Selector="^.accent" >
<Setter Property="Background" Value="{DynamicResource SecondaryHueMidBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryHueMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource SecondaryHueMidForegroundBrush}" />
</Style>
<!-- Default state -->
<Style Selector="^ /template/ Border#PART_HoverEffect" >
<Setter Property="Opacity" Value="0" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="^:not(:disabled):pointerover /template/ Border#PART_HoverEffect" >
<Setter Property="Opacity" Value="{StaticResource ButtonHoveredOpacity}" />
</Style>
<Style Selector="^:focused /template/ Border#PART_HoverEffect">
<Setter Property="Opacity" Value="0.24"/>
</Style>
<Style Selector="^:pointerover /template/ Border#PART_RootBorder" >
<Setter Property="assists:ShadowAssist.Darken" Value="True" />
</Style>
<Style Selector="^:disabled /template/ Border#PART_RootBorder" >
<Setter Property="Opacity" Value="{StaticResource ButtonDisabledOpacity}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="OutlineButton"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}" />
<Setter Property="Padding" Value="16 6" />
<Setter Property="assists:ShadowAssist.ShadowDepth" Value="Depth0" />
<!-- Colour variants -->
<Style Selector="^.accent" >
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryHueMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource SecondaryHueMidBrush}" />
</Style>
<Style Selector="^.light" >
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueLightBrush}" />
</Style>
<Style Selector="^.dark" >
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueDarkBrush}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkBrush}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignBody}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="FlatButton"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}" />
<Setter Property="Padding" Value="16 6" />
<Setter Property="assists:ShadowAssist.ShadowDepth" Value="Depth0" />
<Setter Property="assists:ButtonAssist.HoverColor" Value="{DynamicResource MaterialDesignBody}" />
<Setter Property="assists:ButtonAssist.ClickFeedbackColor" Value="{Binding $self.Foreground}" />
<!-- Colour variants -->
<Style Selector="^.accent" >
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource SecondaryHueMidBrush}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignBody}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="IconButton"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}" />
<Setter Property="Padding" Value="12" />
<Setter Property="Height" Value="32" />
<Setter Property="Width" Value="32" />
<Setter Property="assists:ShadowAssist.ShadowDepth" Value="Depth0" />
<Setter Property="CornerRadius" Value="100000"/>
<!-- Colour variants -->
<Style Selector="^.accent" >
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource SecondaryHueMidBrush}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignBody}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
</Style>
</ControlTheme>
</ResourceDictionary>
@@ -0,0 +1,35 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Material.Styles.Controls"
xmlns:assists="clr-namespace:Material.Styles.Assists"
xmlns:naming="clr-namespace:Material.Styles.Resources.Naming" >
<ControlTheme x:Key="{x:Type controls:Card}"
TargetType="controls:Card">
<Setter Property="assists:ShadowAssist.ShadowDepth" Value="Depth2"/>
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Background" Value="{DynamicResource MaterialDesignCardBackground}" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Padding" Value="8" />
<Setter Property="Template">
<ControlTemplate>
<Border Name="{x:Static naming:PartNames.PartRootBorder}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="{TemplateBinding CornerRadius}"
assists:ShadowAssist.ShadowDepth="{TemplateBinding assists:ShadowAssist.ShadowDepth}">
<Border Name="{x:Static naming:PartNames.PartInnerBorder}"
CornerRadius="{TemplateBinding CornerRadius}"
ClipToBounds="{TemplateBinding InsideClipping}">
<ContentPresenter Name="{x:Static naming:PartNames.PartContentPresenter}"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>
@@ -0,0 +1,116 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Material.Styles.Assists"
xmlns:ripple="clr-namespace:Material.Ripple;assembly=Material.Ripple"
xmlns:naming="clr-namespace:Material.Styles.Resources.Naming"
xmlns:system="clr-namespace:System;assembly=netstandard" >
<system:Double x:Key="CheckBoxHoveredOpacity">0.12</system:Double>
<system:Double x:Key="CheckBoxPressedOpacity">0.26</system:Double>
<ControlTheme x:Key="{x:Type CheckBox}"
TargetType="CheckBox">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="assists:SelectionControlAssist.InnerForeground"
Value="{DynamicResource PrimaryHueMidBrush}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialDesignBody}" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="assists:SelectionControlAssist.Size" Value="24" />
<Setter Property="Padding" Value="4,0,0,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Name="{x:Static naming:PartNames.PartRootBorder}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<DockPanel Name="{x:Static naming:PartNames.PartRootPanel}">
<Viewbox Width="{TemplateBinding (assists:SelectionControlAssist.Size)}"
Stretch="Uniform" VerticalAlignment="Center" ClipToBounds="False">
<Panel>
<Path Name="Graphic" Width="24" Height="24" Margin="0" />
<Ellipse Name="{x:Static naming:PartNames.PartHoverEffect}"
Fill="{TemplateBinding (assists:SelectionControlAssist.InnerForeground)}"
VerticalAlignment="Center" HorizontalAlignment="Center"
Width="42" Height="42" Margin="-100"
ClipToBounds="False"
IsHitTestVisible="False" />
<Border ClipToBounds="True" CornerRadius="100" Width="42" Height="42"
Margin="-100" VerticalAlignment="Center" HorizontalAlignment="Center">
<ripple:RippleEffect RaiseRippleCenter="True"
RippleFill="{TemplateBinding (assists:SelectionControlAssist.InnerForeground)}"
RippleOpacity="{StaticResource CheckBoxPressedOpacity}" />
</Border>
</Panel>
</Viewbox>
<ContentPresenter Name="{x:Static naming:PartNames.PartContentPresenter}"
Focusable="False"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
</DockPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- RightToLeft content variant -->
<Style Selector="^.LeftHeader /template/ DockPanel#PART_RootPanel > Viewbox">
<Setter Property="DockPanel.Dock" Value="Right" />
</Style>
<!-- Default state -->
<Style Selector="^ /template/ Path#Graphic">
<Setter Property="Data"
Value="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z" />
<Setter Property="Fill" Value="{DynamicResource MaterialDesignCheckBoxOff}" />
</Style>
<!-- Indeterminate state -->
<Style Selector="^:indeterminate /template/ Path#Graphic">
<Setter Property="Data"
Value="M6,13L6,11L18,11L18,13M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" />
<Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(assists:SelectionControlAssist.InnerForeground)}" />
</Style>
<!-- Checked state -->
<Style Selector="^:checked /template/ Path#Graphic">
<Setter Property="Data"
Value="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" />
<Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(assists:SelectionControlAssist.InnerForeground)}" />
</Style>
<!-- Accent variant -->
<Style Selector="^.accent">
<Setter Property="assists:SelectionControlAssist.InnerForeground"
Value="{DynamicResource SecondaryHueMidBrush}" />
</Style>
<!-- Hover effect -->
<Style Selector="^ /template/ Ellipse#PART_HoverEffect">
<Setter Property="Opacity" Value="0" />
</Style>
<Style Selector="^:not(:disabled):pointerover /template/ Ellipse#PART_HoverEffect">
<Setter Property="Opacity" Value="{StaticResource CheckBoxHoveredOpacity}" />
</Style>
<!-- Disabled state -->
<Style Selector="^:disabled">
<Setter Property="Opacity" Value="0.56" />
</Style>
<Style Selector="^:disabled /template/ Path#Graphic">
<Setter Property="Fill" Value="{DynamicResource MaterialDesignCheckBoxDisabled}" />
</Style>
</ControlTheme>
</ResourceDictionary>
@@ -0,0 +1,50 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=netstandard"
xmlns:naming="clr-namespace:Material.Styles.Resources.Naming" >
<DataTemplate x:Key="DataValidationErrorTemplate">
<ItemsControl Items="{Binding }"
TextBlock.Foreground="{DynamicResource ValidationErrorBrush}">
<ItemsControl.DataTemplates>
<DataTemplate DataType="system:Exception">
<TextBlock Name="PART_ErrorText"
Text="{Binding Message}"
TextWrapping="Wrap"/>
</DataTemplate>
<DataTemplate DataType="system:Object">
<TextBlock Name="PART_ErrorText"
Text="{Binding }"
TextWrapping="Wrap"/>
</DataTemplate>
</ItemsControl.DataTemplates>
</ItemsControl>
</DataTemplate>
<ControlTheme x:Key="{x:Type DataValidationErrors}"
TargetType="DataValidationErrors">
<Setter Property="ErrorTemplate" Value="{StaticResource DataValidationErrorTemplate}"/>
<Setter Property="Template">
<ControlTemplate>
<DockPanel Name="{x:Static naming:PartNames.PartRootPanel}">
<ContentControl Name="{x:Static naming:PartNames.PartErrorPresenter}"
Content="{TemplateBinding (DataValidationErrors.Errors)}"
ContentTemplate="{TemplateBinding ErrorTemplate}"
IsVisible="{TemplateBinding (DataValidationErrors.HasErrors)}"/>
<ContentPresenter Name="{x:Static naming:PartNames.PartContentPresenter}"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</DockPanel>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ ContentControl#PART_ErrorPresenter">
<Setter Property="DockPanel.Dock" Value="Bottom"/>
<Setter Property="Margin" Value="0,3,0,0"/>
</Style>
</ControlTheme>
</ResourceDictionary>
@@ -0,0 +1,240 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Material.Styles.Assists"
xmlns:controls="clr-namespace:Material.Styles.Controls"
xmlns:naming="clr-namespace:Material.Styles.Resources.Naming" >
<ControlTheme x:Key="ExpanderToggleButtonPart"
TargetType="ToggleButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ClipToBounds" Value="False"/>
<Setter Property="Height" Value="48"/>
<Setter Property="assists:ToggleButtonAssist.UncheckedBackground" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<ControlTemplate>
<Border Name="{x:Static naming:PartNames.PartRootBorder}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
assists:ShadowAssist.ShadowDepth="{TemplateBinding assists:ShadowAssist.ShadowDepth}">
<Grid ColumnDefinitions="*,Auto">
<ContentPresenter Grid.Column="0"
Name="{x:Static naming:PartNames.PartContentPresenter}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
<Border Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Path Name="PART_ExpandIcon"
Width="24" Height="24"
Fill="{TemplateBinding Foreground}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" />
</Border>
</Grid>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:not(.no-transitions) /template/ Path">
<Setter Property="Transitions">
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0.25" Easing="CubicEaseOut"/>
</Transitions>
</Setter>
</Style>
<Style Selector="^ /template/ Border#PART_RootBorder">
<Setter Property="Padding" Value="12, 8"/>
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="TextBlock.FontSize" Value="16" />
<Setter Property="TextBlock.FontWeight" Value="Regular" />
<Setter Property="TextBlock.FontStyle" Value="Normal" />
</Style>
</ControlTheme>
<ControlTheme x:Key="UpExpanderToggleButtonPart"
BasedOn="{StaticResource ExpanderToggleButtonPart}"
TargetType="ToggleButton">
<Style Selector="^ /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(-90deg)"/>
</Style>
<Style Selector="^[IsChecked=True] /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(90deg)"/>
</Style>
</ControlTheme>
<ControlTheme x:Key="DownExpanderToggleButtonPart"
BasedOn="{StaticResource ExpanderToggleButtonPart}"
TargetType="ToggleButton">
<Style Selector="^ /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(90deg)"/>
</Style>
<Style Selector="^[IsChecked=True] /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(-90deg)"/>
</Style>
</ControlTheme>
<ControlTheme x:Key="LeftExpanderToggleButtonPart"
BasedOn="{StaticResource ExpanderToggleButtonPart}"
TargetType="ToggleButton">
<Style Selector="^ /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(90deg)"/>
</Style>
<Style Selector="^[IsChecked=True] /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(-90deg)"/>
</Style>
</ControlTheme>
<ControlTheme x:Key="RightExpanderToggleButtonPart"
BasedOn="{StaticResource ExpanderToggleButtonPart}"
TargetType="ToggleButton">
<Style Selector="^ /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(-90deg)"/>
</Style>
<Style Selector="^[IsChecked=True] /template/ Path#PART_ExpandIcon">
<Setter Property="RenderTransform" Value="rotate(90deg)"/>
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type Expander}"
TargetType="Expander">
<Setter Property="ClipToBounds" Value="False"/>
<Setter Property="CornerRadius" Value="4"/>
<!-- Content transition will not work
we using different way to animate it -->
<Setter Property="ContentTransition" Value="{x:Null}"/>
<Setter Property="assists:ShadowAssist.ShadowDepth" Value="CenterDepth2"/>
<Setter Property="Background" Value="{DynamicResource MaterialDesignCardBackground}"/>
<Setter Property="Template" >
<ControlTemplate>
<Border Name="{x:Static naming:PartNames.PartRootBorder}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
assists:ShadowAssist.ShadowDepth="{TemplateBinding assists:ShadowAssist.ShadowDepth}">
<Border Name="{x:Static naming:PartNames.PartInnerBorder}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel>
<controls:ContentExpandControl Name="PART_ContentExpand"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
<LayoutTransformControl Name="PART_ToggleTransform">
<ToggleButton Name="PART_ToggleButton"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
Foreground="{DynamicResource MaterialDesignBody}"
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"/>
</LayoutTransformControl>
</Panel>
</Border>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:not(.no-transitions) /template/ controls|ContentExpandControl#PART_ContentExpand">
<Setter Property="Transitions" >
<Transitions>
<DoubleTransition Duration="0.25" Easing="CircularEaseOut" Property="Multiplier"/>
</Transitions>
</Setter>
</Style>
<Style Selector="^ /template/ Border#PART_InnerBorder">
<Setter Property="ClipToBounds" Value="True"/>
</Style>
<Style Selector="^ /template/ ToggleButton#PART_ToggleButton">
<Setter Property="assists:ShadowAssist.ShadowDepth" Value="CenterDepth1"/>
</Style>
<Style Selector="^ /template/ LayoutTransformControl#PART_ToggleTransform">
<Setter Property="ClipToBounds" Value="False"/>
</Style>
<Style Selector="^ /template/ controls|ContentExpandControl#PART_ContentExpand">
<Setter Property="Multiplier" Value="0"/>
</Style>
<Style Selector="^:expanded /template/ controls|ContentExpandControl#PART_ContentExpand">
<Setter Property="Multiplier" Value="1"/>
</Style>
<Style Selector="^:up">
<Style Selector="^ /template/ controls|ContentExpandControl#PART_ContentExpand" >
<Setter Property="Orientation" Value="Vertical"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Margin" Value="0,0,0,48"/>
</Style>
<Style Selector="^ /template/ LayoutTransformControl#PART_ToggleTransform">
<Setter Property="VerticalAlignment" Value="Bottom"/>
</Style>
<Style Selector="^ /template/ ToggleButton#PART_ToggleButton">
<Setter Property="Theme" Value="{StaticResource UpExpanderToggleButtonPart}"/>
</Style>
</Style>
<Style Selector="^:down">
<Style Selector="^ /template/ controls|ContentExpandControl#PART_ContentExpand" >
<Setter Property="Orientation" Value="Vertical"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Margin" Value="0,48,0,0"/>
</Style>
<Style Selector="^ /template/ LayoutTransformControl#PART_ToggleTransform">
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style Selector="^ /template/ ToggleButton#PART_ToggleButton">
<Setter Property="Theme" Value="{StaticResource DownExpanderToggleButtonPart}"/>
</Style>
</Style>
<Style Selector="^:left">
<Style Selector="^ /template/ controls|ContentExpandControl#PART_ContentExpand" >
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="0,0,48,0"/>
</Style>
<Style Selector="^ /template/ LayoutTransformControl#PART_ToggleTransform">
<Setter Property="LayoutTransform" Value="rotate(90deg)"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
<Style Selector="^ /template/ ToggleButton#PART_ToggleButton">
<Setter Property="Theme" Value="{StaticResource LeftExpanderToggleButtonPart}"/>
</Style>
</Style>
<Style Selector="^:right">
<Style Selector="^ /template/ controls|ContentExpandControl#PART_ContentExpand" >
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="48,0,0,0"/>
</Style>
<Style Selector="^ /template/ LayoutTransformControl#PART_ToggleTransform">
<Setter Property="LayoutTransform" Value="rotate(90deg)"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style Selector="^ /template/ ToggleButton#PART_ToggleButton">
<Setter Property="Theme" Value="{StaticResource RightExpanderToggleButtonPart}"/>
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>

Some files were not shown because too many files have changed in this diff Show More