Dreamine.UI.Wpf.Controls 1.0.1
Dreamine.UI.Wpf.Controls 사용자 인터페이스 기능과 구성 요소를 제공합니다.
로딩중...
검색중...
일치하는것 없음
DreamineButton.cs
이 파일의 문서화 페이지로 가기
1// \file DreamineButton.cs
2// \brief Custom button control for VsLibrary framework. Supports Icon/Shadow/Permission/AttachedCommand.
3
4using System;
5using System.ComponentModel; // \brief DesignerProperties
6using System.Linq;
7using System.Threading.Tasks;
8using System.Windows;
9using System.Windows.Controls;
10using System.Windows.Controls.Primitives;
11using System.Windows.Input;
12using System.Windows.Media;
13using System.Windows.Media.Effects;
16
18{
28 {
55 Both = 2
56 }
57
114
127 public class DreamineButton : Button
128 {
129
130 #region Template parts
131
141 private const string PART_ShadowHost = "ShadowHost";
142
152 private Border? _shadowHost;
153
154 #endregion
155
156 #region New DPs : IconSize / IconMargin / IconStretch
157
169 public double IconSize
170 {
171 get => (double)GetValue(IconSizeProperty);
172 set => SetValue(IconSizeProperty, value);
173 }
174
184 public static readonly DependencyProperty IconSizeProperty =
185 DependencyProperty.Register(
186 nameof(IconSize),
187 typeof(double),
188 typeof(DreamineButton),
189 new FrameworkPropertyMetadata(
190 20d,
191 FrameworkPropertyMetadataOptions.AffectsMeasure |
192 FrameworkPropertyMetadataOptions.AffectsArrange |
193 FrameworkPropertyMetadataOptions.AffectsRender));
194
206 public Thickness IconMargin
207 {
208 get => (Thickness)GetValue(IconMarginProperty);
209 set => SetValue(IconMarginProperty, value);
210 }
211
221 public static readonly DependencyProperty IconMarginProperty =
222 DependencyProperty.Register(
223 nameof(IconMargin),
224 typeof(Thickness),
225 typeof(DreamineButton),
226 new FrameworkPropertyMetadata(
227 new Thickness(0, 0, 4, 0),
228 FrameworkPropertyMetadataOptions.AffectsMeasure |
229 FrameworkPropertyMetadataOptions.AffectsArrange));
230
242 public Stretch IconStretch
243 {
244 get => (Stretch)GetValue(IconStretchProperty);
245 set => SetValue(IconStretchProperty, value);
246 }
247
257 public static readonly DependencyProperty IconStretchProperty =
258 DependencyProperty.Register(
259 nameof(IconStretch),
260 typeof(Stretch),
261 typeof(DreamineButton),
262 new FrameworkPropertyMetadata(
263 Stretch.Uniform,
264 FrameworkPropertyMetadataOptions.AffectsRender));
265
266 #endregion
267
268 #region New DPs : Shadow (Effect)
269
281 public bool UseShadow
282 {
283 get => (bool)GetValue(UseShadowProperty);
284 set => SetValue(UseShadowProperty, value);
285 }
286
296 public static readonly DependencyProperty UseShadowProperty =
297 DependencyProperty.Register(
298 nameof(UseShadow),
299 typeof(bool),
300 typeof(DreamineButton),
301 new FrameworkPropertyMetadata(
302 false,
303 FrameworkPropertyMetadataOptions.AffectsRender,
305
315 public double ShadowBlurRadius
316 {
317 get => (double)GetValue(ShadowBlurRadiusProperty);
318 set => SetValue(ShadowBlurRadiusProperty, value);
319 }
320
330 public static readonly DependencyProperty ShadowBlurRadiusProperty =
331 DependencyProperty.Register(
332 nameof(ShadowBlurRadius),
333 typeof(double),
334 typeof(DreamineButton),
335 new FrameworkPropertyMetadata(
336 18d,
337 FrameworkPropertyMetadataOptions.AffectsRender,
339
349 public double ShadowOpacity
350 {
351 get => (double)GetValue(ShadowOpacityProperty);
352 set => SetValue(ShadowOpacityProperty, value);
353 }
354
364 public static readonly DependencyProperty ShadowOpacityProperty =
365 DependencyProperty.Register(
366 nameof(ShadowOpacity),
367 typeof(double),
368 typeof(DreamineButton),
369 new FrameworkPropertyMetadata(
370 0.55d,
371 FrameworkPropertyMetadataOptions.AffectsRender,
373
383 public double ShadowDepth
384 {
385 get => (double)GetValue(ShadowDepthProperty);
386 set => SetValue(ShadowDepthProperty, value);
387 }
388
398 public static readonly DependencyProperty ShadowDepthProperty =
399 DependencyProperty.Register(
400 nameof(ShadowDepth),
401 typeof(double),
402 typeof(DreamineButton),
403 new FrameworkPropertyMetadata(
404 6d,
405 FrameworkPropertyMetadataOptions.AffectsRender,
407
419 public double ShadowDirection
420 {
421 get => (double)GetValue(ShadowDirectionProperty);
422 set => SetValue(ShadowDirectionProperty, value);
423 }
424
434 public static readonly DependencyProperty ShadowDirectionProperty =
435 DependencyProperty.Register(
436 nameof(ShadowDirection),
437 typeof(double),
438 typeof(DreamineButton),
439 new FrameworkPropertyMetadata(
440 90d,
441 FrameworkPropertyMetadataOptions.AffectsRender,
443
453 public Color ShadowColor
454 {
455 get => (Color)GetValue(ShadowColorProperty);
456 set => SetValue(ShadowColorProperty, value);
457 }
458
468 public static readonly DependencyProperty ShadowColorProperty =
469 DependencyProperty.Register(
470 nameof(ShadowColor),
471 typeof(Color),
472 typeof(DreamineButton),
473 new FrameworkPropertyMetadata(
474 Colors.Black,
475 FrameworkPropertyMetadataOptions.AffectsRender,
477
505 private static void OnShadowPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
506 {
507 if (d is DreamineButton btn)
508 btn.UpdateShadowEffect();
509 }
510
511 #endregion
512
513 #region Existing : ImagePosition / OnceLogin / Login / IconSource / IconPath / Command etc.
514
527 {
529 set => SetValue(SelectedVisualModeProperty, value);
530 }
531
543 public static readonly DependencyProperty SelectedVisualModeProperty =
544 DependencyProperty.Register(
545 nameof(SelectedVisualMode),
546 typeof(SelectedVisualMode),
547 typeof(DreamineButton),
548 new PropertyMetadata(SelectedVisualMode.BorderOnly));
549
562 {
563 get => (Brush)GetValue(SelectedBorderBrushProperty);
564 set => SetValue(SelectedBorderBrushProperty, value);
565 }
566
578 public static readonly DependencyProperty SelectedBorderBrushProperty =
579 DependencyProperty.Register(
580 nameof(SelectedBorderBrush),
581 typeof(Brush),
582 typeof(DreamineButton),
583 new PropertyMetadata(Brushes.Blue));
584
596 public Thickness SelectedBorderThickness
597 {
598 get => (Thickness)GetValue(SelectedBorderThicknessProperty);
599 set => SetValue(SelectedBorderThicknessProperty, value);
600 }
601
613 public static readonly DependencyProperty SelectedBorderThicknessProperty =
614 DependencyProperty.Register(
616 typeof(Thickness),
617 typeof(DreamineButton),
618 new PropertyMetadata(new Thickness(3)));
619
633 {
634 get => (Brush)GetValue(SelectedBackgroundOverlayProperty);
635 set => SetValue(SelectedBackgroundOverlayProperty, value);
636 }
637
649 public static readonly DependencyProperty SelectedBackgroundOverlayProperty =
650 DependencyProperty.Register(
652 typeof(Brush),
653 typeof(DreamineButton),
654 new PropertyMetadata(new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x7A, 0xFF))));
655
666 {
667 get => (IconPosition)GetValue(ImagePositionProperty);
668 set => SetValue(ImagePositionProperty, value);
669 }
670
680 public static readonly DependencyProperty ImagePositionProperty =
681 DependencyProperty.Register(
682 nameof(ImagePosition),
683 typeof(IconPosition),
684 typeof(DreamineButton),
685 new FrameworkPropertyMetadata(
686 IconPosition.Left,
687 FrameworkPropertyMetadataOptions.AffectsMeasure |
688 FrameworkPropertyMetadataOptions.AffectsArrange));
689
699 public bool OnceLogin
700 {
701 get => (bool)GetValue(OnceLoginProperty);
702 set => SetValue(OnceLoginProperty, value);
703 }
704
714 public static readonly DependencyProperty OnceLoginProperty =
715 DependencyProperty.Register(
716 nameof(OnceLogin),
717 typeof(bool),
718 typeof(DreamineButton),
719 new PropertyMetadata(false, OnOnceLoginChanged));
720
756 private static void OnOnceLoginChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
757 {
758 if (d is DreamineButton)
759 VsNavigationHelper.IsOnceLoginEnabled = (bool)e.NewValue;
760 }
761
774 {
775 DefaultStyleKeyProperty.OverrideMetadata(
776 typeof(DreamineButton),
777 new FrameworkPropertyMetadata(typeof(DreamineButton)));
778
779 try
780 {
781 var uri = new Uri("/Dreamine.UI.Wpf.Themes;component/DreamineButtonStyle.xaml",
782 UriKind.RelativeOrAbsolute);
783
784 var app = Application.Current;
785 if (app != null)
786 {
787 bool alreadyAdded = app.Resources.MergedDictionaries
788 .OfType<ResourceDictionary>()
789 .Any(x => x.Source != null && x.Source.Equals(uri));
790
791 if (!alreadyAdded)
792 {
793 var dict = new ResourceDictionary { Source = uri };
794 app.Resources.MergedDictionaries.Add(dict);
795 }
796 }
797 }
798 catch
799 {
800 // \brief Guard for design-time / missing resources, etc.
801 }
802
803 }
804
817 {
818 }
819
831 public override void OnApplyTemplate()
832 {
833 base.OnApplyTemplate();
834
835 _shadowHost = GetTemplateChild(PART_ShadowHost) as Border;
836
837 // \brief If template part name mismatches, _shadowHost can be null.
839 }
840
852 private void UpdateShadowEffect()
853 {
854 if (_shadowHost == null)
855 return;
856
857 if (!UseShadow)
858 {
859 _shadowHost.Effect = null;
860 return;
861 }
862
863 // \brief Avoid background/brush interference: use Effect only on transparent host.
864 _shadowHost.Effect = new DropShadowEffect
865 {
866 BlurRadius = ShadowBlurRadius,
867 Opacity = ShadowOpacity,
869 Direction = ShadowDirection,
870 Color = ShadowColor
871 };
872 }
873
884 {
885 get => (ImageSource)GetValue(ImageSourceProperty);
886 set => SetValue(ImageSourceProperty, value);
887 }
888
898 public static readonly DependencyProperty ImageSourceProperty =
899 DependencyProperty.Register(nameof(ImageSource), typeof(ImageSource), typeof(DreamineButton),
900 new PropertyMetadata(null));
901
911 public Geometry IconPath
912 {
913 get => (Geometry)GetValue(IconPathProperty);
914 set => SetValue(IconPathProperty, value);
915 }
916
926 public static readonly DependencyProperty IconPathProperty =
927 DependencyProperty.Register(nameof(IconPath), typeof(Geometry), typeof(DreamineButton),
928 new PropertyMetadata(null));
929
939 public new static readonly DependencyProperty CommandProperty =
940 DependencyProperty.Register(
941 nameof(Command),
942 typeof(ICommand),
943 typeof(DreamineButton),
944 new PropertyMetadata(null, OnCommandChanged));
945
955 public new ICommand Command
956 {
957 get => (ICommand)GetValue(CommandProperty);
958 set => SetValue(CommandProperty, value);
959 }
960
970 public new static readonly DependencyProperty CommandParameterProperty =
971 DependencyProperty.RegisterAttached(
972 "CommandParameter",
973 typeof(object),
974 typeof(DreamineButton),
975 new PropertyMetadata(null));
976
1010 public static void SetCommandParameter(DependencyObject obj, object value)
1011 => obj.SetValue(CommandParameterProperty, value);
1012
1046 public static object GetCommandParameter(DependencyObject obj)
1047 => obj.GetValue(CommandParameterProperty);
1048
1058 public static readonly DependencyProperty CommandTriggerNameProperty =
1059 DependencyProperty.RegisterAttached(
1060 "CommandTriggerName",
1061 typeof(string),
1062 typeof(DreamineButton),
1063 new PropertyMetadata("PreviewMouseUp"));
1064
1098 public static void SetCommandTriggerName(DependencyObject obj, string value)
1099 => obj.SetValue(CommandTriggerNameProperty, value);
1100
1134 public static string GetCommandTriggerName(DependencyObject obj)
1135 => (string)obj.GetValue(CommandTriggerNameProperty);
1136
1170 public static void SetCommand(DependencyObject obj, ICommand value) => obj.SetValue(CommandProperty, value);
1171
1205 public static ICommand GetCommand(DependencyObject obj) => (ICommand)obj.GetValue(CommandProperty);
1206
1216 private static readonly DependencyProperty IsHandlersHookedProperty =
1217 DependencyProperty.RegisterAttached("IsHandlersHooked", typeof(bool), typeof(DreamineButton),
1218 new PropertyMetadata(false));
1219
1245 private static bool GetIsHandlersHooked(DependencyObject d) => (bool)d.GetValue(IsHandlersHookedProperty);
1246
1272 private static void SetIsHandlersHooked(DependencyObject d, bool v) => d.SetValue(IsHandlersHookedProperty, v);
1273
1283 private static readonly DependencyProperty IsExecutingProperty =
1284 DependencyProperty.RegisterAttached("IsExecuting", typeof(bool), typeof(DreamineButton),
1285 new PropertyMetadata(false));
1286
1312 private static bool GetIsExecuting(DependencyObject d) => (bool)d.GetValue(IsExecutingProperty);
1313
1339 private static void SetIsExecuting(DependencyObject d, bool v) => d.SetValue(IsExecutingProperty, v);
1340
1368 private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
1369 {
1370 if (d is not UIElement element) return;
1371 if (GetIsHandlersHooked(d)) return;
1372
1373 element.AddHandler(UIElement.PreviewMouseUpEvent, new MouseButtonEventHandler((s, ev) =>
1374 {
1375 TryExecuteCommand(d, "PreviewMouseUp", ev);
1376 }), true);
1377
1378 element.AddHandler(Control.MouseDoubleClickEvent, new MouseButtonEventHandler((s, ev) =>
1379 {
1380 TryExecuteCommand(d, "MouseDoubleClick", ev);
1381 }), true);
1382
1383 element.AddHandler(UIElement.PreviewKeyUpEvent, new KeyEventHandler((s, ev) =>
1384 {
1385 TryExecuteCommand(d, "PreviewKeyUp", ev);
1386 }), true);
1387
1388 element.AddHandler(UIElement.TouchUpEvent, new EventHandler<TouchEventArgs>((s, ev) =>
1389 {
1390 TryExecuteCommand(d, "TouchUp", ev);
1391 }));
1392
1393 element.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler((s, ev) =>
1394 {
1395 TryExecuteCommand(d, "Click", ev);
1396 }));
1397
1398 SetIsHandlersHooked(d, true);
1399 }
1400
1460 private static async void TryExecuteCommand(DependencyObject d, string eventName, RoutedEventArgs eventArgs)
1461 {
1462 await Task.Yield();
1463
1464 var rawTrigger = GetCommandTriggerName(d);
1465 if (string.IsNullOrWhiteSpace(rawTrigger))
1466 return;
1467
1468 var triggers = rawTrigger
1469 .Split(',')
1470 .Select(s => s.Trim())
1471 .Where(s => !string.IsNullOrWhiteSpace(s))
1472 .ToArray();
1473
1474 if (triggers.Length > 0 &&
1475 !triggers.Contains(eventName, StringComparer.OrdinalIgnoreCase))
1476 return;
1477
1478 var command = GetCommand(d);
1479
1480 // Resolve command parameter with a clear priority:
1481 // 1) DreamineButton attached CommandParameter.
1482 // 2) WPF ButtonBase.CommandParameter.
1483 // 3) RoutedEventArgs fallback.
1484 object? parameter = null;
1485
1486 // 1) Attached CommandParameter (DreamineButton).
1487 parameter = GetCommandParameter(d);
1488
1489 // 2) Standard WPF CommandParameter (ButtonBase).
1490 if (parameter == null && d is ButtonBase bbForParam)
1491 parameter = bbForParam.CommandParameter;
1492
1493 // 3) Fallback to event args.
1494 if (parameter == null)
1495 parameter = eventArgs;
1496
1497 // Prevent double invocation when ButtonBase.Command is already wired to the same ICommand.
1498 if (d is ButtonBase bb && command != null && ReferenceEquals(bb.Command, command))
1499 return;
1500
1501 // Re-entrancy guard.
1502 if (GetIsExecuting(d))
1503 return;
1504
1505 SetIsExecuting(d, true);
1506
1507 try
1508 {
1509 if (d is DreamineButton btn)
1510 {
1511 if (btn.MinimumGrade > 0 && btn.Grade < btn.MinimumGrade)
1512 {
1514 "권한이 부족합니다.",
1515 "Access Denied",
1516 autoClick: MessageBoxResult.OK,
1517 autoClickDelaySeconds: 3);
1518 return;
1519 }
1520
1521 if (btn.DataContext is ButtonData btnData)
1523 }
1524
1525 if (command == null)
1526 return;
1527
1528 // Execute the command when the parameter is accepted.
1529 if (command.CanExecute(parameter))
1530 {
1531 command.Execute(parameter);
1532 }
1533
1534 eventArgs.Handled = true;
1535 }
1536 finally
1537 {
1538 SetIsExecuting(d, false);
1539 }
1540 }
1541
1551 public static readonly DependencyProperty BackgroundTopProperty =
1552 DependencyProperty.Register(nameof(BackgroundTop), typeof(Brush), typeof(DreamineButton), new PropertyMetadata(null));
1553
1563 public static readonly DependencyProperty ShineColorProperty =
1564 DependencyProperty.Register(nameof(ShineColor), typeof(Brush), typeof(DreamineButton), new PropertyMetadata(null));
1565
1575 public static readonly DependencyProperty ShineColorBottomProperty =
1576 DependencyProperty.Register(nameof(ShineColorBottom), typeof(Brush), typeof(DreamineButton), new PropertyMetadata(null));
1577
1587 public Brush BackgroundTop
1588 {
1589 get => (Brush)GetValue(BackgroundTopProperty);
1590 set => SetValue(BackgroundTopProperty, value);
1591 }
1592
1602 public Brush ShineColor
1603 {
1604 get => (Brush)GetValue(ShineColorProperty);
1605 set => SetValue(ShineColorProperty, value);
1606 }
1607
1617 public Brush ShineColorBottom
1618 {
1619 get => (Brush)GetValue(ShineColorBottomProperty);
1620 set => SetValue(ShineColorBottomProperty, value);
1621 }
1622
1632 public static readonly DependencyProperty IsSelectedProperty =
1633 DependencyProperty.Register(nameof(IsSelected), typeof(bool), typeof(DreamineButton), new PropertyMetadata(false));
1634
1644 public bool IsSelected
1645 {
1646 get => (bool)GetValue(IsSelectedProperty);
1647 set => SetValue(IsSelectedProperty, value);
1648 }
1649
1659 public static readonly DependencyProperty IsFocusableExProperty =
1660 DependencyProperty.Register(nameof(IsFocusableEx), typeof(bool), typeof(DreamineButton), new PropertyMetadata(true));
1661
1671 public bool IsFocusableEx
1672 {
1673 get => (bool)GetValue(IsFocusableExProperty);
1674 set => SetValue(IsFocusableExProperty, value);
1675 }
1676
1686 public static readonly DependencyProperty RestoreFocusTargetProperty =
1687 DependencyProperty.Register(nameof(RestoreFocusTarget), typeof(IInputElement), typeof(DreamineButton), new PropertyMetadata(null));
1688
1698 public IInputElement? RestoreFocusTarget
1699 {
1700 get => (IInputElement?)GetValue(RestoreFocusTargetProperty);
1701 set => SetValue(RestoreFocusTargetProperty, value);
1702 }
1703
1713 public static readonly DependencyProperty GradeProperty =
1714 DependencyProperty.Register(nameof(Grade), typeof(int), typeof(DreamineButton), new PropertyMetadata(0));
1715
1725 public int Grade
1726 {
1727 get => (int)GetValue(GradeProperty);
1728 set => SetValue(GradeProperty, value);
1729 }
1730
1740 public static readonly DependencyProperty MinimumGradeProperty =
1741 DependencyProperty.Register(nameof(MinimumGrade), typeof(int), typeof(DreamineButton), new PropertyMetadata(0));
1742
1752 public int MinimumGrade
1753 {
1754 get => (int)GetValue(MinimumGradeProperty);
1755 set => SetValue(MinimumGradeProperty, value);
1756 }
1757
1769 public static readonly DependencyProperty UseSolidBackgroundProperty =
1770 DependencyProperty.Register(
1771 nameof(UseSolidBackground),
1772 typeof(bool),
1773 typeof(DreamineButton),
1774 new PropertyMetadata(false));
1775
1786 {
1787 get => (bool)GetValue(UseSolidBackgroundProperty);
1788 set => SetValue(UseSolidBackgroundProperty, value);
1789 }
1790
1791 #endregion
1792 }
1793}
int MinimumGrade
Gets/sets MinimumGrade.
static readonly DependencyProperty IsSelectedProperty
Selection state.
bool OnceLogin
Enables one-time login session reuse.
static new readonly DependencyProperty CommandProperty
Attached command (separate from Button.Command).
static readonly DependencyProperty ShadowBlurRadiusProperty
DP for ShadowBlurRadius.
static readonly DependencyProperty SelectedBackgroundOverlayProperty
DP identifier for SelectedBackgroundOverlay.
static void SetIsExecuting(DependencyObject d, bool v)
Sets IsExecuting attached property.
SelectedVisualMode SelectedVisualMode
Dependency property for selection visual presentation mode.
static DreamineButton()
Applies default style key and auto-merges ResourceDictionary.
bool UseSolidBackground
Gets/sets UseSolidBackground.
static void OnOnceLoginChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Updates global navigation helper when OnceLogin changes.
double ShadowBlurRadius
Shadow blur radius.
Border? _shadowHost
Shadow host of the current template.
static readonly DependencyProperty MinimumGradeProperty
Minimum required grade.
static readonly DependencyProperty IsHandlersHookedProperty
Prevents duplicate event handler hooking.
DreamineButton()
Constructor: subscribes to login changed event.
static readonly DependencyProperty IconStretchProperty
DP for IconStretch.
static ICommand GetCommand(DependencyObject obj)
Attached Command helper get.
static void OnShadowPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Updates template Effect when any shadow DP changes.
static readonly DependencyProperty BackgroundTopProperty
Gradient top color.
static void SetCommand(DependencyObject obj, ICommand value)
Attached Command helper set.
static readonly DependencyProperty IconMarginProperty
DP for IconMargin.
Brush SelectedBackgroundOverlay
Selected background overlay brush (alpha recommended).
static readonly DependencyProperty RestoreFocusTargetProperty
Focus restore target element.
static readonly DependencyProperty ShadowColorProperty
DP for ShadowColor.
static readonly DependencyProperty IconSizeProperty
DP for IconSize.
static readonly DependencyProperty ShadowOpacityProperty
DP for ShadowOpacity.
static bool GetIsExecuting(DependencyObject d)
Gets IsExecuting attached property.
ImageSource ImageSource
Bitmap icon source.
static object GetCommandParameter(DependencyObject obj)
Gets CommandParameter attached property.
static readonly DependencyProperty CommandTriggerNameProperty
Comma-separated trigger event names.
double ShadowDirection
Shadow direction in degrees. 0=Left, 90=Down, 180=Right, 270=Up.
static readonly DependencyProperty IconPathProperty
DP for IconPath.
static readonly DependencyProperty ImageSourceProperty
DP for ImageSource.
static readonly DependencyProperty ShadowDepthProperty
DP for ShadowDepth.
bool IsFocusableEx
Gets/sets IsFocusableEx.
static readonly DependencyProperty ImagePositionProperty
DP for ImagePosition.
static readonly DependencyProperty OnceLoginProperty
DP for OnceLogin.
Stretch IconStretch
Icon stretch mode.
static readonly DependencyProperty SelectedBorderBrushProperty
DP identifier for SelectedBorderBrush.
Geometry IconPath
Vector icon geometry (Path).
static readonly DependencyProperty IsFocusableExProperty
Extended Focusable flag.
static readonly DependencyProperty UseSolidBackgroundProperty
Enables solid background mode.
static readonly DependencyProperty SelectedBorderThicknessProperty
DP identifier for SelectedBorderThickness.
static void SetIsHandlersHooked(DependencyObject d, bool v)
Sets IsHandlersHooked attached property.
IInputElement? RestoreFocusTarget
Gets/sets RestoreFocusTarget.
static readonly DependencyProperty ShineColorProperty
Shine top color.
static readonly DependencyProperty ShadowDirectionProperty
DP for ShadowDirection.
static bool GetIsHandlersHooked(DependencyObject d)
Gets IsHandlersHooked attached property.
Brush BackgroundTop
Gets/sets BackgroundTop.
void UpdateShadowEffect()
Applies shadow effect to ShadowHost.
override void OnApplyTemplate()
Caches template parts and updates shadow effect after template is applied.
new ICommand Command
Command get/set.
Brush SelectedBorderBrush
Selected border brush.
Thickness SelectedBorderThickness
Selected border thickness.
static readonly DependencyProperty SelectedVisualModeProperty
DP identifier for SelectedVisualMode.
static readonly DependencyProperty ShineColorBottomProperty
Shine bottom color.
static void SetCommandTriggerName(DependencyObject obj, string value)
Sets CommandTriggerName attached property.
Brush ShineColorBottom
Gets/sets ShineColorBottom.
static void SetCommandParameter(DependencyObject obj, object value)
Sets CommandParameter attached property.
IconPosition ImagePosition
Icon layout position.
static readonly DependencyProperty IsExecutingProperty
Reentrancy guard flag.
Thickness IconMargin
Controls the icon margin.
bool UseShadow
Enables or disables DropShadowEffect.
const string PART_ShadowHost
Template part name for the shadow host.
static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Hooks internal event handlers once when Command changes.
Brush ShineColor
Gets/sets ShineColor.
double IconSize
Controls the default icon size (Width/Height) at once.
static readonly DependencyProperty UseShadowProperty
DP for UseShadow.
static string GetCommandTriggerName(DependencyObject obj)
Gets CommandTriggerName attached property.
static async void TryExecuteCommand(DependencyObject d, string eventName, RoutedEventArgs eventArgs)
Executes the command only when the trigger name matches.
static new readonly DependencyProperty CommandParameterProperty
Attached command parameter.
static readonly DependencyProperty GradeProperty
Current user grade.
static void ShowAsync(string message, string title="Information", MessageBoxButton buttons=MessageBoxButton.OK, MessageBoxImage icon=MessageBoxImage.None, Action< MessageBoxResult >? callback=null, MessageBoxResult autoClick=MessageBoxResult.None, int autoClickDelaySeconds=0, int enableDelaySeconds=0)