Merge branch 'master' into master
This commit is contained in:
608 files changed
+11322
-6260
No files matched your search
@@ -42,7 +42,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
public static void SetCircular(DependencyObject element, bool value)
|
||||
=> element.SetValue(CircularProperty, value);
|
||||
=> element.SetValue(CircularProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetCircular(DependencyObject element)
|
||||
=> (bool) element.GetValue(CircularProperty);
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
public static void SetApplyDefaultStyle(DependencyObject element, bool value)
|
||||
=> element.SetValue(ApplyDefaultStyleProperty, value);
|
||||
=> element.SetValue(ApplyDefaultStyleProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetApplyDefaultStyle(DependencyObject element)
|
||||
=> (bool) element.GetValue(ApplyDefaultStyleProperty);
|
||||
@@ -253,7 +253,7 @@ namespace HandyControl.Controls
|
||||
|
||||
public static bool GetShowRowNumber(DependencyObject target) => (bool)target.GetValue(ShowRowNumberProperty);
|
||||
|
||||
public static void SetShowRowNumber(DependencyObject target, bool value) => target.SetValue(ShowRowNumberProperty, value);
|
||||
public static void SetShowRowNumber(DependencyObject target, bool value) => target.SetValue(ShowRowNumberProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
private static void OnShowRowNumberChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace HandyControl.Controls
|
||||
new FrameworkPropertyMetadata(ValueBoxes.TrueBox, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static void SetConsistentWidth(DependencyObject element, bool value)
|
||||
=> element.SetValue(ConsistentWidthProperty, value);
|
||||
=> element.SetValue(ConsistentWidthProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetConsistentWidth(DependencyObject element)
|
||||
=> (bool) element.GetValue(ConsistentWidthProperty);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace HandyControl.Controls
|
||||
public static readonly DependencyProperty ShowEdgeContentProperty = DependencyProperty.RegisterAttached(
|
||||
"ShowEdgeContent", typeof(bool), typeof(EdgeElement), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public static void SetShowEdgeContent(DependencyObject element, bool value) => element.SetValue(ShowEdgeContentProperty, value);
|
||||
public static void SetShowEdgeContent(DependencyObject element, bool value) => element.SetValue(ShowEdgeContentProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetShowEdgeContent(DependencyObject element) => (bool) element.GetValue(ShowEdgeContentProperty);
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class ImageAttach
|
||||
{
|
||||
public static readonly DependencyProperty SourceFailedProperty = DependencyProperty.RegisterAttached(
|
||||
"SourceFailed", typeof(ImageSource), typeof(ImageAttach), new FrameworkPropertyMetadata(default(ImageSource), FrameworkPropertyMetadataOptions.Inherits, OnSourceFailedChanged));
|
||||
|
||||
private static void OnSourceFailedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is Image image)
|
||||
{
|
||||
if (e.NewValue is ImageSource)
|
||||
{
|
||||
image.ImageFailed += Image_ImageFailed;
|
||||
}
|
||||
else
|
||||
{
|
||||
image.ImageFailed -= Image_ImageFailed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e)
|
||||
{
|
||||
if (sender is Image image)
|
||||
{
|
||||
image.SetCurrentValue(Image.SourceProperty, GetSourceFailed(image));
|
||||
image.ImageFailed -= Image_ImageFailed;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetSourceFailed(DependencyObject element, ImageSource value)
|
||||
=> element.SetValue(SourceFailedProperty, value);
|
||||
|
||||
public static ImageSource GetSourceFailed(DependencyObject element)
|
||||
=> (ImageSource) element.GetValue(SourceFailedProperty);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace HandyControl.Controls
|
||||
public static readonly DependencyProperty NecessaryProperty = DependencyProperty.RegisterAttached(
|
||||
"Necessary", typeof(bool), typeof(InfoElement), new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static void SetNecessary(DependencyObject element, bool value) => element.SetValue(NecessaryProperty, value);
|
||||
public static void SetNecessary(DependencyObject element, bool value) => element.SetValue(NecessaryProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetNecessary(DependencyObject element) => (bool)element.GetValue(NecessaryProperty);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetIsMonitoring(DependencyObject element, bool value) => element.SetValue(IsMonitoringProperty, value);
|
||||
public static void SetIsMonitoring(DependencyObject element, bool value) => element.SetValue(IsMonitoringProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetIsMonitoring(DependencyObject element) => (bool)element.GetValue(IsMonitoringProperty);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
public static void SetCircular(DependencyObject element, bool value)
|
||||
=> element.SetValue(CircularProperty, value);
|
||||
=> element.SetValue(CircularProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetCircular(DependencyObject element)
|
||||
=> (bool) element.GetValue(CircularProperty);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HandyControl.Controls
|
||||
public static readonly DependencyProperty HideUncheckedElementProperty = DependencyProperty.RegisterAttached(
|
||||
"HideUncheckedElement", typeof(bool), typeof(StatusSwitchElement), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public static void SetHideUncheckedElement(DependencyObject element, bool value) => element.SetValue(HideUncheckedElementProperty, value);
|
||||
public static void SetHideUncheckedElement(DependencyObject element, bool value) => element.SetValue(HideUncheckedElementProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetHideUncheckedElement(DependencyObject element) => (bool) element.GetValue(HideUncheckedElementProperty);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
public static void SetAutoTooltip(DependencyObject element, bool value)
|
||||
=> element.SetValue(AutoTooltipProperty, value);
|
||||
=> element.SetValue(AutoTooltipProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetAutoTooltip(DependencyObject element)
|
||||
=> (bool) element.GetValue(AutoTooltipProperty);
|
||||
|
||||
@@ -45,14 +45,14 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 标题对齐方式
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TitleAlignmentProperty = DependencyProperty.RegisterAttached(
|
||||
"TitleAlignment", typeof(TitleAlignment), typeof(TitleElement), new FrameworkPropertyMetadata(TitleAlignment.Top, FrameworkPropertyMetadataOptions.Inherits));
|
||||
public static readonly DependencyProperty TitlePlacementProperty = DependencyProperty.RegisterAttached(
|
||||
"TitlePlacement", typeof(TitlePlacementType), typeof(TitleElement), new FrameworkPropertyMetadata(TitlePlacementType.Top, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static void SetTitleAlignment(DependencyObject element, TitleAlignment value)
|
||||
=> element.SetValue(TitleAlignmentProperty, value);
|
||||
public static void SetTitlePlacement(DependencyObject element, TitlePlacementType value)
|
||||
=> element.SetValue(TitlePlacementProperty, value);
|
||||
|
||||
public static TitleAlignment GetTitleAlignment(DependencyObject element)
|
||||
=> (TitleAlignment) element.GetValue(TitleAlignmentProperty);
|
||||
public static TitlePlacementType GetTitlePlacement(DependencyObject element)
|
||||
=> (TitlePlacementType) element.GetValue(TitlePlacementProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 标题宽度
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace HandyControl.Controls
|
||||
"IsDragElement", typeof(bool), typeof(WindowAttach), new PropertyMetadata(ValueBoxes.FalseBox, OnIsDragElementChanged));
|
||||
|
||||
public static void SetIsDragElement(DependencyObject element, bool value)
|
||||
=> element.SetValue(IsDragElementProperty, value);
|
||||
=> element.SetValue(IsDragElementProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetIsDragElement(DependencyObject element)
|
||||
=> (bool) element.GetValue(IsDragElementProperty);
|
||||
@@ -68,7 +68,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
public static void SetIgnoreAltF4(DependencyObject element, bool value)
|
||||
=> element.SetValue(IgnoreAltF4Property, value);
|
||||
=> element.SetValue(IgnoreAltF4Property, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetIgnoreAltF4(DependencyObject element)
|
||||
=> (bool) element.GetValue(IgnoreAltF4Property);
|
||||
@@ -106,7 +106,7 @@ namespace HandyControl.Controls
|
||||
}
|
||||
|
||||
public static void SetShowInTaskManager(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowInTaskManagerProperty, value);
|
||||
=> element.SetValue(ShowInTaskManagerProperty, ValueBoxes.BooleanBox(value));
|
||||
|
||||
public static bool GetShowInTaskManager(DependencyObject element)
|
||||
=> (bool) element.GetValue(ShowInTaskManagerProperty);
|
||||
|
||||
Reference in new issue
Block a user