mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 18:20:47 +01:00
Bump version, migrate to FluentAvalonia with bug fixes
This commit is contained in:
66
Needlework.Net.Desktop/Controls/BusyArea.axaml
Normal file
66
Needlework.Net.Desktop/Controls/BusyArea.axaml
Normal file
@@ -0,0 +1,66 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Needlework.Net.Desktop.Controls"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Needlework.Net.Desktop.Controls.BusyArea">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="controls|BusyArea">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Panel>
|
||||
<ContentControl Content="{TemplateBinding Content}"/>
|
||||
<DockPanel Name="LoadingBusyArea"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
LastChildFill="True">
|
||||
<TextBlock Margin="16"
|
||||
DockPanel.Dock="Bottom"
|
||||
HorizontalAlignment="Center"
|
||||
FontWeight="DemiBold"
|
||||
Text="{TemplateBinding BusyText}"/>
|
||||
<ProgressBar
|
||||
Width="100"
|
||||
IsIndeterminate="True"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="controls|BusyArea DockPanel#LoadingBusyArea">
|
||||
<Setter Property="Transitions">
|
||||
<Transitions>
|
||||
<DoubleTransition Property="Opacity" Duration="0:0:0.3" />
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="controls|BusyArea[IsBusy=True] DockPanel#LoadingBusyArea">
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="controls|BusyArea[IsBusy=False] DockPanel#LoadingBusyArea">
|
||||
<Setter Property="Opacity" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="controls|BusyArea ContentControl">
|
||||
<Setter Property="Transitions">
|
||||
<Transitions>
|
||||
<DoubleTransition Property="Opacity" Duration="0:0:0.3"/>
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="controls|BusyArea[IsBusy=True] ContentControl">
|
||||
<Setter Property="Opacity" Value="0.1"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="controls|BusyArea[IsBusy=False] ContentControl">
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
</UserControl>
|
||||
30
Needlework.Net.Desktop/Controls/BusyArea.axaml.cs
Normal file
30
Needlework.Net.Desktop/Controls/BusyArea.axaml.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Needlework.Net.Desktop.Controls;
|
||||
|
||||
public partial class BusyArea : UserControl
|
||||
{
|
||||
public BusyArea()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsBusyProperty =
|
||||
AvaloniaProperty.Register<BusyArea, bool>(nameof(IsBusy), defaultValue: false);
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get { return GetValue(IsBusyProperty); }
|
||||
set { SetValue(IsBusyProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string?> BusyTextProperty =
|
||||
AvaloniaProperty.Register<BusyArea, string?>(nameof(BusyText), defaultValue: null);
|
||||
|
||||
public string? BusyText
|
||||
{
|
||||
get => GetValue(BusyTextProperty);
|
||||
set => SetValue(BusyTextProperty, value);
|
||||
}
|
||||
}
|
||||
20
Needlework.Net.Desktop/Controls/Card.axaml
Normal file
20
Needlework.Net.Desktop/Controls/Card.axaml
Normal file
@@ -0,0 +1,20 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Needlework.Net.Desktop.Controls">
|
||||
<Design.PreviewWith>
|
||||
<controls:Card />
|
||||
</Design.PreviewWith>
|
||||
|
||||
<Style Selector="controls|Card">
|
||||
<!-- Set Defaults -->
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border Padding="16"
|
||||
CornerRadius="16,16,16,16"
|
||||
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}">
|
||||
<ContentPresenter Content="{TemplateBinding Content}"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Styles>
|
||||
10
Needlework.Net.Desktop/Controls/Card.axaml.cs
Normal file
10
Needlework.Net.Desktop/Controls/Card.axaml.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Needlework.Net.Desktop.Controls;
|
||||
|
||||
public class Card : ContentControl
|
||||
{
|
||||
public Card()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user