Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7240e1b9f0 | |||
| 5cde64bb37 | |||
| 410959bfd4 | |||
| b82deffc0e | |||
| 13d79e4868 | |||
| f21fde754d | |||
| 41a22eb8b9 | |||
| 7dcf401d79 | |||
| 05756273e1 | |||
| 4e57cdcbcb | |||
| a8e6c38a14 | |||
| 1e6fe92d40 | |||
| 9331799471 | |||
| 29cb7f51f3 |
+168
@@ -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
|
||||
@@ -2,38 +2,20 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Title>Material.Avalonia</Title>
|
||||
<Title>Speckle.Material.Avalonia</Title>
|
||||
<Authors>Larymar,SKProCH,Appleneko2001</Authors>
|
||||
<Description>This repository is a set of styles that will help you customize your application in an appropriate material design.</Description>
|
||||
<PackageProjectUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</RepositoryUrl>
|
||||
<Description>Fork of Material.Avalonia</Description>
|
||||
<PackageProjectUrl>https://github.com/specklesystems/Speckle.Material.Avalonia</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/specklesystems/Speckle.Material.Avalonia</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<LangVersion>8</LangVersion>
|
||||
<PackageTags>avalonia xaml material design theme colour color ui ux material-design google-material</PackageTags>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageIcon>FavIcon.png</PackageIcon>
|
||||
<VersionPrefix>3.0.0-avalonia10-preview2</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
|
||||
</PackageReleaseNotes>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageId>Speckle.Material.Avalonia</PackageId>
|
||||
<Version>3.0.3</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -41,11 +23,6 @@ Version 3.0.0-rc0 was replaced with 3.0.0-avalonia10-preview1 (in order to keep
|
||||
<None Include="../wiki/FavIcon.png" Pack="true" PackagePath="/" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- For nightly versions-->
|
||||
<PropertyGroup>
|
||||
<Version Condition="'$(PatchNumber)' != ''">$(VersionPrefix).$(PatchNumber)</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="**\*.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
@@ -53,10 +30,15 @@ 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="0.10.18" />
|
||||
<PackageReference Include="Teronis.MSBuild.Packaging.ProjectBuildInPackage" Version="1.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Material.Styles\Material.Styles.csproj" />
|
||||
<ProjectReference Include="..\Material.Dialog\Material.Dialog.csproj" PrivateAssets="all" />
|
||||
<ProjectReference Include="..\Material.Styles\Material.Styles.csproj" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.13" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -237,7 +237,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 +276,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 +314,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"
|
||||
|
||||
@@ -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="0.10.18" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
@@ -11,6 +11,7 @@
|
||||
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">
|
||||
@@ -56,7 +57,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>
|
||||
@@ -221,4 +223,4 @@
|
||||
|
||||
|
||||
|
||||
</Window>
|
||||
</Window>
|
||||
|
||||
@@ -8,29 +8,24 @@ using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
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"));
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
private void InitializeComponent() {
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
#region Control getter and event binding
|
||||
@@ -48,58 +43,54 @@ 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)
|
||||
{
|
||||
private void TemplatedControl_OnTemplateApplied(object? sender, TemplateAppliedEventArgs e) {
|
||||
SnackbarHost.Post("Welcome to demo of Material.Avalonia!");
|
||||
}
|
||||
|
||||
private readonly List<SnackbarModel> helloSnackBars = new();
|
||||
|
||||
private void HelloButtonMenuItem_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
private void HelloButtonMenuItem_OnClick(object? sender, RoutedEventArgs e) {
|
||||
var helloSnackBar = new SnackbarModel("Hello, user!", TimeSpan.Zero);
|
||||
SnackbarHost.Post(helloSnackBar);
|
||||
helloSnackBars.Add(helloSnackBar);
|
||||
}
|
||||
|
||||
private void GoodbyeButtonMenuItem_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (var snackbarModel in helloSnackBars)
|
||||
{
|
||||
private void GoodbyeButtonMenuItem_OnClick(object? sender, RoutedEventArgs e) {
|
||||
foreach (var snackbarModel in helloSnackBars) {
|
||||
SnackbarHost.Remove(snackbarModel);
|
||||
}
|
||||
|
||||
SnackbarHost.Post("See ya next time, user!");
|
||||
}
|
||||
|
||||
private void MaterialIcon_OnPointerPressed(object? sender, PointerPressedEventArgs e) {
|
||||
var materialTheme = Application.Current.LocateMaterialTheme<MaterialTheme>();
|
||||
materialTheme.BaseTheme = materialTheme.BaseTheme == BaseThemeMode.Light ? BaseThemeMode.Dark : BaseThemeMode.Light;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</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="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.1.10"/>
|
||||
<PackageReference Include="ShowMeTheXaml.Avalonia.Generator" Version="1.2.0"/>
|
||||
<PackageReference Include="DialogHost.Avalonia" Version="0.6.0-rc1"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Material.Avalonia\Material.Avalonia.csproj" />
|
||||
|
||||
@@ -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="Apple" />
|
||||
<TextBlock Text="Apple MacOS" Grid.Column="2" />
|
||||
</Grid>
|
||||
</TreeViewItem.Header>
|
||||
@@ -127,4 +126,4 @@
|
||||
</controls:Card>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.13" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.13" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.13" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -3,6 +3,7 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
|
||||
@@ -18,6 +19,7 @@ namespace Material.Ripple
|
||||
|
||||
public RippleEffect()
|
||||
{
|
||||
AddHandler(LostFocusEvent, LostFocusHandler);
|
||||
AddHandler(PointerReleasedEvent, PointerReleasedHandler);
|
||||
AddHandler(PointerPressedEvent, PointerPressedHandler);
|
||||
AddHandler(PointerCaptureLostEvent, PointerCaptureLostHandler);
|
||||
@@ -41,6 +43,10 @@ namespace Material.Ripple
|
||||
r.RunFirstStep();
|
||||
}
|
||||
|
||||
private void LostFocusHandler(object sender, RoutedEventArgs e) {
|
||||
RemoveLastRipple();
|
||||
}
|
||||
|
||||
private void PointerReleasedHandler(object sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
RemoveLastRipple();
|
||||
|
||||
@@ -50,12 +50,16 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Material.Colors\Material.Colors.csproj" />
|
||||
<ProjectReference Include="..\Material.Ripple\Material.Ripple.csproj" />
|
||||
<ProjectReference Include="..\Material.Colors\Material.Colors.csproj" PrivateAssets="all" />
|
||||
<ProjectReference Include="..\Material.Ripple\Material.Ripple.csproj" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.13" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||
<PackageReference Include="Teronis.MSBuild.Packaging.ProjectBuildInPackage" Version="1.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -29,6 +29,8 @@ public static class SystemThemeProbe {
|
||||
[DllImport("advapi32.dll", EntryPoint = "RegQueryValueEx")]
|
||||
private static extern int RegQueryValueEx_DllImport(UIntPtr hKey, string lpValueName, int lpReserved, out uint lpType, byte[] lpData, ref int lpcbData);
|
||||
private static readonly UIntPtr HKEY_CURRENT_USER = (UIntPtr)0x80000001;
|
||||
private static readonly string REGISTRY_THEME_ENTRY_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
|
||||
private static readonly string REGISTRY_THEME_ENTRY_KEY = "AppsUseLightTheme";
|
||||
|
||||
/// <summary>
|
||||
/// Retrieving windows base theme from registry
|
||||
@@ -45,11 +47,11 @@ public static class SystemThemeProbe {
|
||||
var infoBytes = new byte[infoDataLength];
|
||||
|
||||
// I implemented it via P/Invoke cuz i dont want to see additional package reference to Microsoft.Win32.Registry in Material.Avalonia
|
||||
var o0 = RegOpenKeyEx_DllImport(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, 0x1, out var hKeyVal);
|
||||
if (o0 != 0) throw new Exception("Something went wrong when opening \"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize\" registry entry");
|
||||
var o1 = RegQueryValueEx_DllImport(hKeyVal, "AppsUseLightTheme", 0, out _, infoBytes, ref infoDataLength);
|
||||
if (o1 != 0) throw new Exception("Something went wrong when reading \"AppsUseLightTheme\" registry entry value");
|
||||
var o0 = RegOpenKeyEx_DllImport(HKEY_CURRENT_USER, REGISTRY_THEME_ENTRY_PATH, 0, 0x1, out var hKeyVal);
|
||||
if (o0 != 0) throw new Exception($"Something went wrong when opening \"{REGISTRY_THEME_ENTRY_PATH}\" registry entry");
|
||||
var o1 = RegQueryValueEx_DllImport(hKeyVal, REGISTRY_THEME_ENTRY_KEY, 0, out _, infoBytes, ref infoDataLength);
|
||||
if (o1 != 0) throw new Exception($"Something went wrong when reading \"{REGISTRY_THEME_ENTRY_KEY}\" registry entry value");
|
||||
|
||||
return BitConverter.ToBoolean(infoBytes, 0) ? BaseThemeMode.Dark : BaseThemeMode.Light;
|
||||
return BitConverter.ToBoolean(infoBytes, 0) ? BaseThemeMode.Light : BaseThemeMode.Dark;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user