-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add avalonia ToggleButton demo.
- Loading branch information
Showing
17 changed files
with
1,564 additions
and
242 deletions.
There are no files selected for viewing
602 changes: 602 additions & 0 deletions
602
src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/ToggleButtonDemoCtl.axaml
Large diffs are not rendered by default.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/ToggleButtonDemoCtl.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace HandyControlDemo.UserControl; | ||
|
||
public partial class ToggleButtonDemoCtl : Avalonia.Controls.UserControl | ||
{ | ||
public ToggleButtonDemoCtl() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/Avalonia/HandyControl_Avalonia/Controls/Attach/IconSwitchElement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Avalonia; | ||
using Avalonia.Media; | ||
|
||
namespace HandyControl.Controls; | ||
|
||
public class IconSwitchElement | ||
{ | ||
public static readonly AttachedProperty<Geometry> GeometryProperty = | ||
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, Geometry>("Geometry"); | ||
|
||
public static void SetGeometry(AvaloniaObject element, Geometry value) => element.SetValue(GeometryProperty, value); | ||
|
||
public static Geometry GetGeometry(AvaloniaObject element) => element.GetValue(GeometryProperty); | ||
|
||
public static readonly AttachedProperty<double> WidthProperty = | ||
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, double>("Width", defaultValue: double.NaN); | ||
|
||
public static void SetWidth(AvaloniaObject element, double value) => element.SetValue(WidthProperty, value); | ||
|
||
public static double GetWidth(AvaloniaObject element) => element.GetValue(WidthProperty); | ||
|
||
public static readonly AttachedProperty<double> HeightProperty = | ||
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, double>("Height", defaultValue: double.NaN); | ||
|
||
public static void SetHeight(AvaloniaObject element, double value) => element.SetValue(HeightProperty, value); | ||
public static double GetHeight(AvaloniaObject element) => element.GetValue(HeightProperty); | ||
|
||
public static readonly AttachedProperty<Geometry> GeometrySelectedProperty = | ||
AvaloniaProperty.RegisterAttached<IconSwitchElement, AvaloniaObject, Geometry>("GeometrySelected"); | ||
|
||
public static void SetGeometrySelected(AvaloniaObject element, Geometry value) => | ||
element.SetValue(GeometrySelectedProperty, value); | ||
|
||
public static Geometry GetGeometrySelected(AvaloniaObject element) => element.GetValue(GeometrySelectedProperty); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/Avalonia/HandyControl_Avalonia/Controls/Attach/StatusSwitchElement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Avalonia; | ||
|
||
namespace HandyControl.Controls; | ||
|
||
public class StatusSwitchElement | ||
{ | ||
public static readonly AttachedProperty<object> CheckedElementProperty = | ||
AvaloniaProperty.RegisterAttached<StatusSwitchElement, AvaloniaObject, object>("CheckedElement"); | ||
|
||
public static void SetCheckedElement(AvaloniaObject element, object value) => | ||
element.SetValue(CheckedElementProperty, value); | ||
|
||
public static object GetCheckedElement(AvaloniaObject element) => element.GetValue(CheckedElementProperty); | ||
|
||
public static readonly AttachedProperty<object> HideUncheckedElementProperty = | ||
AvaloniaProperty.RegisterAttached<StatusSwitchElement, AvaloniaObject, object>("HideUncheckedElement"); | ||
|
||
public static void SetHideUncheckedElement(AvaloniaObject element, object value) => | ||
element.SetValue(HideUncheckedElementProperty, value); | ||
|
||
public static object GetHideUncheckedElement(AvaloniaObject element) => | ||
element.GetValue(HideUncheckedElementProperty); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Avalonia/HandyControl_Avalonia/Controls/Attach/ToggleButtonAttach.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Avalonia; | ||
|
||
namespace HandyControl.Controls; | ||
|
||
public class ToggleButtonAttach | ||
{ | ||
public static readonly AttachedProperty<bool> ShowLabelProperty = | ||
AvaloniaProperty.RegisterAttached<ToggleButtonAttach, AvaloniaObject, bool>("ShowLabel", inherits: true); | ||
|
||
public static void SetShowLabel(AvaloniaObject element, bool value) => element.SetValue(ShowLabelProperty, value); | ||
|
||
public static bool GetShowLabel(AvaloniaObject element) => element.GetValue(ShowLabelProperty); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.