4 Commits

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

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