Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
MakesYT committed May 6, 2024
1 parent be4529b commit d6ce847
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 274 deletions.
29 changes: 11 additions & 18 deletions KitopiaAvalonia/Controls/ListShow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Data;
using Avalonia.Interactivity;
using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.Core;
using ReactiveUI;

namespace KitopiaAvalonia.Controls;

public class ListShow : ListBox
public class ListShow : ListBox
{
//ObservableCollection

//DelCommand
public static readonly StyledProperty<ICommand> DelCommandProperty = AvaloniaProperty.Register<ListShow, ICommand>(nameof(DelCommand));
public static readonly StyledProperty<bool> WithAddProperty = AvaloniaProperty.Register<ListShow, bool>(nameof(WithAdd),false);
public static readonly StyledProperty<ICommand> AddCommandProperty = AvaloniaProperty.Register<ListShow, ICommand>(nameof(AddCommand));
public static readonly StyledProperty<ICommand> DelCommandProperty =
AvaloniaProperty.Register<ListShow, ICommand>(nameof(DelCommand));

public static readonly StyledProperty<string> TextValueProperty = AvaloniaProperty.Register<ListShow, string>(nameof(TextValue));
public static readonly StyledProperty<bool> WithAddProperty =
AvaloniaProperty.Register<ListShow, bool>(nameof(WithAdd), false);

public static readonly StyledProperty<ICommand> AddCommandProperty =
AvaloniaProperty.Register<ListShow, ICommand>(nameof(AddCommand));

public static readonly StyledProperty<string> TextValueProperty =
AvaloniaProperty.Register<ListShow, string>(nameof(TextValue));

//设置默认DelCommand
public ListShow()
Expand Down Expand Up @@ -69,8 +67,6 @@ private void OnAdd(string? obj)
list.Add(obj);
TextValue = "";
}


}

//DelCommand执行方法
Expand All @@ -84,9 +80,6 @@ private void OnDel(string? obj)
if (ItemsSource is IList list)
{
list.Remove(obj);

}


}
}
1 change: 1 addition & 0 deletions KitopiaAvalonia/KitopiaAvalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

<ItemGroup>
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="Avalonia.Markup.Xaml.Loader" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.0-beta2"/>
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="HotAvalonia" Version="1.1.0" />
<PackageReference Include="HotAvalonia.Extensions" Version="1.1.0" PrivateAssets="All" />
</ItemGroup>
Expand Down
Loading

0 comments on commit d6ce847

Please sign in to comment.