diff --git a/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml b/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml
index 45d67e5..949429c 100644
--- a/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml
+++ b/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml
@@ -2,8 +2,6 @@
x:Class="Callisto.TestApp.SamplePages.CustomDialogSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:Callisto.TestApp.SamplePages"
- xmlns:callisto="using:Callisto.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
@@ -11,10 +9,12 @@
-
+
+
+
+
-
-
\ No newline at end of file
+
diff --git a/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml.cs b/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml.cs
index bb0462e..1e99555 100644
--- a/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml.cs
+++ b/src/Callisto.TestApp/SamplePages/CustomDialogSample.xaml.cs
@@ -1,58 +1,50 @@
using System;
-using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using Callisto.Controls.Common;
+using LinqToVisualTree;
using UIElementLeakTester;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
+
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Navigation;
-using Callisto.Controls.Common;
-using Callisto.Controls;
-using Windows.UI;
-// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
+using Callisto.Controls;
namespace Callisto.TestApp.SamplePages
{
- ///
- /// An empty page that can be used on its own or navigated to within a Frame.
- ///
- public sealed partial class CustomDialogSample : Page
+ public sealed partial class CustomDialogSample
{
+ private CustomDialog dialog;
+
public CustomDialogSample()
{
this.InitializeComponent();
+
+ this.Loaded += (sender, args) => {
+ var mp = Frame.Ancestors().FirstOrDefault().Descendants().FirstOrDefault();
+ dialog = (mp as MainPage).LoginDialog;
+ dialog.IsOpenChanged += (o, e) => {
+ IsOpenChangedTextBlock.Text = (bool)e.NewValue ? "Open" : "Closed";
+ };
+ };
}
private void CustomDialogClicked(object sender, RoutedEventArgs e)
{
- var mp = Frame.Ancestors().FirstOrDefault().Descendants().FirstOrDefault();
- (mp as MainPage).LoginDialog.IsOpen = true;
+ dialog.IsOpen = true;
}
private void MessageDialogClicked(object sender, RoutedEventArgs e)
{
- MessageDialog md = new MessageDialog("Bacon ipsum dolor sit amet bacon ham drumstick strip steak, sausage frankfurter tenderloin turkey salami andouille bresaola. Venison salami prosciutto, pork belly turducken tri-tip spare ribs chicken strip steak fatback shankle tongue boudin andouille. Meatloaf salami pork ground round turkey jerky meatball ball tip, filet mignon fatback flank prosciutto shank. Turkey boudin ham hock, filet mignon tri-tip bresaola tongue venison spare ribs meatloaf flank beef pancetta. Leberkas turducken flank ground round biltong chuck bacon kielbasa. Beef pastrami meatball, short loin venison swine pork loin shank meatloaf spare ribs.",
+ MessageDialog md = new MessageDialog(
+ "Bacon ipsum dolor sit amet bacon ham drumstick strip steak, sausage frankfurter tenderloin turkey salami andouille bresaola. Venison salami prosciutto, pork belly turducken tri-tip spare ribs chicken strip steak fatback shankle tongue boudin andouille. Meatloaf salami pork ground round turkey jerky meatball ball tip, filet mignon fatback flank prosciutto shank. Turkey boudin ham hock, filet mignon tri-tip bresaola tongue venison spare ribs meatloaf flank beef pancetta. Leberkas turducken flank ground round biltong chuck bacon kielbasa. Beef pastrami meatball, short loin venison swine pork loin shank meatloaf spare ribs.",
"Bacon Terms and Conditions");
+
#pragma warning disable 4014
md.ShowAsync();
#pragma warning restore 4014
}
- private void DialogCancelClicked(object sender, RoutedEventArgs e)
- {
- //TaggedDialog.IsOpen = false;
- }
-
///
/// To ensure there is no memory leak, a new CustomDialog is added to and removed from the visual tree.
/// Each step waits for it to load before continuing.
diff --git a/src/Callisto/Controls/CustomDialog/CustomDialog.cs b/src/Callisto/Controls/CustomDialog/CustomDialog.cs
index fba967f..fe96e17 100644
--- a/src/Callisto/Controls/CustomDialog/CustomDialog.cs
+++ b/src/Callisto/Controls/CustomDialog/CustomDialog.cs
@@ -84,6 +84,7 @@ private void OnUnloaded(object sender, RoutedEventArgs routedEventArgs)
#region Events
public event RoutedEventHandler BackButtonClicked;
+ public event DependencyPropertyChangedEventHandler IsOpenChanged;
#endregion
#region Member Variables
@@ -120,13 +121,18 @@ public bool IsOpen
private static void OnIsOpenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- if ((bool)e.NewValue)
+ var dlg = d as CustomDialog;
+ if (dlg != null)
{
- CustomDialog dlg = d as CustomDialog;
- if (dlg != null)
+ if ((bool)e.NewValue)
{
dlg.ApplyTemplate();
}
+
+ if (dlg.IsOpenChanged != null)
+ {
+ dlg.IsOpenChanged(d, e);
+ }
}
}