Add support for mobile development + general refactoring (#3)
* Move under src folder * Rename to AvaloniaMiaDev * Change namespace to AvaloniaMiaDev * Add separate project for mobile and desktop * Small fixes * Switch back to Fluent theme * Simplify .editorconfig * Rename solution * Formatting * Formatting 2 * Fix grid * Fix version * Typo --------- Co-authored-by: MammaMiaDev <@>
No files matched your search
@@ -1,287 +1,17 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
# This .editorconfig comes from the roslyn repo: https://github.com/dotnet/roslyn/blob/main/.editorconfig
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Don't use tabs for indentation.
|
||||
# General
|
||||
[*]
|
||||
indent_style = space
|
||||
# (Please don't specify an indent_size here; that has too many unintended consequences.)
|
||||
spelling_exclusion_path = SpellingExclusions.dic
|
||||
|
||||
# Code files
|
||||
[*.{cs,csx,vb,vbx}]
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
charset = utf-8-bom
|
||||
|
||||
# XML project files
|
||||
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
|
||||
indent_size = 2
|
||||
|
||||
# XML config files
|
||||
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
|
||||
indent_size = 2
|
||||
|
||||
# JSON files
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
# Powershell files
|
||||
[*.ps1]
|
||||
indent_size = 2
|
||||
|
||||
# Shell script files
|
||||
[*.sh]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = space
|
||||
|
||||
[*.{axaml,xaml}]
|
||||
indent_size = 2
|
||||
|
||||
# Dotnet code style settings:
|
||||
[*.{cs,vb}]
|
||||
|
||||
# Sort using and Import directives with System.* appearing first
|
||||
dotnet_sort_system_directives_first = true
|
||||
dotnet_separate_import_directive_groups = false
|
||||
# Avoid "this." and "Me." if not necessary
|
||||
dotnet_style_qualification_for_field = false:refactoring
|
||||
dotnet_style_qualification_for_property = false:refactoring
|
||||
dotnet_style_qualification_for_method = false:refactoring
|
||||
dotnet_style_qualification_for_event = false:refactoring
|
||||
|
||||
# Use language keywords instead of framework type names for type references
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||
|
||||
# Suggest more modern language features when available
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
|
||||
# Whitespace options
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = false
|
||||
|
||||
# Non-private static fields are PascalCase
|
||||
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
|
||||
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
|
||||
|
||||
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
|
||||
|
||||
# Non-private readonly fields are PascalCase
|
||||
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
|
||||
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
|
||||
|
||||
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
|
||||
|
||||
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
|
||||
|
||||
# Constants are PascalCase
|
||||
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
|
||||
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
|
||||
|
||||
dotnet_naming_symbols.constants.applicable_kinds = field, local
|
||||
dotnet_naming_symbols.constants.required_modifiers = const
|
||||
|
||||
dotnet_naming_style.constant_style.capitalization = pascal_case
|
||||
|
||||
# Static fields are camelCase and start with s_
|
||||
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
|
||||
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
|
||||
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
|
||||
|
||||
dotnet_naming_symbols.static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_style.static_field_style.capitalization = camel_case
|
||||
dotnet_naming_style.static_field_style.required_prefix = s_
|
||||
|
||||
# Instance fields are camelCase and start with _
|
||||
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
|
||||
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
|
||||
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
|
||||
|
||||
dotnet_naming_symbols.instance_fields.applicable_kinds = field
|
||||
|
||||
dotnet_naming_style.instance_field_style.capitalization = camel_case
|
||||
dotnet_naming_style.instance_field_style.required_prefix = _
|
||||
|
||||
# Locals and parameters are camelCase
|
||||
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
|
||||
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
|
||||
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
|
||||
|
||||
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
|
||||
|
||||
dotnet_naming_style.camel_case_style.capitalization = camel_case
|
||||
|
||||
# Local functions are PascalCase
|
||||
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
|
||||
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
|
||||
|
||||
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
|
||||
|
||||
dotnet_naming_style.local_function_style.capitalization = pascal_case
|
||||
|
||||
# By default, name items with PascalCase
|
||||
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
|
||||
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
|
||||
|
||||
dotnet_naming_symbols.all_members.applicable_kinds = *
|
||||
|
||||
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
|
||||
|
||||
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\nSee the LICENSE file in the project root for more information.
|
||||
|
||||
# RS0016: Only enable if API files are present
|
||||
dotnet_public_api_analyzer.require_api_files = true
|
||||
|
||||
# IDE0055: Fix formatting
|
||||
# Workaround for https://github.com/dotnet/roslyn/issues/70570
|
||||
dotnet_diagnostic.IDE0055.severity = warning
|
||||
|
||||
# CSharp code style settings:
|
||||
[*.cs]
|
||||
# Newline settings
|
||||
csharp_new_line_before_open_brace = all
|
||||
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 = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_indent_labels = flush_left
|
||||
|
||||
# Whitespace options
|
||||
csharp_style_allow_embedded_statements_on_same_line_experimental = false
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
|
||||
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
|
||||
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
|
||||
|
||||
# Prefer "var" everywhere
|
||||
csharp_style_var_for_built_in_types = true:suggestion
|
||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||
csharp_style_var_elsewhere = true:suggestion
|
||||
|
||||
# Prefer method-like constructs to have a block body
|
||||
csharp_style_expression_bodied_methods = false:none
|
||||
csharp_style_expression_bodied_constructors = false:none
|
||||
csharp_style_expression_bodied_operators = false:none
|
||||
|
||||
# Prefer property-like constructs to have an expression-body
|
||||
csharp_style_expression_bodied_properties = true:none
|
||||
csharp_style_expression_bodied_indexers = true:none
|
||||
csharp_style_expression_bodied_accessors = true:none
|
||||
|
||||
# Suggest more modern language features when available
|
||||
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
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
csharp_style_prefer_extended_property_pattern = 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
|
||||
|
||||
# Blocks are allowed
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
# IDE0060: Remove unused parameter
|
||||
dotnet_diagnostic.IDE0060.severity = warning
|
||||
|
||||
[src/{Compilers,ExpressionEvaluator,Scripting}/**Test**/*.{cs,vb}]
|
||||
|
||||
# IDE0060: Remove unused parameter
|
||||
dotnet_diagnostic.IDE0060.severity = none
|
||||
|
||||
[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}]
|
||||
|
||||
# IDE0011: Add braces
|
||||
csharp_prefer_braces = when_multiline:warning
|
||||
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
|
||||
dotnet_diagnostic.IDE0011.severity = warning
|
||||
|
||||
# IDE0040: Add accessibility modifiers
|
||||
dotnet_diagnostic.IDE0040.severity = warning
|
||||
|
||||
# IDE0052: Remove unread private member
|
||||
dotnet_diagnostic.IDE0052.severity = warning
|
||||
|
||||
# IDE0059: Unnecessary assignment to a value
|
||||
dotnet_diagnostic.IDE0059.severity = warning
|
||||
|
||||
# CA1012: Abstract types should not have public constructors
|
||||
dotnet_diagnostic.CA1012.severity = warning
|
||||
|
||||
# CA1822: Make member static
|
||||
dotnet_diagnostic.CA1822.severity = warning
|
||||
|
||||
# Prefer "var" everywhere
|
||||
dotnet_diagnostic.IDE0007.severity = warning
|
||||
csharp_style_var_for_built_in_types = true:warning
|
||||
csharp_style_var_when_type_is_apparent = true:warning
|
||||
csharp_style_var_elsewhere = true:warning
|
||||
|
||||
# csharp_style_allow_embedded_statements_on_same_line_experimental
|
||||
dotnet_diagnostic.IDE2001.severity = warning
|
||||
|
||||
# csharp_style_allow_blank_lines_between_consecutive_braces_experimental
|
||||
dotnet_diagnostic.IDE2002.severity = warning
|
||||
|
||||
# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental
|
||||
dotnet_diagnostic.IDE2004.severity = warning
|
||||
|
||||
# csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental
|
||||
dotnet_diagnostic.IDE2005.severity = warning
|
||||
|
||||
# csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental
|
||||
dotnet_diagnostic.IDE2006.severity = warning
|
||||
|
||||
[src/{VisualStudio}/**/*.{cs,vb}]
|
||||
# CA1822: Make member static
|
||||
# There is a risk of accidentally breaking an internal API that partners rely on though IVT.
|
||||
dotnet_code_quality.CA1822.api_surface = private
|
||||
# dotnet specific
|
||||
dotnet_sort_system_directives_first = true
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaApplication", "AvaloniaApplication\AvaloniaApplication.csproj", "{00505DCC-588E-4E46-8F91-2AF6A88CBC78}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,17 +0,0 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="AvaloniaApplication.App"
|
||||
xmlns:local="using:AvaloniaApplication"
|
||||
xmlns:sty="using:FluentAvalonia.Styling"
|
||||
RequestedThemeVariant="Dark">
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<sty:FluentAvaloniaTheme PreferUserAccentColor="True" />
|
||||
<StyleInclude Source="avares://AvaloniaApplication/Assets/Icons.axaml" />
|
||||
<StyleInclude Source="avares://AvaloniaApplication/Templates/ContentExample.axaml" />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Media;
|
||||
using AvaloniaApplication.Views;
|
||||
using FluentAvalonia.UI.Windowing;
|
||||
|
||||
namespace AvaloniaApplication.Models;
|
||||
|
||||
public class ComplexSplashScreen : IApplicationSplashScreen
|
||||
{
|
||||
public ComplexSplashScreen()
|
||||
{
|
||||
SplashScreenContent = new FluentSplashScreenView();
|
||||
}
|
||||
|
||||
public string AppName => "";
|
||||
|
||||
public IImage? AppIcon => null;
|
||||
|
||||
public object SplashScreenContent { get; }
|
||||
|
||||
public int MinimumShowTime => 0;
|
||||
|
||||
public async Task RunTasks(CancellationToken token)
|
||||
{
|
||||
await ((FluentSplashScreenView)SplashScreenContent).InitApp();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:AvaloniaApplication.Templates">
|
||||
<Style Selector="controls|ContentExample">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border Background="#393939"
|
||||
CornerRadius="3"
|
||||
Padding="15">
|
||||
<ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding Template}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Styles>
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
|
||||
public class GridPageViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
|
||||
public class ViewModelBase : ObservableObject
|
||||
{
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templates="clr-namespace:AvaloniaApplication.Templates"
|
||||
xmlns:vm="clr-namespace:AvaloniaApplication.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaApplication.Views.ButtonPageView"
|
||||
x:DataType="vm:ButtonPageViewModel">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Buttons</TextBlock>
|
||||
<CheckBox Content="Disable buttons" IsChecked="{Binding !IsButtonEnabled}"></CheckBox>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Standard button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<Button Content="Button" IsEnabled="{Binding IsButtonEnabled}"></Button>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Toggle button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<ToggleButton Content="Toggle Button" IsEnabled="{Binding IsButtonEnabled}"></ToggleButton>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Toggle button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<ToggleSwitch IsEnabled="{Binding IsButtonEnabled}"></ToggleSwitch>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Radio button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<StackPanel Margin="20" IsEnabled="{Binding IsButtonEnabled}">
|
||||
<TextBlock Margin="0 10 0 5">First Group</TextBlock>
|
||||
<RadioButton GroupName="First Group"
|
||||
Content="First Option"/>
|
||||
<RadioButton GroupName="First Group" IsChecked="true"
|
||||
Content="Second Option"/>
|
||||
<RadioButton IsEnabled="False"
|
||||
GroupName="First Group"
|
||||
Content="Third Option"/>
|
||||
</StackPanel>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Button spinner</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<ButtonSpinner Spin="OnSpin" Width="130" ButtonSpinnerLocation="Left" HorizontalAlignment="Left">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="0"/>
|
||||
</ButtonSpinner>
|
||||
</templates:ContentExample>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,46 +0,0 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:AvaloniaApplication.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="300"
|
||||
x:Class="AvaloniaApplication.Views.CustomSplashScreenView"
|
||||
Title="CustomSplashScreenView"
|
||||
Icon="/Assets/logo_big_no_bg.ico"
|
||||
Width="300"
|
||||
Height="300"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
SystemDecorations="None"
|
||||
Topmost="True"
|
||||
x:DataType="viewModels:CustomSplashScreenViewModel">
|
||||
<Border BorderBrush="Black" BorderThickness="2">
|
||||
<Grid RowDefinitions="*,Auto" ColumnDefinitions="*,Auto">
|
||||
<Label Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
FontSize="18"
|
||||
Background="AliceBlue"
|
||||
Foreground="Black"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center">
|
||||
Launching Application...
|
||||
</Label>
|
||||
<Label Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
DockPanel.Dock="Bottom"
|
||||
Content="{Binding StartupMessage}"
|
||||
FontSize="12"
|
||||
Background="LightYellow"
|
||||
Foreground="Black"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center" />
|
||||
<Button Grid.Row="1" Grid.Column="1" DockPanel.Dock="Bottom" Command="{Binding Cancel}">
|
||||
Cancel
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -1,106 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:AvaloniaApplication.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
|
||||
x:Class="AvaloniaApplication.Views.DragAndDropPageView"
|
||||
x:DataType="vm:DragAndDropPageViewModel">
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:DragAndDropPageViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20" Name="MainContainer" DragDrop.AllowDrop="True" Background="Transparent">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Drag and Drop</TextBlock>
|
||||
<Button Content="Add Random Task" VerticalAlignment="Top" Command="{Binding AddTaskCommand}" Margin="0 0 0 20"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="25" HorizontalAlignment="Center">
|
||||
|
||||
<!-- Todos column -->
|
||||
<Border Background="DarkGray" Height="450" Width="200" Name="TodoItems"
|
||||
CornerRadius="5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="TODO" TextAlignment="Center" Foreground="Black" FontWeight="Bold"
|
||||
FontSize="22" />
|
||||
<!-- Tickets -->
|
||||
<ItemsRepeater ItemsSource="{Binding TodoTasks}" Margin="15">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Spacing="10"/>
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
<!-- Ticket template -->
|
||||
<Border CornerRadius="5" Margin="4 0 4 5" PointerPressed="OnPointerPressed"
|
||||
Padding="10" Background="White"
|
||||
BoxShadow="1 2 3 0 Black"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1.5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding Title}"
|
||||
Foreground="Black"
|
||||
FontWeight="Medium"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!-- Todos column -->
|
||||
|
||||
<!-- Done column -->
|
||||
<Border Background="DarkGray" Height="450" Width="200" Name="DoneItems"
|
||||
CornerRadius="5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="DONE" TextAlignment="Center" Foreground="Black" FontWeight="Bold"
|
||||
FontSize="22" />
|
||||
<!-- Tickets -->
|
||||
<ItemsRepeater ItemsSource="{Binding DoneTasks}" Margin="15">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Spacing="10"/>
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
<!-- Ticket template -->
|
||||
<Border CornerRadius="5" Margin="4 0 4 5" PointerPressed="OnPointerPressed"
|
||||
Padding="10" Background="White"
|
||||
BoxShadow="1 2 3 0 Black"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1.5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding Title}"
|
||||
Foreground="Black"
|
||||
FontWeight="Medium"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!-- Done column -->
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<!-- Our ghost task -->
|
||||
<Border CornerRadius="5" Name="GhostItem"
|
||||
Padding="10" Background="White"
|
||||
BoxShadow="1 2 3 0 Black"
|
||||
BorderBrush="Black" Opacity="0.6"
|
||||
BorderThickness="1.5"
|
||||
Width="100" Height="45">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding DraggingTaskItem.Title, FallbackValue='TEXT'}"
|
||||
Foreground="Black"
|
||||
FontWeight="Medium"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,25 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="400"
|
||||
x:Class="AvaloniaApplication.Views.FluentSplashScreenView">
|
||||
<Panel Background="#1e1e1e">
|
||||
<StackPanel Spacing="10"
|
||||
VerticalAlignment="Center">
|
||||
<Image Source="/Assets/logo_big_no_bg.png"
|
||||
Width="250"
|
||||
Height="250" />
|
||||
|
||||
<ProgressBar Name="ProgressBar1"
|
||||
MaxWidth="200"
|
||||
Margin="0"/>
|
||||
|
||||
<TextBlock Text="Loading..."
|
||||
Name="LoadingText"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="20"
|
||||
Foreground="White"/>
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</UserControl>
|
||||
@@ -1,27 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templates="clr-namespace:AvaloniaApplication.Templates"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700"
|
||||
x:Class="AvaloniaApplication.Views.GridPageView">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Grids</TextBlock>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Standard Grid</TextBlock>
|
||||
<templates:ContentExample>
|
||||
|
||||
<Grid ColumnDefinitions="Auto, *">
|
||||
<StackPanel Width="230" Spacing="5">
|
||||
<Button Click="Start_OnClick" Width="70" HorizontalContentAlignment="Center">START</Button>
|
||||
<Button Click="Stop_OnClick" Width="70" HorizontalContentAlignment="Center">STOP</Button>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" Name="MainGrid" Background="DimGray">
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</templates:ContentExample>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,17 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:AvaloniaApplication.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaApplication.Views.HomePageView"
|
||||
x:DataType="viewModels:HomePageViewModel">
|
||||
<Grid RowDefinitions="Auto, *" Margin="20">
|
||||
<TextBlock Grid.Row="0" Margin="0 20" FontSize="20" FontWeight="Bold">
|
||||
Homepage
|
||||
</TextBlock>
|
||||
<Border Grid.Row="1" Background="#2d323c" CornerRadius="10">
|
||||
<Image Source="/Assets/Images/logo_big.png" Height="320"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,51 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:AvaloniaApplication.ViewModels"
|
||||
xmlns:conv="clr-namespace:AvaloniaApplication.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaApplication.Views.ImagePageView"
|
||||
x:DataType="vm:ImagePageViewModel">
|
||||
<UserControl.Resources>
|
||||
<conv:BitmapAssetValueConverter x:Key="BitmapConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:ImagePageViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20" HorizontalAlignment="Left">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Images</TextBlock>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Declarative approach</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="/Assets/Images/chocolate_sample.jpg"
|
||||
MaxWidth="300">
|
||||
</Image>
|
||||
</Border>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Binding converter</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="{Binding ImageSourceString, Converter={StaticResource BitmapConverter}}"
|
||||
MaxWidth="300"
|
||||
HorizontalAlignment="Left"/>
|
||||
</Border>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Image from resources</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="{Binding ImageSourceBitmapLocal}"
|
||||
MaxWidth="300"
|
||||
HorizontalAlignment="Left"/>
|
||||
</Border>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Image from web</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="{Binding ImageSourceBitmapWeb^}"
|
||||
MaxWidth="300"
|
||||
HorizontalAlignment="Left"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,69 +0,0 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:AvaloniaApplication.ViewModels"
|
||||
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="700"
|
||||
x:Class="AvaloniaApplication.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Icon="/Assets/logo_big_no_bg.ico"
|
||||
Title="AvaloniaApplication"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Width="1100"
|
||||
Height="700">
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<Border Grid.Row="0" Height="32">
|
||||
<TextBlock Text="{Binding Title, RelativeSource={RelativeSource FindAncestor, AncestorType=Window }}"
|
||||
VerticalAlignment="Center" Margin="10 0"/>
|
||||
</Border>
|
||||
<SplitView Grid.Row="1"
|
||||
IsPaneOpen="{Binding IsPaneOpen}"
|
||||
CompactPaneLength="46"
|
||||
DisplayMode="CompactInline"
|
||||
OpenPaneLength="300"
|
||||
Background="#1e1e1e"
|
||||
PaneBackground="#1e1e1e">
|
||||
<SplitView.Pane>
|
||||
<StackPanel Orientation="Vertical"
|
||||
Spacing="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top">
|
||||
<Button HorizontalAlignment="Left"
|
||||
Width="32"
|
||||
Height="32"
|
||||
Margin="7 10"
|
||||
Command="{Binding TriggerPaneCommand}">
|
||||
<PathIcon Height="11" Data="{StaticResource LineHorizontal3Regular}" />
|
||||
</Button>
|
||||
<ListBox Margin="2 0 -100 0" Padding="0" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedListItem}">
|
||||
<ListBox.Styles>
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Padding" Value="12 8"></Setter>
|
||||
</Style>
|
||||
</ListBox.Styles>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ListItemTemplate}">
|
||||
<StackPanel Spacing="17" Orientation="Horizontal">
|
||||
<PathIcon Data="{Binding ListItemIcon}" Width="14" />
|
||||
<TextBlock Text="{Binding Label}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</SplitView.Pane>
|
||||
|
||||
<SplitView.Content>
|
||||
<Border CornerRadius="12 0 0 0"
|
||||
Background="#2d2d2d">
|
||||
<TransitioningContentControl Content="{Binding CurrentPage}" />
|
||||
</Border>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,17 +0,0 @@
|
||||
using AvaloniaApplication.Models;
|
||||
using FluentAvalonia.UI.Windowing;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
|
||||
public partial class MainWindow : AppWindow
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
TitleBar.ExtendsContentIntoTitleBar = true;
|
||||
TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;
|
||||
|
||||
SplashScreen = new ComplexSplashScreen();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templates="clr-namespace:AvaloniaApplication.Templates"
|
||||
xmlns:vm="clr-namespace:AvaloniaApplication.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaApplication.Views.TextPageView"
|
||||
x:DataType="vm:TextPageViewModel">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Text display and editing</TextBlock>
|
||||
<CheckBox Content="Disable controls" IsChecked="{Binding !IsTextEnabled}"></CheckBox>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Standard text block</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<TextBlock IsEnabled="{Binding IsTextEnabled}">Some text</TextBlock>
|
||||
</templates:ContentExample>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,45 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templates="clr-namespace:AvaloniaApplication.Templates"
|
||||
xmlns:vm="clr-namespace:AvaloniaApplication.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaApplication.Views.ValueSelectionPageView"
|
||||
x:DataType="vm:ValueSelectionPageViewModel">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Text display and editing</TextBlock>
|
||||
<CheckBox Content="Disable controls" IsChecked="{Binding !IsValueSelectionEnabled}"></CheckBox>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Checkbox</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<CheckBox IsEnabled="{Binding IsValueSelectionEnabled}">Checkbox</CheckBox>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Slider</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding SliderValue}"
|
||||
HorizontalAlignment="Center"/>
|
||||
<Slider IsEnabled="{Binding IsValueSelectionEnabled}"
|
||||
Value="{Binding SliderValue}"
|
||||
IsSnapToTickEnabled="True"
|
||||
TickFrequency="1"
|
||||
TickPlacement="Outside"
|
||||
Maximum="30"/>
|
||||
</StackPanel>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Time picker</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<TimePicker ClockIdentifier="24HourClock" SelectedTime="16:30"/>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Calendar</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<Calendar IsEnabled="{Binding IsValueSelectionEnabled}"></Calendar>
|
||||
</templates:ContentExample>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaMiaDev", "src\AvaloniaMiaDev\AvaloniaMiaDev.csproj", "{00505DCC-588E-4E46-8F91-2AF6A88CBC78}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1AA1C9C6-90AF-4BFB-ABA2-B433E9766B0F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaMiaDev.Android", "src\AvaloniaMiaDev.Android\AvaloniaMiaDev.Android.csproj", "{63DAAA66-AF92-4170-9F89-6C2846B8E389}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaMiaDev.Desktop", "src\AvaloniaMiaDev.Desktop\AvaloniaMiaDev.Desktop.csproj", "{12649311-9B1B-4EDF-8917-4609499D70BB}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{82C6A0B4-5014-4BE4-9F52-7DC1989134E3}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Directory.Build.props = Directory.Build.props
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{63DAAA66-AF92-4170-9F89-6C2846B8E389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63DAAA66-AF92-4170-9F89-6C2846B8E389}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63DAAA66-AF92-4170-9F89-6C2846B8E389}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63DAAA66-AF92-4170-9F89-6C2846B8E389}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{12649311-9B1B-4EDF-8917-4609499D70BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{12649311-9B1B-4EDF-8917-4609499D70BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{12649311-9B1B-4EDF-8917-4609499D70BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{12649311-9B1B-4EDF-8917-4609499D70BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{00505DCC-588E-4E46-8F91-2AF6A88CBC78} = {1AA1C9C6-90AF-4BFB-ABA2-B433E9766B0F}
|
||||
{63DAAA66-AF92-4170-9F89-6C2846B8E389} = {1AA1C9C6-90AF-4BFB-ABA2-B433E9766B0F}
|
||||
{12649311-9B1B-4EDF-8917-4609499D70BB} = {1AA1C9C6-90AF-4BFB-ABA2-B433E9766B0F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Nullable>enable</Nullable>
|
||||
<AvaloniaVersion>11.0.10</AvaloniaVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0-android</TargetFramework>
|
||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||
<ApplicationId>com.MammaMiaDev.AvaloniaMiaDev</ApplicationId>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<AndroidPackageFormat>apk</AndroidPackageFormat>
|
||||
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Icon.png">
|
||||
<Link>Resources\drawable\Icon.png</Link>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)"/>
|
||||
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AvaloniaMiaDev\AvaloniaMiaDev.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,21 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Avalonia;
|
||||
using Avalonia.Android;
|
||||
|
||||
namespace AvaloniaMiaDev.Android;
|
||||
|
||||
[Activity(
|
||||
Label = "AvaloniaMiaDev.Android",
|
||||
Theme = "@style/MyTheme.NoActionBar",
|
||||
Icon = "@drawable/icon",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
|
||||
public class MainActivity : AvaloniaMainActivity<App>
|
||||
{
|
||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
||||
{
|
||||
return base.CustomizeAppBuilder(builder)
|
||||
.WithInterFont();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application android:label="AvaloniaMiaDev" android:icon="@drawable/Icon" />
|
||||
</manifest>
|
||||
@@ -0,0 +1,44 @@
|
||||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.axml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called "R"
|
||||
(this is an Android convention) that contains the tokens for each one of the resources
|
||||
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||
|
||||
public class R {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
||||
@@ -0,0 +1,66 @@
|
||||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<aapt:attr name="android:drawable">
|
||||
<vector
|
||||
android:name="vector"
|
||||
android:width="128dp"
|
||||
android:height="128dp"
|
||||
android:viewportWidth="128"
|
||||
android:viewportHeight="128">
|
||||
<group
|
||||
android:name="wrapper"
|
||||
android:translateX="21"
|
||||
android:translateY="21">
|
||||
<group android:name="group">
|
||||
<path
|
||||
android:name="path"
|
||||
android:pathData="M 74.853 85.823 L 75.368 85.823 C 80.735 85.823 85.144 81.803 85.761 76.602 L 85.836 41.76 C 85.225 18.593 66.254 0 42.939 0 C 19.24 0 0.028 19.212 0.028 42.912 C 0.028 66.357 18.831 85.418 42.18 85.823 L 74.853 85.823 Z"
|
||||
android:strokeWidth="1"/>
|
||||
<path
|
||||
android:name="path_1"
|
||||
android:pathData="M 43.059 14.614 C 29.551 14.614 18.256 24.082 15.445 36.743 C 18.136 37.498 20.109 39.968 20.109 42.899 C 20.109 45.831 18.136 48.301 15.445 49.055 C 18.256 61.716 29.551 71.184 43.059 71.184 C 47.975 71.184 52.599 69.93 56.628 67.723 L 56.628 70.993 L 71.344 70.993 L 71.344 44.072 C 71.357 43.714 71.344 43.26 71.344 42.899 C 71.344 27.278 58.68 14.614 43.059 14.614 Z M 29.51 42.899 C 29.51 35.416 35.576 29.35 43.059 29.35 C 50.541 29.35 56.607 35.416 56.607 42.899 C 56.607 50.382 50.541 56.448 43.059 56.448 C 35.576 56.448 29.51 50.382 29.51 42.899 Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:name="path_2"
|
||||
android:pathData="M 18.105 42.88 C 18.105 45.38 16.078 47.407 13.579 47.407 C 11.079 47.407 9.052 45.38 9.052 42.88 C 9.052 40.381 11.079 38.354 13.579 38.354 C 16.078 38.354 18.105 40.381 18.105 42.88 Z"
|
||||
android:strokeWidth="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
<target android:name="path">
|
||||
<aapt:attr name="android:animation">
|
||||
<objectAnimator
|
||||
android:propertyName="fillColor"
|
||||
android:duration="1000"
|
||||
android:valueFrom="#00ffffff"
|
||||
android:valueTo="#161c2d"
|
||||
android:valueType="colorType"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"/>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="path_1">
|
||||
<aapt:attr name="android:animation">
|
||||
<objectAnimator
|
||||
android:propertyName="fillColor"
|
||||
android:duration="1000"
|
||||
android:valueFrom="#00ffffff"
|
||||
android:valueTo="#f9f9fb"
|
||||
android:valueType="colorType"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"/>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="path_2">
|
||||
<aapt:attr name="android:animation">
|
||||
<objectAnimator
|
||||
android:propertyName="fillColor"
|
||||
android:duration="1000"
|
||||
android:valueFrom="#00ffffff"
|
||||
android:valueTo="#f9f9fb"
|
||||
android:valueType="colorType"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"/>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,71 @@
|
||||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<aapt:attr name="android:drawable">
|
||||
<vector
|
||||
android:name="vector"
|
||||
android:width="128dp"
|
||||
android:height="128dp"
|
||||
android:viewportWidth="128"
|
||||
android:viewportHeight="128">
|
||||
<group
|
||||
android:name="wrapper"
|
||||
android:translateX="21"
|
||||
android:translateY="21">
|
||||
<group android:name="group">
|
||||
<path
|
||||
android:name="path"
|
||||
android:pathData="M 74.853 85.823 L 75.368 85.823 C 80.735 85.823 85.144 81.803 85.761 76.602 L 85.836 41.76 C 85.225 18.593 66.254 0 42.939 0 C 19.24 0 0.028 19.212 0.028 42.912 C 0.028 66.357 18.831 85.418 42.18 85.823 L 74.853 85.823 Z"
|
||||
android:fillColor="#00ffffff"
|
||||
android:strokeWidth="1"/>
|
||||
<path
|
||||
android:name="path_1"
|
||||
android:pathData="M 43.059 14.614 C 29.551 14.614 18.256 24.082 15.445 36.743 C 18.136 37.498 20.109 39.968 20.109 42.899 C 20.109 45.831 18.136 48.301 15.445 49.055 C 18.256 61.716 29.551 71.184 43.059 71.184 C 47.975 71.184 52.599 69.93 56.628 67.723 L 56.628 70.993 L 71.344 70.993 L 71.344 44.072 C 71.357 43.714 71.344 43.26 71.344 42.899 C 71.344 27.278 58.68 14.614 43.059 14.614 Z M 29.51 42.899 C 29.51 35.416 35.576 29.35 43.059 29.35 C 50.541 29.35 56.607 35.416 56.607 42.899 C 56.607 50.382 50.541 56.448 43.059 56.448 C 35.576 56.448 29.51 50.382 29.51 42.899 Z"
|
||||
android:fillColor="#00ffffff"
|
||||
android:strokeWidth="1"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:name="path_2"
|
||||
android:pathData="M 18.105 42.88 C 18.105 45.38 16.078 47.407 13.579 47.407 C 11.079 47.407 9.052 45.38 9.052 42.88 C 9.052 40.381 11.079 38.354 13.579 38.354 C 16.078 38.354 18.105 40.381 18.105 42.88 Z"
|
||||
android:fillColor="#00ffffff"
|
||||
android:strokeWidth="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
<target android:name="path_2">
|
||||
<aapt:attr name="android:animation">
|
||||
<objectAnimator
|
||||
android:propertyName="fillColor"
|
||||
android:startOffset="100"
|
||||
android:duration="900"
|
||||
android:valueFrom="#00ffffff"
|
||||
android:valueTo="#161c2d"
|
||||
android:valueType="colorType"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"/>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="path">
|
||||
<aapt:attr name="android:animation">
|
||||
<objectAnimator
|
||||
android:propertyName="fillColor"
|
||||
android:duration="500"
|
||||
android:valueFrom="#00ffffff"
|
||||
android:valueTo="#f9f9fb"
|
||||
android:valueType="colorType"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"/>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
<target android:name="path_1">
|
||||
<aapt:attr name="android:animation">
|
||||
<objectAnimator
|
||||
android:propertyName="fillColor"
|
||||
android:startOffset="100"
|
||||
android:duration="900"
|
||||
android:valueFrom="#00ffffff"
|
||||
android:valueTo="#161c2d"
|
||||
android:valueType="colorType"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"/>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<color android:color="@color/splash_background"/>
|
||||
</item>
|
||||
|
||||
<item android:drawable="@drawable/icon"
|
||||
android:width="120dp"
|
||||
android:height="120dp"
|
||||
android:gravity="center" />
|
||||
|
||||
</layer-list>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="splash_background">#212121</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
|
||||
<style name="MyTheme">
|
||||
</style>
|
||||
|
||||
<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowBackground">@null</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowSplashScreenBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/avalonia_anim</item>
|
||||
<item name="android:windowSplashScreenAnimationDuration">1000</item>
|
||||
<item name="postSplashScreenTheme">@style/MyTheme.Main</item>
|
||||
|
||||
</style>
|
||||
<style name="MyTheme.Main"
|
||||
parent ="MyTheme.NoActionBar">
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="splash_background">#FFFFFF</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
|
||||
<style name="MyTheme">
|
||||
</style>
|
||||
|
||||
<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
|
||||
One for Windows with net8.0-windows TFM, one for MacOS with net8.0-macos and one with net8.0 TFM for Linux.-->
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AvaloniaMiaDev\AvaloniaMiaDev.csproj"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,9 +1,9 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
using System;
|
||||
using Avalonia;
|
||||
|
||||
namespace AvaloniaApplication;
|
||||
namespace AvaloniaMiaDev.Desktop;
|
||||
|
||||
class Program
|
||||
sealed 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
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embeded controls.
|
||||
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="AvaloniaApplication.Desktop"/>
|
||||
<assemblyIdentity version="1.0.0.0" name="AvaloniaMiaDev.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
@@ -0,0 +1,16 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="AvaloniaMiaDev.App"
|
||||
xmlns:avaloniaMiaDev="clr-namespace:AvaloniaMiaDev"
|
||||
RequestedThemeVariant="Dark">
|
||||
|
||||
<Application.DataTemplates>
|
||||
<avaloniaMiaDev:ViewLocator/>
|
||||
</Application.DataTemplates>
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://AvaloniaMiaDev/Assets/Icons.axaml" />
|
||||
<StyleInclude Source="avares://AvaloniaMiaDev/Templates/ContentExample.axaml" />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -2,13 +2,13 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using AvaloniaApplication.ViewModels;
|
||||
using AvaloniaApplication.Views;
|
||||
using AvaloniaMiaDev.ViewModels;
|
||||
using AvaloniaMiaDev.Views;
|
||||
using CommunityToolkit.Extensions.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace AvaloniaApplication;
|
||||
namespace AvaloniaMiaDev;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
@@ -22,26 +22,30 @@ public partial class App : Application
|
||||
var locator = new ViewLocator();
|
||||
DataTemplates.Add(locator);
|
||||
|
||||
var services = new ServiceCollection();
|
||||
ConfigureViewModels(services);
|
||||
ConfigureViews(services);
|
||||
var provider = services.BuildServiceProvider();
|
||||
|
||||
Ioc.Default.ConfigureServices(provider);
|
||||
|
||||
var vm = Ioc.Default.GetRequiredService<MainViewModel>();
|
||||
// var view = (Window)locator.Build(vm);
|
||||
// view.DataContext = vm;
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
ConfigureViewModels(services);
|
||||
ConfigureViews(services);
|
||||
var provider = services.BuildServiceProvider();
|
||||
|
||||
Ioc.Default.ConfigureServices(provider);
|
||||
|
||||
var vm = Ioc.Default.GetService<MainWindowViewModel>();
|
||||
var view = (Window)locator.Build(vm);
|
||||
view.DataContext = vm;
|
||||
|
||||
desktop.MainWindow = view;
|
||||
desktop.MainWindow = new MainWindow(vm);
|
||||
}
|
||||
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
|
||||
{
|
||||
singleViewPlatform.MainView = new MainView { DataContext = vm };
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
|
||||
[Singleton(typeof(MainWindowViewModel))]
|
||||
[Singleton(typeof(MainViewModel))]
|
||||
[Transient(typeof(HomePageViewModel))]
|
||||
[Transient(typeof(ButtonPageViewModel))]
|
||||
[Transient(typeof(TextPageViewModel))]
|
||||
@@ -58,8 +62,8 @@ public partial class App : Application
|
||||
[Transient(typeof(TextPageView))]
|
||||
[Transient(typeof(ValueSelectionPageView))]
|
||||
[Transient(typeof(ImagePageView))]
|
||||
[Singleton(typeof(GridPageView))]
|
||||
[Singleton(typeof(DragAndDropPageView))]
|
||||
[Singleton(typeof(CustomSplashScreenView))]
|
||||
[Transient(typeof(GridPageView))]
|
||||
[Transient(typeof(DragAndDropPageView))]
|
||||
[Transient(typeof(CustomSplashScreenView))]
|
||||
internal static partial void ConfigureViews(IServiceCollection services);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 389 KiB After Width: | Height: | Size: 389 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 484 KiB After Width: | Height: | Size: 484 KiB |
@@ -1,12 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<ApplicationIcon>./Assets/logo_big_no_bg.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -16,14 +12,14 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.10" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.10" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.10" />
|
||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)"/>
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
|
||||
<PackageReference Include="CommunityToolkit.Labs.Extensions.DependencyInjection" Version="0.1.240305-build.1659" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="2.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -5,7 +5,7 @@ using Avalonia.Data.Converters;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace AvaloniaApplication.Converters;
|
||||
namespace AvaloniaMiaDev.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
@@ -43,7 +43,7 @@ public class BitmapAssetValueConverter : IValueConverter
|
||||
}
|
||||
|
||||
var asset = AssetLoader.Open(uri);
|
||||
|
||||
|
||||
return new Bitmap(asset);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace AvaloniaApplication.Helpers;
|
||||
namespace AvaloniaMiaDev.Helpers;
|
||||
|
||||
public static class ImageHelper
|
||||
{
|
||||
@@ -0,0 +1,15 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AvaloniaMiaDev.Templates">
|
||||
<Style Selector="controls|ContentExample">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border Background="#393939"
|
||||
CornerRadius="3"
|
||||
Padding="15">
|
||||
<ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding Template}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Styles>
|
||||
@@ -4,7 +4,7 @@ using Avalonia.Controls.Primitives;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Metadata;
|
||||
|
||||
namespace AvaloniaApplication.Templates;
|
||||
namespace AvaloniaMiaDev.Templates;
|
||||
|
||||
public class ContentExample : TemplatedControl
|
||||
{
|
||||
@@ -2,12 +2,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using AvaloniaApplication.ViewModels;
|
||||
using AvaloniaApplication.Views;
|
||||
using AvaloniaMiaDev.ViewModels;
|
||||
using AvaloniaMiaDev.Views;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
|
||||
namespace AvaloniaApplication;
|
||||
namespace AvaloniaMiaDev;
|
||||
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
@@ -15,7 +15,7 @@ public class ViewLocator : IDataTemplate
|
||||
|
||||
public ViewLocator()
|
||||
{
|
||||
RegisterViewFactory<MainWindowViewModel, MainWindow>();
|
||||
RegisterViewFactory<MainViewModel, MainWindow>();
|
||||
RegisterViewFactory<HomePageViewModel, HomePageView>();
|
||||
RegisterViewFactory<ButtonPageViewModel, ButtonPageView>();
|
||||
RegisterViewFactory<TextPageViewModel, TextPageView>();
|
||||
@@ -42,13 +42,13 @@ public class ViewLocator : IDataTemplate
|
||||
{
|
||||
return data is ObservableObject;
|
||||
}
|
||||
|
||||
|
||||
private void RegisterViewFactory<TViewModel, TView>()
|
||||
where TViewModel : class
|
||||
where TView : Control
|
||||
=> _locator.Add(
|
||||
typeof(TViewModel),
|
||||
Design.IsDesignMode
|
||||
? Activator.CreateInstance<TView>
|
||||
typeof(TViewModel),
|
||||
Design.IsDesignMode
|
||||
? Activator.CreateInstance<TView>
|
||||
: Ioc.Default.GetService<TView>);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public partial class ButtonPageViewModel : ViewModelBase
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public partial class CustomSplashScreenViewModel : ViewModelBase
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public partial class DragAndDropPageViewModel : ViewModelBase
|
||||
{
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public class GridPageViewModel : ViewModelBase { }
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public class HomePageViewModel : ViewModelBase { }
|
||||
@@ -1,14 +1,14 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Media.Imaging;
|
||||
using AvaloniaApplication.Helpers;
|
||||
using AvaloniaMiaDev.Helpers;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public class ImagePageViewModel : ViewModelBase
|
||||
{
|
||||
public string ImageSourceString => "/Assets/Images/snow.jpg";
|
||||
public Bitmap ImageSourceBitmapLocal
|
||||
public Bitmap ImageSourceBitmapLocal
|
||||
=> ImageHelper.LoadFromResource("/Assets/Images/tiny_house.jpg");
|
||||
public Task<Bitmap?> ImageSourceBitmapWeb
|
||||
public Task<Bitmap?> ImageSourceBitmapWeb
|
||||
=> ImageHelper.LoadFromWeb("https://images.unsplash.com/photo-1607956853617-d9d248a8f327?q=80&w=600&auto=format&fit=crop");
|
||||
}
|
||||
@@ -7,14 +7,14 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public partial class MainWindowViewModel : ViewModelBase
|
||||
public partial class MainViewModel : ViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool _isPaneOpen = true;
|
||||
private bool _isPaneOpen;
|
||||
|
||||
[ObservableProperty]
|
||||
[ObservableProperty]
|
||||
private ViewModelBase _currentPage = new HomePageViewModel();
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -1,6 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public partial class TextPageViewModel : ViewModelBase
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AvaloniaApplication.ViewModels;
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public partial class ValueSelectionPageViewModel : ViewModelBase
|
||||
{
|
||||
@@ -0,0 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AvaloniaMiaDev.ViewModels;
|
||||
|
||||
public class ViewModelBase : ObservableObject { }
|
||||
@@ -0,0 +1,54 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
xmlns:viewModels="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
xmlns:templates="clr-namespace:AvaloniaMiaDev.Templates"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaMiaDev.Views.ButtonPageView"
|
||||
x:DataType="viewModels:ButtonPageViewModel">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Buttons</TextBlock>
|
||||
<CheckBox Content="Disable buttons" IsChecked="{Binding !IsButtonEnabled}"></CheckBox>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Standard button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<Button Content="Button" IsEnabled="{Binding IsButtonEnabled}"></Button>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Toggle button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<ToggleButton Content="Toggle Button" IsEnabled="{Binding IsButtonEnabled}"></ToggleButton>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Toggle button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<ToggleSwitch IsEnabled="{Binding IsButtonEnabled}"></ToggleSwitch>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Radio button</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<StackPanel Margin="20" IsEnabled="{Binding IsButtonEnabled}">
|
||||
<TextBlock Margin="0 10 0 5">First Group</TextBlock>
|
||||
<RadioButton GroupName="First Group"
|
||||
Content="First Option" />
|
||||
<RadioButton GroupName="First Group" IsChecked="true"
|
||||
Content="Second Option" />
|
||||
<RadioButton IsEnabled="False"
|
||||
GroupName="First Group"
|
||||
Content="Third Option" />
|
||||
</StackPanel>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Button spinner</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<ButtonSpinner Spin="OnSpin" Width="130" ButtonSpinnerLocation="Left" HorizontalAlignment="Left">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="0" />
|
||||
</ButtonSpinner>
|
||||
</templates:ContentExample>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class ButtonPageView : UserControl
|
||||
{
|
||||
@@ -8,7 +8,7 @@ public partial class ButtonPageView : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
// TODO: replace with MVVM pattern (https://github.com/AvaloniaUI/Avalonia/issues/3766)
|
||||
public void OnSpin(object sender, SpinEventArgs e)
|
||||
{
|
||||
@@ -0,0 +1,46 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="300"
|
||||
x:Class="AvaloniaMiaDev.Views.CustomSplashScreenView"
|
||||
Title="CustomSplashScreenView"
|
||||
Icon="/Assets/logo_big_no_bg.ico"
|
||||
Width="300"
|
||||
Height="300"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
SystemDecorations="None"
|
||||
Topmost="True"
|
||||
x:DataType="viewModels:CustomSplashScreenViewModel">
|
||||
<Border BorderBrush="Black" BorderThickness="2">
|
||||
<Grid RowDefinitions="*,Auto" ColumnDefinitions="*,Auto">
|
||||
<Label Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
FontSize="18"
|
||||
Background="AliceBlue"
|
||||
Foreground="Black"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center">
|
||||
Launching Application...
|
||||
</Label>
|
||||
<Label Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
DockPanel.Dock="Bottom"
|
||||
Content="{Binding StartupMessage}"
|
||||
FontSize="12"
|
||||
Background="LightYellow"
|
||||
Foreground="Black"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center" />
|
||||
<Button Grid.Row="1" Grid.Column="1" DockPanel.Dock="Bottom" Command="{Binding Cancel}">
|
||||
Cancel
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class CustomSplashScreenView : Window
|
||||
{
|
||||
@@ -9,4 +9,3 @@ public partial class CustomSplashScreenView : Window
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
|
||||
x:Class="AvaloniaMiaDev.Views.DragAndDropPageView"
|
||||
x:DataType="viewModels:DragAndDropPageViewModel">
|
||||
|
||||
<Design.DataContext>
|
||||
<viewModels:DragAndDropPageViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20" Name="MainContainer" DragDrop.AllowDrop="True" Background="Transparent">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Drag and Drop</TextBlock>
|
||||
<Button Content="Add Random Task" VerticalAlignment="Top" Command="{Binding AddTaskCommand}" Margin="0 0 0 20" />
|
||||
<StackPanel Orientation="Horizontal" Spacing="25" HorizontalAlignment="Center">
|
||||
|
||||
<!-- Todos column -->
|
||||
<Border Background="DarkGray" Height="450" Width="200" Name="TodoItems"
|
||||
CornerRadius="5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="TODO" TextAlignment="Center" Foreground="Black" FontWeight="Bold"
|
||||
FontSize="22" />
|
||||
<!-- Tickets -->
|
||||
<ItemsRepeater ItemsSource="{Binding TodoTasks}" Margin="15">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Spacing="10" />
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
<!-- Ticket template -->
|
||||
<Border CornerRadius="5" Margin="4 0 4 5" PointerPressed="OnPointerPressed"
|
||||
Padding="10" Background="White"
|
||||
BoxShadow="1 2 3 0 Black"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1.5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding Title}"
|
||||
Foreground="Black"
|
||||
FontWeight="Medium" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!-- Todos column -->
|
||||
|
||||
<!-- Done column -->
|
||||
<Border Background="DarkGray" Height="450" Width="200" Name="DoneItems"
|
||||
CornerRadius="5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="DONE" TextAlignment="Center" Foreground="Black" FontWeight="Bold"
|
||||
FontSize="22" />
|
||||
<!-- Tickets -->
|
||||
<ItemsRepeater ItemsSource="{Binding DoneTasks}" Margin="15">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Spacing="10" />
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
<!-- Ticket template -->
|
||||
<Border CornerRadius="5" Margin="4 0 4 5" PointerPressed="OnPointerPressed"
|
||||
Padding="10" Background="White"
|
||||
BoxShadow="1 2 3 0 Black"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1.5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding Title}"
|
||||
Foreground="Black"
|
||||
FontWeight="Medium" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<!-- Done column -->
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<!-- Our ghost task -->
|
||||
<Border CornerRadius="5" Name="GhostItem"
|
||||
Padding="10" Background="White"
|
||||
BoxShadow="1 2 3 0 Black"
|
||||
BorderBrush="Black" Opacity="0.6"
|
||||
BorderThickness="1.5"
|
||||
Width="100" Height="45">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding DraggingTaskItem.Title, FallbackValue='TEXT'}"
|
||||
Foreground="Black"
|
||||
FontWeight="Medium" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -4,9 +4,9 @@ using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
using AvaloniaApplication.ViewModels;
|
||||
using AvaloniaMiaDev.ViewModels;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class DragAndDropPageView : UserControl
|
||||
{
|
||||
@@ -16,7 +16,7 @@ public partial class DragAndDropPageView : UserControl
|
||||
public DragAndDropPageView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
AddHandler(DragDrop.DragOverEvent, DragOver);
|
||||
AddHandler(DragDrop.DropEvent, Drop);
|
||||
}
|
||||
@@ -42,12 +42,12 @@ public partial class DragAndDropPageView : UserControl
|
||||
var offsetX = mousePos.X - ghostPos.X;
|
||||
var offsetY = mousePos.Y - ghostPos.Y + _mouseOffset.X;
|
||||
GhostItem.RenderTransform = new TranslateTransform(offsetX, offsetY);
|
||||
|
||||
|
||||
if (DataContext is not DragAndDropPageViewModel vm) return;
|
||||
vm.StartDrag(taskItem);
|
||||
|
||||
GhostItem.IsVisible = true;
|
||||
|
||||
|
||||
var dragData = new DataObject();
|
||||
dragData.Set(DragAndDropPageViewModel.CustomFormat, taskItem);
|
||||
var result = await DragDrop.DoDragDrop(e, dragData, DragDropEffects.Move);
|
||||
@@ -63,7 +63,7 @@ public partial class DragAndDropPageView : UserControl
|
||||
var offsetY = currentPosition.Y - _ghostPosition.Y;
|
||||
|
||||
GhostItem.RenderTransform = new TranslateTransform(offsetX, offsetY);
|
||||
|
||||
|
||||
// set drag cursor icon
|
||||
e.DragEffects = DragDropEffects.Move;
|
||||
if (DataContext is not DragAndDropPageViewModel vm) return;
|
||||
@@ -0,0 +1,25 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="400"
|
||||
x:Class="AvaloniaMiaDev.Views.FluentSplashScreenView">
|
||||
<Panel Background="#1e1e1e">
|
||||
<StackPanel Spacing="10"
|
||||
VerticalAlignment="Center">
|
||||
<Image Source="/Assets/logo_big_no_bg.png"
|
||||
Width="250"
|
||||
Height="250" />
|
||||
|
||||
<ProgressBar Name="ProgressBar1"
|
||||
MaxWidth="200"
|
||||
Margin="0" />
|
||||
|
||||
<TextBlock Text="Loading..."
|
||||
Name="LoadingText"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="20"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</Panel>
|
||||
</UserControl>
|
||||
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class FluentSplashScreenView : UserControl
|
||||
{
|
||||
@@ -11,7 +11,7 @@ public partial class FluentSplashScreenView : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
public async Task InitApp()
|
||||
{
|
||||
var start = DateTime.Now.Ticks;
|
||||
@@ -0,0 +1,27 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:templates="clr-namespace:AvaloniaMiaDev.Templates"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700"
|
||||
x:Class="AvaloniaMiaDev.Views.GridPageView">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Grids</TextBlock>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Standard Grid</TextBlock>
|
||||
<templates:ContentExample>
|
||||
|
||||
<Grid RowDefinitions="Auto, *">
|
||||
<StackPanel Spacing="5" Margin="0 0 0 10">
|
||||
<Button Click="Start_OnClick" Width="70" HorizontalContentAlignment="Center">START</Button>
|
||||
<Button Click="Stop_OnClick" Width="70" HorizontalContentAlignment="Center">STOP</Button>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1" Name="MainGrid" Background="DimGray">
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</templates:ContentExample>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,37 +1,41 @@
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class GridPageView : UserControl
|
||||
{
|
||||
private const int Rows = 10;
|
||||
private const int Cols = 10;
|
||||
private readonly int _rows;
|
||||
private readonly int _cols;
|
||||
private readonly IBrush _baseColor = Brushes.LightGray;
|
||||
private bool _stop;
|
||||
|
||||
public GridPageView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_rows = _cols = OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() ? 6 : 10;
|
||||
|
||||
InitGrid();
|
||||
}
|
||||
|
||||
private void InitGrid()
|
||||
{
|
||||
MainGrid.Height = 500;
|
||||
MainGrid.Width = 500;
|
||||
MainGrid.Height = 50 * _rows;
|
||||
MainGrid.Width = 50 * _cols;
|
||||
|
||||
MainGrid.ShowGridLines = true;
|
||||
|
||||
for (var j = 0; j < Rows; j++)
|
||||
for (var j = 0; j < _rows; j++)
|
||||
{
|
||||
MainGrid.RowDefinitions.Add(new RowDefinition(GridLength.Star));
|
||||
MainGrid.ColumnDefinitions.Add(new ColumnDefinition(GridLength.Star));
|
||||
for (var i = 0; i < Cols; i++)
|
||||
for (var i = 0; i < _cols; i++)
|
||||
{
|
||||
var child = new Rectangle
|
||||
{
|
||||
@@ -44,7 +48,7 @@ public partial class GridPageView : UserControl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async void Start_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_stop = false;
|
||||
@@ -60,7 +64,7 @@ public partial class GridPageView : UserControl
|
||||
}
|
||||
if (previous is not null) previous.Fill = _baseColor;
|
||||
}
|
||||
|
||||
|
||||
private void Stop_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
_stop = true;
|
||||
@@ -0,0 +1,17 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaMiaDev.Views.HomePageView"
|
||||
x:DataType="viewModels:HomePageViewModel">
|
||||
<Grid RowDefinitions="Auto, *" Margin="20">
|
||||
<TextBlock Grid.Row="0" Margin="0 20" FontSize="20" FontWeight="Bold">
|
||||
Homepage
|
||||
</TextBlock>
|
||||
<Border Grid.Row="1" Background="#2d323c" CornerRadius="10">
|
||||
<Image Source="/Assets/Images/logo_big.png" Height="320" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class HomePageView : UserControl
|
||||
{
|
||||
@@ -0,0 +1,51 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
xmlns:converters="clr-namespace:AvaloniaMiaDev.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaMiaDev.Views.ImagePageView"
|
||||
x:DataType="vm:ImagePageViewModel">
|
||||
<UserControl.Resources>
|
||||
<converters:BitmapAssetValueConverter x:Key="BitmapConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:ImagePageViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20" HorizontalAlignment="Left">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Images</TextBlock>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Declarative approach</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="/Assets/Images/chocolate_sample.jpg"
|
||||
MaxWidth="300">
|
||||
</Image>
|
||||
</Border>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Binding converter</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="{Binding ImageSourceString, Converter={StaticResource BitmapConverter}}"
|
||||
MaxWidth="300"
|
||||
HorizontalAlignment="Left" />
|
||||
</Border>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Image from resources</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="{Binding ImageSourceBitmapLocal}"
|
||||
MaxWidth="300"
|
||||
HorizontalAlignment="Left" />
|
||||
</Border>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Image from web</TextBlock>
|
||||
<Border CornerRadius="10" ClipToBounds="True" Width="300">
|
||||
<Image Source="{Binding ImageSourceBitmapWeb^}"
|
||||
MaxWidth="300"
|
||||
HorizontalAlignment="Left" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class ImagePageView : UserControl
|
||||
{
|
||||
@@ -0,0 +1,57 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaMiaDev.Views.MainView"
|
||||
x:DataType="viewModels:MainViewModel">
|
||||
<Design.DataContext>
|
||||
<viewModels:MainViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<SplitView IsPaneOpen="{Binding IsPaneOpen}"
|
||||
CompactPaneLength="46"
|
||||
DisplayMode="CompactInline"
|
||||
OpenPaneLength="300"
|
||||
Background="#1e1e1e"
|
||||
PaneBackground="#1e1e1e">
|
||||
<SplitView.Pane>
|
||||
<StackPanel Orientation="Vertical"
|
||||
Spacing="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top">
|
||||
<Button HorizontalAlignment="Left"
|
||||
Width="32"
|
||||
Height="32"
|
||||
Margin="7 10"
|
||||
Command="{Binding TriggerPaneCommand}">
|
||||
<PathIcon Height="11" Data="{StaticResource LineHorizontal3Regular}" />
|
||||
</Button>
|
||||
<ListBox Margin="2 0 -100 0" Padding="0" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedListItem}">
|
||||
<ListBox.Styles>
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Padding" Value="12 8"></Setter>
|
||||
</Style>
|
||||
</ListBox.Styles>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:ListItemTemplate}">
|
||||
<StackPanel Spacing="17" Orientation="Horizontal">
|
||||
<PathIcon Data="{Binding ListItemIcon}" Width="14" />
|
||||
<TextBlock Text="{Binding Label}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</SplitView.Pane>
|
||||
|
||||
<SplitView.Content>
|
||||
<Border CornerRadius="12 0 0 0"
|
||||
Background="#2d2d2d">
|
||||
<TransitioningContentControl Content="{Binding CurrentPage}" />
|
||||
</Border>
|
||||
</SplitView.Content>
|
||||
</SplitView>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:views="clr-namespace:AvaloniaMiaDev.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700"
|
||||
x:Class="AvaloniaMiaDev.Views.MainWindow"
|
||||
Icon="/Assets/logo_big_no_bg.ico"
|
||||
Title="AvaloniaMiaDev"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Width="1100"
|
||||
Height="700">
|
||||
<views:MainView />
|
||||
</Window>
|
||||
@@ -0,0 +1,18 @@
|
||||
using Avalonia.Controls;
|
||||
using AvaloniaMiaDev.ViewModels;
|
||||
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
// constructor with 1 parameter is needed to stop the DI to instantly create the window (when declared as singleton)
|
||||
// during the startup phase and crashing the whole android app
|
||||
// with "Specified method is not supported window" error
|
||||
public MainWindow(MainViewModel vm)
|
||||
{
|
||||
DataContext = vm;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public MainWindow() : this(new MainViewModel()) { }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
xmlns:templates="clr-namespace:AvaloniaMiaDev.Templates"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaMiaDev.Views.TextPageView"
|
||||
x:DataType="vm:TextPageViewModel">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Text display and editing</TextBlock>
|
||||
<CheckBox Content="Disable controls" IsChecked="{Binding !IsTextEnabled}"></CheckBox>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Standard text block</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<TextBlock IsEnabled="{Binding IsTextEnabled}">Some text</TextBlock>
|
||||
</templates:ContentExample>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class TextPageView : UserControl
|
||||
{
|
||||
@@ -0,0 +1,45 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:AvaloniaMiaDev.ViewModels"
|
||||
xmlns:templates="clr-namespace:AvaloniaMiaDev.Templates"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaMiaDev.Views.ValueSelectionPageView"
|
||||
x:DataType="vm:ValueSelectionPageViewModel">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="20">
|
||||
<TextBlock Margin="0 20" FontSize="20" FontWeight="Bold">Text display and editing</TextBlock>
|
||||
<CheckBox Content="Disable controls" IsChecked="{Binding !IsValueSelectionEnabled}"></CheckBox>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Checkbox</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<CheckBox IsEnabled="{Binding IsValueSelectionEnabled}">Checkbox</CheckBox>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Slider</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="{Binding SliderValue}"
|
||||
HorizontalAlignment="Center" />
|
||||
<Slider IsEnabled="{Binding IsValueSelectionEnabled}"
|
||||
Value="{Binding SliderValue}"
|
||||
IsSnapToTickEnabled="True"
|
||||
TickFrequency="1"
|
||||
TickPlacement="Outside"
|
||||
Maximum="30" />
|
||||
</StackPanel>
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Time picker</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<TimePicker ClockIdentifier="24HourClock" SelectedTime="16:30" />
|
||||
</templates:ContentExample>
|
||||
|
||||
<TextBlock Margin="0 20" FontSize="15" FontWeight="Bold">Calendar</TextBlock>
|
||||
<templates:ContentExample>
|
||||
<Calendar IsEnabled="{Binding IsValueSelectionEnabled}"></Calendar>
|
||||
</templates:ContentExample>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace AvaloniaApplication.Views;
|
||||
namespace AvaloniaMiaDev.Views;
|
||||
|
||||
public partial class ValueSelectionPageView : UserControl
|
||||
{
|
||||