feat: implement command, fix icon foreground in light mode.
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
<u:Breadcrumb
|
<u:Breadcrumb
|
||||||
DisplayMemberBinding="{Binding Section}"
|
DisplayMemberBinding="{Binding Section}"
|
||||||
IconBinding="{Binding Icon}"
|
IconBinding="{Binding Icon}"
|
||||||
|
CommandBinding="{Binding Command}"
|
||||||
ItemsSource="{Binding Items1}">
|
ItemsSource="{Binding Items1}">
|
||||||
<u:Breadcrumb.IconTemplate>
|
<u:Breadcrumb.IconTemplate>
|
||||||
<DataTemplate DataType="x:String">
|
<DataTemplate DataType="x:String">
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Input;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Ursa.Controls;
|
||||||
|
|
||||||
namespace Ursa.Demo.ViewModels;
|
namespace Ursa.Demo.ViewModels;
|
||||||
|
|
||||||
@@ -24,4 +27,14 @@ public class BreadcrumbDemoItem: ObservableObject
|
|||||||
{
|
{
|
||||||
public string Section { get; set; }
|
public string Section { get; set; }
|
||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
|
||||||
|
public ICommand Command { get; set; }
|
||||||
|
|
||||||
|
public BreadcrumbDemoItem()
|
||||||
|
{
|
||||||
|
Command = new RelayCommand(() =>
|
||||||
|
{
|
||||||
|
MessageBox.ShowOverlayAsync(Section);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Content="{TemplateBinding Icon}"
|
Content="{TemplateBinding Icon}"
|
||||||
ContentTemplate="{TemplateBinding IconTemplate}"
|
ContentTemplate="{TemplateBinding IconTemplate}"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
Foreground="{DynamicResource SemiColorText2}"
|
||||||
IsVisible="{TemplateBinding Icon,
|
IsVisible="{TemplateBinding Icon,
|
||||||
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Avalonia;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.Metadata;
|
using Avalonia.Controls.Metadata;
|
||||||
using Avalonia.Controls.Templates;
|
using Avalonia.Controls.Templates;
|
||||||
|
using Avalonia.Input;
|
||||||
|
|
||||||
namespace Ursa.Controls;
|
namespace Ursa.Controls;
|
||||||
|
|
||||||
@@ -47,8 +48,9 @@ public class BreadcrumbItem: ContentControl
|
|||||||
set => SetValue(IconTemplateProperty, value);
|
set => SetValue(IconTemplateProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BreadcrumbItem()
|
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
||||||
{
|
{
|
||||||
|
base.OnPointerPressed(e);
|
||||||
|
Command?.Execute(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user