mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-16 21:21:03 +08:00
refactor ResourceBindingsDisposable implementation
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="AtomUI.Controls.DataGrid" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.Win32" Version="$(AvaloniaVersion)"/>
|
||||
<PackageVersion Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)"/>
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CS7035</NoWarn>
|
||||
<AvaloniaVersion>11.3.2</AvaloniaVersion>
|
||||
<AtomUIVersion>0.0.6-build.1</AtomUIVersion>
|
||||
<AtomUIVersion>0.0.6-build.2</AtomUIVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -4,26 +4,52 @@ param (
|
||||
[string]$preReleaseTag
|
||||
)
|
||||
|
||||
function Push-NuGetPackages {
|
||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||
param(
|
||||
[string]$PackagePath = "../output/Nuget",
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Source
|
||||
)
|
||||
|
||||
# 获取所有NuGet包
|
||||
$packages = Get-ChildItem -Path $PackagePath -Filter *.nupkg -Recurse -File
|
||||
|
||||
if (-not $packages) {
|
||||
Write-Warning "未找到任何.nupkg文件"
|
||||
return
|
||||
}
|
||||
|
||||
# 处理每个包
|
||||
foreach ($pkg in $packages) {
|
||||
if ($PSCmdlet.ShouldProcess($pkg.Name, "推送并删除")) {
|
||||
try {
|
||||
# 推送包
|
||||
dotnet nuget push $pkg.FullName --source $Source
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
# 删除成功推送的包
|
||||
Remove-Item $pkg.FullName -Force
|
||||
Write-Host "✓ 成功: $($pkg.Name)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Warning "推送失败: $($pkg.Name) (退出码: $LASTEXITCODE)"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "处理 $($pkg.Name) 时出错: $_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dotnet build -v diag --configuration $buildType ../packages/AtomUI/AtomUI.csproj
|
||||
dotnet build -v diag --configuration $buildType ../src/AtomUI.Controls.DataGrid/AtomUI.Controls.DataGrid.csproj
|
||||
dotnet pack --no-build --configuration $buildType ../packages/AtomUI/AtomUI.csproj
|
||||
dotnet pack --no-build --configuration $buildType ../src/AtomUI.IconPkg.Generator/AtomUI.IconPkg.Generator.csproj
|
||||
dotnet pack --no-build --configuration $buildType ../src/AtomUI.Generator/AtomUI.Generator.csproj
|
||||
|
||||
Push-NuGetPackages -Source $localSourcesDir -Confirm:$false
|
||||
|
||||
dotnet build -v diag --configuration $buildType ../src/AtomUI.Controls.DataGrid/AtomUI.Controls.DataGrid.csproj
|
||||
dotnet pack --no-build --configuration $buildType ../src/AtomUI.Controls.DataGrid/AtomUI.Controls.DataGrid.csproj
|
||||
|
||||
# 探测包
|
||||
$packages = Get-ChildItem -Path ../output/Nuget -Filter *.nupkg -Recurse -File
|
||||
|
||||
foreach ($pkg in $packages) {
|
||||
try {
|
||||
# 执行 NuGet 推送命令
|
||||
dotnet nuget push $pkg.FullName --source $localSourcesDir
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Warning "推送失败: $($pkg.Name)"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "推送 $($pkg.Name) 时发生异常: $_"
|
||||
}
|
||||
}
|
||||
Push-NuGetPackages -Source $localSourcesDir -Confirm:$false
|
||||
|
||||
@@ -44,7 +44,12 @@ internal class DataGridRowExpander : ToggleButton,
|
||||
}
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
private Rectangle? _horizontalIndicator;
|
||||
private Rectangle? _verticalIndicator;
|
||||
|
||||
@@ -209,7 +209,13 @@ public partial class DataGrid
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => DataGridToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -177,7 +177,11 @@ public class AddOnDecoratedBox : ContentControl,
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => AddOnDecoratedBoxToken.ID;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -117,7 +117,11 @@ public class Alert : TemplatedControl,
|
||||
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => AlertToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -41,7 +41,11 @@ internal class DotBadgeIndicator : Control,
|
||||
set => SetValue(BadgeShadowSizeProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
private BoxShadows _boxShadows;
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
@@ -99,7 +99,11 @@ internal class ButtonSpinnerInnerBox : AddOnDecoratedInnerBox,
|
||||
set => SetAndRaise(SpinnerHandleWidthTokenProperty, ref _spinnerHandleWidthToken, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reactive.Disposables;
|
||||
using AtomUI.Animations;
|
||||
using AtomUI.Controls.Themes;
|
||||
@@ -40,7 +41,7 @@ public enum ButtonShape
|
||||
|
||||
[PseudoClasses(
|
||||
ButtonPseudoClass.IconOnly,
|
||||
ButtonPseudoClass.Loading,
|
||||
ButtonPseudoClass.Loading,
|
||||
ButtonPseudoClass.IsDanger,
|
||||
ButtonPseudoClass.DefaultType,
|
||||
ButtonPseudoClass.PrimaryType,
|
||||
@@ -73,10 +74,10 @@ public class Button : AvaloniaButton,
|
||||
public static readonly StyledProperty<ButtonSizeType> SizeTypeProperty =
|
||||
SizeTypeAwareControlProperty.SizeTypeProperty.AddOwner<Button>();
|
||||
|
||||
public static readonly StyledProperty<Icon?> IconProperty =
|
||||
public static readonly StyledProperty<Icon?> IconProperty =
|
||||
AvaloniaProperty.Register<Button, Icon?>(nameof(Icon));
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty =
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty =
|
||||
MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<Button>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty =
|
||||
@@ -123,7 +124,7 @@ public class Button : AvaloniaButton,
|
||||
get => GetValue(IconProperty);
|
||||
set => SetValue(IconProperty, value);
|
||||
}
|
||||
|
||||
|
||||
public bool IsMotionEnabled
|
||||
{
|
||||
get => GetValue(IsMotionEnabledProperty);
|
||||
@@ -151,20 +152,20 @@ public class Button : AvaloniaButton,
|
||||
internal static readonly StyledProperty<BoxShadow> DangerShadowProperty =
|
||||
AvaloniaProperty.Register<Button, BoxShadow>(
|
||||
nameof(DangerShadow));
|
||||
|
||||
internal static readonly StyledProperty<bool> IsIconVisibleProperty =
|
||||
|
||||
internal static readonly StyledProperty<bool> IsIconVisibleProperty =
|
||||
AvaloniaProperty.Register<Button, bool>(nameof(IsIconVisible), true);
|
||||
|
||||
internal static readonly StyledProperty<object?> RightExtraContentProperty =
|
||||
AvaloniaProperty.Register<Button, object?>(nameof(RightExtraContent));
|
||||
|
||||
|
||||
internal static readonly StyledProperty<IDataTemplate?> RightExtraContentTemplateProperty =
|
||||
AvaloniaProperty.Register<ContentControl, IDataTemplate?>(nameof(RightExtraContentTemplate));
|
||||
|
||||
internal static readonly StyledProperty<Thickness> EffectiveBorderThicknessProperty =
|
||||
AvaloniaProperty.Register<Button, Thickness>(
|
||||
nameof(EffectiveBorderThickness));
|
||||
|
||||
|
||||
internal BoxShadow DefaultShadow
|
||||
{
|
||||
get => GetValue(DefaultShadowProperty);
|
||||
@@ -182,7 +183,7 @@ public class Button : AvaloniaButton,
|
||||
get => GetValue(DangerShadowProperty);
|
||||
set => SetValue(DangerShadowProperty, value);
|
||||
}
|
||||
|
||||
|
||||
internal bool IsIconVisible
|
||||
{
|
||||
get => GetValue(IsIconVisibleProperty);
|
||||
@@ -200,22 +201,28 @@ public class Button : AvaloniaButton,
|
||||
get => GetValue(RightExtraContentTemplateProperty);
|
||||
set => SetValue(RightExtraContentTemplateProperty, value);
|
||||
}
|
||||
|
||||
|
||||
public Thickness EffectiveBorderThickness
|
||||
{
|
||||
get => GetValue(EffectiveBorderThicknessProperty);
|
||||
set => SetValue(EffectiveBorderThicknessProperty, value);
|
||||
}
|
||||
|
||||
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => ButtonToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
private Border? _frame;
|
||||
protected bool _themeConfigured;
|
||||
|
||||
static Button()
|
||||
{
|
||||
@@ -231,11 +238,12 @@ public class Button : AvaloniaButton,
|
||||
{
|
||||
this.RegisterResources();
|
||||
this.BindWaveSpiritProperties();
|
||||
_resourceBindingsDisposable = new CompositeDisposable();
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
var size = base.MeasureOverride(availableSize);
|
||||
var size = base.MeasureOverride(availableSize);
|
||||
var targetWidth = size.Width;
|
||||
var targetHeight = size.Height;
|
||||
|
||||
@@ -251,15 +259,8 @@ public class Button : AvaloniaButton,
|
||||
CornerRadius = new CornerRadius(targetHeight);
|
||||
targetWidth = Math.Max(targetWidth, targetHeight + targetHeight / 2);
|
||||
}
|
||||
|
||||
return new Size(targetWidth, targetHeight);
|
||||
}
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
_resourceBindingsDisposable = new CompositeDisposable();
|
||||
SetupControlThemeBindings();
|
||||
base.OnAttachedToLogicalTree(e);
|
||||
return new Size(targetWidth, targetHeight);
|
||||
}
|
||||
|
||||
private void SetupShadows()
|
||||
@@ -312,12 +313,6 @@ public class Button : AvaloniaButton,
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnDetachedFromLogicalTree(e);
|
||||
this.DisposeTokenBindings();
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnPropertyChanged(e);
|
||||
@@ -372,10 +367,10 @@ public class Button : AvaloniaButton,
|
||||
}
|
||||
|
||||
if (this.IsAttachedToVisualTree())
|
||||
{
|
||||
{
|
||||
if (e.Property == IsDangerProperty ||
|
||||
e.Property == IsGhostProperty ||
|
||||
e.Property == ButtonTypeProperty)
|
||||
e.Property == IsGhostProperty ||
|
||||
e.Property == ButtonTypeProperty)
|
||||
{
|
||||
SetupShadows();
|
||||
}
|
||||
@@ -395,27 +390,26 @@ public class Button : AvaloniaButton,
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void SetupControlThemeBindings()
|
||||
protected virtual void SetupControlThemeBindings(bool force = false)
|
||||
{
|
||||
if (ButtonType == ButtonType.Default)
|
||||
if (!_themeConfigured || force)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, DefaultButtonTheme.ID));
|
||||
}
|
||||
else if (ButtonType == ButtonType.Primary)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, PrimaryButtonTheme.ID));
|
||||
}
|
||||
else if (ButtonType == ButtonType.Text)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, TextButtonTheme.ID));
|
||||
}
|
||||
else if (ButtonType == ButtonType.Link)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, LinkButtonTheme.ID));
|
||||
if (ButtonType == ButtonType.Default)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, DefaultButtonTheme.ID);
|
||||
}
|
||||
else if (ButtonType == ButtonType.Primary)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, PrimaryButtonTheme.ID);
|
||||
}
|
||||
else if (ButtonType == ButtonType.Text)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, TextButtonTheme.ID);
|
||||
}
|
||||
else if (ButtonType == ButtonType.Link)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, LinkButtonTheme.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +422,7 @@ public class Button : AvaloniaButton,
|
||||
_frame.Transitions = new Transitions();
|
||||
_frame.Transitions.Add(TransitionUtils.CreateTransition<SolidColorBrushTransition>(BackgroundProperty));
|
||||
}
|
||||
|
||||
|
||||
if (Transitions is null)
|
||||
{
|
||||
var transitions = new Transitions();
|
||||
@@ -438,7 +432,8 @@ public class Button : AvaloniaButton,
|
||||
{
|
||||
transitions.Add(
|
||||
TransitionUtils.CreateTransition<SolidColorBrushTransition>(BorderBrushProperty));
|
||||
transitions.Add(TransitionUtils.CreateTransition<SolidColorBrushTransition>(ForegroundProperty));
|
||||
transitions.Add(
|
||||
TransitionUtils.CreateTransition<SolidColorBrushTransition>(ForegroundProperty));
|
||||
}
|
||||
}
|
||||
else if (ButtonType == ButtonType.Default)
|
||||
@@ -474,9 +469,16 @@ public class Button : AvaloniaButton,
|
||||
ConfigureTransitions();
|
||||
}
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToLogicalTree(e);
|
||||
SetupControlThemeBindings();
|
||||
}
|
||||
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnAttachedToVisualTree(e);
|
||||
_resourceBindingsDisposable = new CompositeDisposable();
|
||||
this.AddResourceBindingDisposable(TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty,
|
||||
SharedTokenKey.BorderThickness,
|
||||
BindingPriority.Template,
|
||||
@@ -486,6 +488,12 @@ public class Button : AvaloniaButton,
|
||||
UpdatePseudoClasses();
|
||||
}
|
||||
|
||||
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnDetachedFromVisualTree(e);
|
||||
this.DisposeTokenBindings();
|
||||
}
|
||||
|
||||
private void SetupEffectiveBorderThickness()
|
||||
{
|
||||
if (ButtonType == ButtonType.Default)
|
||||
@@ -511,7 +519,8 @@ public class Button : AvaloniaButton,
|
||||
|
||||
public Rect WaveGeometry()
|
||||
{
|
||||
return new Rect(0, 0, Bounds.Width, Bounds.Height);
|
||||
Debug.Assert(_frame != null);
|
||||
return _frame.Bounds;
|
||||
}
|
||||
|
||||
public CornerRadius WaveBorderRadius()
|
||||
|
||||
@@ -147,27 +147,26 @@ public class DropdownButton : Button
|
||||
_flyoutStateHelper.ClickHideFlyoutPredicate = ClickHideFlyoutPredicate;
|
||||
}
|
||||
|
||||
protected override void SetupControlThemeBindings()
|
||||
protected override void SetupControlThemeBindings(bool force = false)
|
||||
{
|
||||
if (ButtonType == ButtonType.Default)
|
||||
if (!_themeConfigured || force)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, DefaultDropdownButtonTheme.ID));
|
||||
}
|
||||
else if (ButtonType == ButtonType.Primary)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, PrimaryDropdownButtonTheme.ID));
|
||||
}
|
||||
else if (ButtonType == ButtonType.Text)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, TextDropdownButtonTheme.ID));
|
||||
}
|
||||
else if (ButtonType == ButtonType.Link)
|
||||
{
|
||||
this.AddResourceBindingDisposable(
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, LinkDropdownButtonTheme.ID));
|
||||
if (ButtonType == ButtonType.Default)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, DefaultDropdownButtonTheme.ID);
|
||||
}
|
||||
else if (ButtonType == ButtonType.Primary)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, PrimaryDropdownButtonTheme.ID);
|
||||
}
|
||||
else if (ButtonType == ButtonType.Text)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, TextDropdownButtonTheme.ID);
|
||||
}
|
||||
else if (ButtonType == ButtonType.Link)
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, ThemeProperty, LinkDropdownButtonTheme.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +265,11 @@ public class SplitButton : ContentControl,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => ButtonToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
Converter="{x:Static atom:BaseButtonTheme.ButtonIconVisibleConverter}">
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Icon" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="IsIconVisible" />
|
||||
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="IsLoading" />
|
||||
</MultiBinding>
|
||||
</atom:IconPresenter.IsVisible>
|
||||
</atom:IconPresenter>
|
||||
@@ -43,12 +44,15 @@
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:is(atom|Button)">
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="DefaultShadow" Value="{DynamicResource {x:Static atom:ButtonTokenKey.DefaultShadow}}" />
|
||||
<Setter Property="PrimaryShadow" Value="{DynamicResource {x:Static atom:ButtonTokenKey.PrimaryShadow}}" />
|
||||
<Setter Property="DangerShadow" Value="{DynamicResource {x:Static atom:ButtonTokenKey.DangerShadow}}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
|
||||
<Style Selector="^/template/ Border#PART_Frame">
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
</Style>
|
||||
|
||||
<!-- BuildSizeStyle 开始 -->
|
||||
<Style Selector="^[SizeType=Large]">
|
||||
|
||||
@@ -8,12 +8,13 @@ public class ButtonIconVisibleConverter : IMultiValueConverter
|
||||
{
|
||||
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values.Count != 2)
|
||||
if (values.Count != 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var icon = values[0] as Icon;
|
||||
var iconVisible = values[1] as bool?;
|
||||
return icon != null && iconVisible == true;
|
||||
var icon = values[0] as Icon;
|
||||
var iconVisible = values[1] as bool?;
|
||||
var isLoading = values[2] as bool?;
|
||||
return icon != null && iconVisible == true && isLoading != true;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,11 @@ internal class BaseCalendarDayButton : AvaloniaButton,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -593,7 +593,11 @@ public class Calendar : TemplatedControl,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => CalendarToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -241,7 +241,11 @@ internal class CalendarItem : TemplatedControl,
|
||||
}
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
@@ -134,7 +134,11 @@ internal class CheckBoxIndicator : Control,
|
||||
set => SetValue(IsWaveSpiritEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -127,7 +127,11 @@ public class Collapse : SelectingItemsControl,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => CollapseToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -40,7 +40,12 @@ internal sealed class CalendarDayButton : AvaloniaButton,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -205,8 +205,12 @@ internal class CalendarItem : TemplatedControl,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -110,7 +110,11 @@ internal class DatePickerPresenter : PickerPresenterBase,
|
||||
set => SetValue(TempSelectedTimeProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -193,7 +193,11 @@ public class Drawer : Control,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => DrawerToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -181,7 +181,11 @@ public class Expander : AvaloniaExpander,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => ExpanderToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -188,7 +188,11 @@ public class FlyoutHost : Control,
|
||||
#region 内部属性定义
|
||||
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -72,7 +72,12 @@ public class MenuFlyoutPresenter : MenuBase,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => MenuToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -97,7 +97,11 @@ public class GroupBox : ContentControl,
|
||||
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => GroupBoxToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -94,7 +94,11 @@ public class TextBox : AvaloniaTextBox,
|
||||
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => LineEditToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -53,7 +53,12 @@ public class ListBox : AvaloniaListBox,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => ListBoxToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -44,7 +44,11 @@ public class Menu : AvaloniaMenu,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => MenuToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -32,7 +32,11 @@ public class MenuSeparator : AvaloniaSeparator,
|
||||
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => MenuToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -127,7 +127,11 @@ public class NavMenu : NavMenuBase,
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
private ItemsPresenter? _menuItemsPresenter;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
public NavMenu()
|
||||
{
|
||||
|
||||
@@ -54,7 +54,11 @@ internal class NotificationProgressBar : Control,
|
||||
|
||||
#region 内部属性定义
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -99,7 +99,12 @@ public abstract class AbstractPagination : TemplatedControl,
|
||||
|
||||
#region 内部属性定义
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -11,7 +11,11 @@ internal class PageSizeComboBoxItem : ComboBoxItem,
|
||||
public int PageSize { get; set; }
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,11 @@ internal class PaginationNav : SelectingItemsControl,
|
||||
|
||||
#region 内部属性
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -141,7 +145,12 @@ internal class PaginationNav : SelectingItemsControl,
|
||||
internal class NavItemsPresenter : ItemsPresenter,
|
||||
IResourceBindingManager
|
||||
{
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
internal static readonly DirectProperty<NavItemsPresenter, bool> IsEnabledSpacingProperty =
|
||||
|
||||
@@ -87,7 +87,11 @@ internal class PaginationNavItem : ContentControl,
|
||||
private set => SetAndRaise(IsPressedProperty, ref _isPressed, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
|
||||
@@ -57,7 +57,11 @@ internal class QuickJumperBar : TemplatedControl,
|
||||
set => SetValue(SizeTypeProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
private LineEdit? _lineEdit;
|
||||
|
||||
@@ -121,7 +121,11 @@ public class Popup : AvaloniaPopup,
|
||||
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -135,7 +135,11 @@ internal class RadioIndicator : Control,
|
||||
set => SetValue(IsWaveAnimationEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -288,8 +288,11 @@ public class SliderTrack : Control,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 事件定义
|
||||
|
||||
@@ -118,7 +118,11 @@ internal class SwitchKnob : Control,
|
||||
set => SetAndRaise(LoadingBgOpacityTokenProperty, ref _loadingBgOpacity, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorTextLightSolid}}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
|
||||
<Setter Property="TrackPadding" Value="{DynamicResource {x:Static atom:ToggleSwitchTokenKey.TrackPadding}}"/>
|
||||
|
||||
<Style Selector="^[IsLoading=True], ^:disabled">
|
||||
|
||||
@@ -369,7 +369,7 @@ public class ToggleSwitch : ToggleButton,
|
||||
|
||||
private void AdjustOffsetOnReleased()
|
||||
{
|
||||
CalculateElementsOffset(Bounds.Size);
|
||||
CalculateElementsOffset(DesiredSize);
|
||||
|
||||
if (_switchKnob is not null)
|
||||
{
|
||||
@@ -415,7 +415,7 @@ public class ToggleSwitch : ToggleButton,
|
||||
{
|
||||
if (e.Property == IsCheckedProperty && IsMotionEnabled)
|
||||
{
|
||||
CalculateElementsOffset(Bounds.Size);
|
||||
CalculateElementsOffset(DesiredSize);
|
||||
WaveSpiritAdorner.ShowWaveAdorner(this, WaveType.PillWave);
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ public class ToggleSwitch : ToggleButton,
|
||||
public sealed override void Render(DrawingContext context)
|
||||
{
|
||||
using var state = context.PushOpacity(SwitchOpacity);
|
||||
context.DrawPilledRect(GrooveBackground, null, new Rect(0, 0, Bounds.Width, Bounds.Height));
|
||||
context.DrawPilledRect(GrooveBackground, null, new Rect(0, 0, DesiredSize.Width, DesiredSize.Height));
|
||||
}
|
||||
|
||||
public bool HitTest(Point point)
|
||||
@@ -582,12 +582,12 @@ public class ToggleSwitch : ToggleButton,
|
||||
|
||||
private Rect GrooveRect()
|
||||
{
|
||||
return new Rect(new Point(0, 0), Bounds.Size);
|
||||
return new Rect(new Point(0, 0), DesiredSize);
|
||||
}
|
||||
|
||||
private Rect HandleRect()
|
||||
{
|
||||
return HandleRect(IsChecked.HasValue && IsChecked.Value, Bounds.Size);
|
||||
return HandleRect(IsChecked.HasValue && IsChecked.Value, DesiredSize);
|
||||
}
|
||||
|
||||
private Rect HandleRect(bool isChecked, Size controlSize)
|
||||
|
||||
@@ -95,7 +95,11 @@ public class BaseTabControl : AvaloniaTabControl,
|
||||
private Point _tabStripBorderStartPoint;
|
||||
private Point _tabStripBorderEndPoint;
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
static BaseTabControl()
|
||||
{
|
||||
|
||||
@@ -77,7 +77,11 @@ internal abstract class BaseTabScrollViewer : ScrollViewer,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -86,7 +86,11 @@ public class TabItem : AvaloniaTabItem,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -69,7 +69,11 @@ public abstract class BaseTabStrip : AvaloniaTabStrip,
|
||||
Control IMotionAwareControl.PropertyBindTarget => this;
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => TabControlToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -102,7 +102,11 @@ public class TabStripItem : AvaloniaTabStripItem,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -158,7 +158,11 @@ public class Tag : TemplatedControl,
|
||||
|
||||
Control IControlSharedTokenResourcesHost.HostControl => this;
|
||||
string IControlSharedTokenResourcesHost.TokenId => TagToken.ID;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
<ControlTheme x:Key="{x:Type atom:Tag}" TargetType="atom:Tag">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Panel>
|
||||
<Border Name="{x:Static atom:TagThemeConstants.FramePart}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" />
|
||||
<Border Name="{x:Static atom:TagThemeConstants.FramePart}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
>
|
||||
<Grid Name="{x:Static atom:TagThemeConstants.ElementsLayoutPart}"
|
||||
ColumnDefinitions="Auto, *, Auto"
|
||||
Margin="{TemplateBinding Padding}">
|
||||
@@ -18,16 +20,16 @@
|
||||
Grid.Column="0"
|
||||
Icon="{TemplateBinding Icon}" />
|
||||
<atom:TextBlock Name="{x:Static atom:TagThemeConstants.TagTextLabelPart}"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="{TemplateBinding TagText}"
|
||||
Padding="{TemplateBinding TagTextPaddingInline}" />
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Text="{TemplateBinding TagText}"
|
||||
Padding="{TemplateBinding TagTextPaddingInline}" />
|
||||
<atom:IconButton Name="{x:Static atom:TagThemeConstants.CloseButtonPart}"
|
||||
Grid.Column="2"
|
||||
IsVisible="{TemplateBinding IsClosable}"
|
||||
Icon="{TemplateBinding CloseIcon}" />
|
||||
</Grid>
|
||||
</Panel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<!-- basic 样式开始 -->
|
||||
|
||||
@@ -15,7 +15,11 @@ public class TextBlock : AvaloniaTextBlock, IResourceBindingManager
|
||||
{
|
||||
#region 内部属性定义
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -116,7 +116,11 @@ internal class DateTimePickerPanel : Panel,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 内部事件定义
|
||||
|
||||
@@ -108,7 +108,11 @@ internal class TimePickerPresenter : PickerPresenterBase,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -146,7 +146,11 @@ internal class TimeView : TemplatedControl,
|
||||
set => SetValue(IsMotionEnabledProperty, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -232,11 +236,12 @@ internal class TimeView : TemplatedControl,
|
||||
var inputManager = AvaloniaLocator.Current.GetService<IInputManager>()!;
|
||||
_pointerPositionDisposable = inputManager.Process.Subscribe(DetectPointerPosition);
|
||||
SyncTimeValueToPanel(SelectedTime ?? TimeSpan.Zero);
|
||||
this.AddResourceBindingDisposable(TokenResourceBinder.CreateTokenBinding(this, SpacerWidthProperty, SharedTokenKey.LineWidth,
|
||||
this.AddResourceBindingDisposable(TokenResourceBinder.CreateTokenBinding(this, SpacerWidthProperty,
|
||||
SharedTokenKey.LineWidth,
|
||||
BindingPriority.Template,
|
||||
new RenderScaleAwareDoubleConfigure(this)));
|
||||
}
|
||||
|
||||
|
||||
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnDetachedFromVisualTree(e);
|
||||
|
||||
@@ -168,8 +168,11 @@ internal class TimelineIndicator : Control,
|
||||
set => SetAndRaise(NextIsPendingProperty, ref _nextIsPending, value);
|
||||
}
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
@@ -59,7 +59,11 @@ internal class DragPreview : Decorator,
|
||||
}
|
||||
|
||||
private readonly VisualBrush _visualBrush;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
private CompositeDisposable? _resourceBindingsDisposable;
|
||||
|
||||
public DragPreview(Border previewControl)
|
||||
|
||||
@@ -326,7 +326,11 @@ public class TreeViewItem : AvaloniaTreeItem,
|
||||
|
||||
internal TreeView? OwnerTreeView { get; set; }
|
||||
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable => _resourceBindingsDisposable;
|
||||
CompositeDisposable? IResourceBindingManager.ResourceBindingsDisposable
|
||||
{
|
||||
get => _resourceBindingsDisposable;
|
||||
set => _resourceBindingsDisposable = value;
|
||||
}
|
||||
private bool _tempAnimationDisabled = false;
|
||||
private ITreeViewInteractionHandler? TreeViewInteractionHandler => this.FindLogicalAncestorOfType<TreeView>()?.InteractionHandler;
|
||||
|
||||
|
||||
@@ -4,4 +4,5 @@ using AvaloniaWindow = Avalonia.Controls.Window;
|
||||
|
||||
public class Window : AvaloniaWindow
|
||||
{
|
||||
protected override Type StyleKeyOverride { get; } = typeof(Window);
|
||||
}
|
||||
@@ -6,7 +6,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../AtomUI.Controls/AtomUI.Controls.csproj" />
|
||||
<ProjectReference Include="../AtomUI.Controls/AtomUI.Controls.csproj"/>
|
||||
<PackageReference Include="Avalonia.ReactiveUI"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics"/>
|
||||
<PackageReference Include="Avalonia.Fonts.Inter"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace AtomUI.Theme;
|
||||
|
||||
public interface IResourceBindingManager
|
||||
{
|
||||
CompositeDisposable? ResourceBindingsDisposable { get; }
|
||||
CompositeDisposable? ResourceBindingsDisposable { get; set; }
|
||||
}
|
||||
|
||||
public static class StyledElementTokenBindingsExtensions
|
||||
@@ -65,7 +65,7 @@ public static class StyledElementTokenBindingsExtensions
|
||||
var consumer = control as IResourceBindingManager;
|
||||
Debug.Assert(consumer != null, $"{control.GetType()} is not IResourceBindingManager");
|
||||
consumer.ResourceBindingsDisposable?.Dispose();
|
||||
consumer.ResourceBindingsDisposable?.Clear();
|
||||
consumer.ResourceBindingsDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Styling;
|
||||
using DynamicData;
|
||||
|
||||
namespace AtomUI.Theme;
|
||||
|
||||
@@ -286,7 +285,10 @@ public class ThemeManager : Styles, IThemeManager
|
||||
{
|
||||
foreach (var provider in _controlThemesProviders)
|
||||
{
|
||||
Resources.MergedDictionaries.AddRange(provider.ControlThemes);
|
||||
foreach (var resourceProvider in provider.ControlThemes)
|
||||
{
|
||||
Resources.MergedDictionaries.Add(resourceProvider);
|
||||
}
|
||||
}
|
||||
_controlThemesProviders.Clear();
|
||||
BuildLanguageResources();
|
||||
|
||||
Reference in New Issue
Block a user