feat(ui): show the tag count beside the add-tag button
This commit is contained in:
1 parent
da2a73d70f
commit
a9e97d9b35
4 files changed
+24
-7
No files matched your search
@@ -184,6 +184,9 @@
|
|||||||
<data name="Tags_AddTag" xml:space="preserve">
|
<data name="Tags_AddTag" xml:space="preserve">
|
||||||
<value>Add Tag</value>
|
<value>Add Tag</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Tags_Count" xml:space="preserve">
|
||||||
|
<value>{0} tags</value>
|
||||||
|
</data>
|
||||||
<data name="Tags_Empty" xml:space="preserve">
|
<data name="Tags_Empty" xml:space="preserve">
|
||||||
<value>No tags yet.</value>
|
<value>No tags yet.</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -184,6 +184,9 @@
|
|||||||
<data name="Tags_AddTag" xml:space="preserve">
|
<data name="Tags_AddTag" xml:space="preserve">
|
||||||
<value>添加标签</value>
|
<value>添加标签</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Tags_Count" xml:space="preserve">
|
||||||
|
<value>{0} 个标签</value>
|
||||||
|
</data>
|
||||||
<data name="Tags_Empty" xml:space="preserve">
|
<data name="Tags_Empty" xml:space="preserve">
|
||||||
<value>还没有标签。</value>
|
<value>还没有标签。</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
@@ -47,6 +48,12 @@ public sealed partial class TagsViewModel : ViewModelBase {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasNoTags => Tags.Count == 0;
|
public bool HasNoTags => Tags.Count == 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the localized total number of tags shown next to the add button.
|
||||||
|
/// </summary>
|
||||||
|
public string TagCountText => string.Format(
|
||||||
|
Resources.Culture ?? CultureInfo.CurrentCulture, Resources.Tags_Count, Tags.Count);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the interaction that opens the new-tag editor.
|
/// Gets the interaction that opens the new-tag editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -93,6 +100,7 @@ public sealed partial class TagsViewModel : ViewModelBase {
|
|||||||
|
|
||||||
OnPropertyChanged(nameof(HasTags));
|
OnPropertyChanged(nameof(HasTags));
|
||||||
OnPropertyChanged(nameof(HasNoTags));
|
OnPropertyChanged(nameof(HasNoTags));
|
||||||
|
OnPropertyChanged(nameof(TagCountText));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -11,13 +11,16 @@
|
|||||||
|
|
||||||
<Grid RowDefinitions="Auto,*" Margin="8">
|
<Grid RowDefinitions="Auto,*" Margin="8">
|
||||||
|
|
||||||
<Button Grid.Row="0" Command="{Binding AddNewTagCommand}"
|
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="0,0,0,8">
|
||||||
HorizontalAlignment="Right" Margin="0,0,0,8">
|
<TextBlock Grid.Column="0" Text="{Binding TagCountText}"
|
||||||
<StackPanel Orientation="Horizontal" Spacing="6">
|
VerticalAlignment="Center" Opacity="0.6" FontSize="13"/>
|
||||||
<icons:PackIconLucide Kind="Plus" Width="16" Height="16"/>
|
<Button Grid.Column="1" Command="{Binding AddNewTagCommand}">
|
||||||
<TextBlock Text="{x:Static lang:Resources.Tags_AddTag}"/>
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||||
</StackPanel>
|
<icons:PackIconLucide Kind="Plus" Width="16" Height="16"/>
|
||||||
</Button>
|
<TextBlock Text="{x:Static lang:Resources.Tags_AddTag}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||||
<ItemsControl ItemsSource="{Binding Tags}">
|
<ItemsControl ItemsSource="{Binding Tags}">
|
||||||
|
|||||||
Reference in new issue
Block a user