feat: update PopConfirm to support non-button triggers and rename Tap to Click
This commit is contained in:
@@ -22,6 +22,14 @@
|
|||||||
CancelCommand="{Binding Path=CancelCommand}" >
|
CancelCommand="{Binding Path=CancelCommand}" >
|
||||||
<Button Content="Hello World"></Button>
|
<Button Content="Hello World"></Button>
|
||||||
</u:PopConfirm>
|
</u:PopConfirm>
|
||||||
|
<TextBlock Text="Non-button control as main element" Margin="0 16" />
|
||||||
|
<u:PopConfirm PopupHeader="Header" PopupContent="Content"
|
||||||
|
TriggerMode="Click"
|
||||||
|
Placement="BottomEdgeAlignedLeft"
|
||||||
|
ConfirmCommand="{Binding ConfirmCommand}"
|
||||||
|
CancelCommand="{Binding Path=CancelCommand}" >
|
||||||
|
<TextBlock Text="Hello World" />
|
||||||
|
</u:PopConfirm>
|
||||||
<TextBlock Text="Asynchronized command support" Margin="0 16" />
|
<TextBlock Text="Asynchronized command support" Margin="0 16" />
|
||||||
<u:PopConfirm PopupHeader="Header" PopupContent="Content"
|
<u:PopConfirm PopupHeader="Header" PopupContent="Content"
|
||||||
ConfirmCommand="{Binding AsyncConfirmCommand}"
|
ConfirmCommand="{Binding AsyncConfirmCommand}"
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class PopConfirm : ContentControl
|
|||||||
private void SetupChildrenEventSubscriptions(Control? child, PopConfirmTriggerMode mode)
|
private void SetupChildrenEventSubscriptions(Control? child, PopConfirmTriggerMode mode)
|
||||||
{
|
{
|
||||||
if (child is null) return;
|
if (child is null) return;
|
||||||
if (mode == PopConfirmTriggerMode.Tap)
|
if (mode == PopConfirmTriggerMode.Click)
|
||||||
{
|
{
|
||||||
if (child is Button button)
|
if (child is Button button)
|
||||||
Button.ClickEvent.AddHandler(OnMainButtonClicked, button);
|
Button.ClickEvent.AddHandler(OnMainButtonClicked, button);
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ namespace Ursa.Controls;
|
|||||||
|
|
||||||
public enum PopConfirmTriggerMode
|
public enum PopConfirmTriggerMode
|
||||||
{
|
{
|
||||||
Tap,
|
Click,
|
||||||
Focus,
|
Focus,
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user