Synchronize the Net40
This commit is contained in:
1 parent
a8284c2564
commit
4d4fb36d1b
68 files changed
+1246
-272
No files matched your search
@@ -1,4 +1,8 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools.Converter;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
@@ -10,5 +14,37 @@ namespace HandyControl.Controls
|
||||
public static void SetCornerRadius(DependencyObject element, CornerRadius value) => element.SetValue(CornerRadiusProperty, value);
|
||||
|
||||
public static CornerRadius GetCornerRadius(DependencyObject element) => (CornerRadius)element.GetValue(CornerRadiusProperty);
|
||||
|
||||
public static readonly DependencyProperty CircularProperty = DependencyProperty.RegisterAttached(
|
||||
"Circular", typeof(bool), typeof(BorderElement), new PropertyMetadata(ValueBoxes.FalseBox, OnCircularChanged));
|
||||
|
||||
private static void OnCircularChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is Border border)
|
||||
{
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
var binding = new MultiBinding
|
||||
{
|
||||
Converter = new BorderCircularConverter()
|
||||
};
|
||||
binding.Bindings.Add(new Binding(FrameworkElement.ActualWidthProperty.Name) { Source = border });
|
||||
binding.Bindings.Add(new Binding(FrameworkElement.ActualHeightProperty.Name) { Source = border });
|
||||
border.SetBinding(Border.CornerRadiusProperty, binding);
|
||||
}
|
||||
else
|
||||
{
|
||||
BindingOperations.ClearBinding(border, FrameworkElement.MinWidthProperty);
|
||||
BindingOperations.ClearBinding(border, FrameworkElement.MinHeightProperty);
|
||||
BindingOperations.ClearBinding(border, Border.CornerRadiusProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetCircular(DependencyObject element, bool value)
|
||||
=> element.SetValue(CircularProperty, value);
|
||||
|
||||
public static bool GetCircular(DependencyObject element)
|
||||
=> (bool)element.GetValue(CircularProperty);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace HandyControl.Controls
|
||||
{
|
||||
if (d is UIElement element)
|
||||
{
|
||||
CreateTrriger(element, (string) e.NewValue);
|
||||
CreateTrigger(element, (string)e.NewValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ namespace HandyControl.Controls
|
||||
=> element.SetValue(CommandBindingProperty, value);
|
||||
|
||||
private static CommandBinding GetCommandBinding(DependencyObject element)
|
||||
=> (CommandBinding) element.GetValue(CommandBindingProperty);
|
||||
=> (CommandBinding)element.GetValue(CommandBindingProperty);
|
||||
|
||||
private static void CreateTrriger(UIElement element, string link)
|
||||
private static void CreateTrigger(UIElement element, string link)
|
||||
{
|
||||
element.CommandBindings.Remove(GetCommandBinding(element));
|
||||
element.SetCurrentValue(CommandBindingProperty, DependencyProperty.UnsetValue);
|
||||
@@ -42,6 +42,6 @@ namespace HandyControl.Controls
|
||||
=> element.SetValue(LinkProperty, value);
|
||||
|
||||
public static string GetLink(DependencyObject element)
|
||||
=> (string) element.GetValue(LinkProperty);
|
||||
=> (string)element.GetValue(LinkProperty);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user