enhance: close #1355
This commit is contained in:
1 parent
61a964f9ea
commit
624545376f
4 files changed
+20
-6
No files matched your search
@@ -1,17 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls;
|
||||
|
||||
public class TagContainer : ItemsControl
|
||||
{
|
||||
public static readonly DependencyProperty ShowCloseButtonProperty = DependencyProperty.RegisterAttached(
|
||||
"ShowCloseButton", typeof(bool), typeof(TagContainer), new FrameworkPropertyMetadata(ValueBoxes.TrueBox,
|
||||
FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public TagContainer()
|
||||
{
|
||||
AddHandler(Controls.Tag.ClosedEvent, new RoutedEventHandler(Tag_OnClosed));
|
||||
}
|
||||
|
||||
public static void SetShowCloseButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowCloseButtonProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetShowCloseButton(DependencyObject element)
|
||||
=> (bool) element.GetValue(ShowCloseButtonProperty);
|
||||
|
||||
private void Tag_OnClosed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (e.OriginalSource is Tag tag)
|
||||
|
||||
Reference in new issue
Block a user