From 2d6bc096d890e45c9742c01ea6216256128c0293 Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Mon, 19 Dec 2022 16:59:52 +0900 Subject: [PATCH] [NUI] Add ActionsProperty to AlertDialog to support xaml To support Actions property of AlertDialog in xaml, the bindable property ActionsProperty has been added to AlertDialog. The AlertDialog example with xaml has been added to NUITizenGallery. --- src/Tizen.NUI.Components/Controls/AlertDialog.cs | 13 +++++++ .../Controls/AlertDialogBindableProperty.cs | 19 ++++++++++ .../AlertDialogTest/AlertDialogTestDialogPage.xaml | 19 ++++++++++ .../AlertDialogTestDialogPage.xaml.cs | 43 ++++++++++++++++++++++ .../AlertDialogTest/AlertDialogTestPage.xaml | 4 ++ .../AlertDialogTest/AlertDialogTestPage.xaml.cs | 8 +++- 6 files changed, 105 insertions(+), 1 deletion(-) create mode 100755 test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml create mode 100644 test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml.cs diff --git a/src/Tizen.NUI.Components/Controls/AlertDialog.cs b/src/Tizen.NUI.Components/Controls/AlertDialog.cs index 642bfaf..5a4334d 100755 --- a/src/Tizen.NUI.Components/Controls/AlertDialog.cs +++ b/src/Tizen.NUI.Components/Controls/AlertDialog.cs @@ -346,6 +346,19 @@ namespace Tizen.NUI.Components { get { + return GetValue(ActionsProperty) as IEnumerable; + } + set + { + SetValue(ActionsProperty, value); + NotifyPropertyChanged(); + } + } + + private IEnumerable InternalActions + { + get + { return actionContentViews; } set diff --git a/src/Tizen.NUI.Components/Controls/AlertDialogBindableProperty.cs b/src/Tizen.NUI.Components/Controls/AlertDialogBindableProperty.cs index d25c68d..21dc5c1 100755 --- a/src/Tizen.NUI.Components/Controls/AlertDialogBindableProperty.cs +++ b/src/Tizen.NUI.Components/Controls/AlertDialogBindableProperty.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Collections.Generic; using Tizen.NUI.BaseComponents; using Tizen.NUI.Binding; @@ -79,6 +80,24 @@ namespace Tizen.NUI.Components }); /// + /// ActionsProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty ActionsProperty = BindableProperty.Create(nameof(Actions), typeof(IEnumerable), typeof(AlertDialog), null, propertyChanged: (bindable, oldValue, newValue) => + { + var instance = (AlertDialog)bindable; + if (newValue != null) + { + instance.InternalActions = newValue as IEnumerable; + } + }, + defaultValueCreator: (bindable) => + { + var instance = (AlertDialog)bindable; + return instance.InternalActions; + }); + + /// /// ActionContentProperty /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml b/test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml new file mode 100755 index 0000000..f64f702 --- /dev/null +++ b/test/NUITizenGallery/Examples/AlertDialogTest/AlertDialogTestDialogPage.xaml @@ -0,0 +1,19 @@ + + + + + + + + +