feat: enhance PopConfirm with async command support and improve binding. add more demo.

This commit is contained in:
Dong Bin
2025-04-18 17:54:16 +08:00
parent 2a081c0f95
commit 67025dca9c
4 changed files with 52 additions and 20 deletions

View File

@@ -12,7 +12,7 @@
ContentTemplate="{TemplateBinding ContentTemplate}" />
<Popup
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsDropdownOpen, Mode=TwoWay}"
IsOpen="{Binding IsDropdownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
OverlayInputPassThroughElement="{Binding #PART_ContentPresenter}"
Name="{x:Static u:PopConfirm.PART_Popup}"
Placement="{TemplateBinding Placement}" >

View File

@@ -201,8 +201,11 @@ public class PopConfirm : ContentControl
protected override bool RegisterContentPresenter(ContentPresenter presenter)
{
var result = base.RegisterContentPresenter(presenter);
_childChangeDisposable = presenter.GetPropertyChangedObservable(ContentPresenter.ChildProperty)
.Subscribe(OnChildChanged);
if (result)
{
_childChangeDisposable = presenter.GetPropertyChangedObservable(ContentPresenter.ChildProperty)
.Subscribe(OnChildChanged);
}
return result;
}