Esempio n. 1
0
        private void AttachAcceptCommand(IFrameworkElement rootControl)
        {
            var acceptButton = rootControl.FindName("AcceptButton") as Button;

            if (acceptButton != null && acceptButton.Command == null)
            {
                acceptButton.Command = new DelegateCommand(Accept);
            }
        }
Esempio n. 2
0
        private void AttachDismissCommand(IFrameworkElement rootControl)
        {
            var dismissButton = rootControl.FindName("DismissButton") as Button;

            if (dismissButton != null && dismissButton.Command == null)
            {
                dismissButton.Command = new DelegateCommand(Dismiss);
            }
        }
Esempio n. 3
0
        private void AttachDismissCommand(IFrameworkElement control)
        {
            var b = control.FindName("DismissButton") as Button;

            if (b != null && b.Command == null)
            {
                var wr = WeakReferencePool.RentWeakReference(this, this);
                b.Command = new DelegateCommand(() => (wr.Target as TimePickerFlyout)?.Dismiss());
            }
        }
Esempio n. 4
0
        private static IFrameworkElement ConvertFromStubToElement(this IFrameworkElement element, IFrameworkElement originalRootElement, string name)
        {
            var elementStub = element as ElementStub;

            if (elementStub != null)
            {
                elementStub.Materialize();
                element = originalRootElement.FindName(name);
            }
            return(element);
        }
Esempio n. 5
0
 /// <summary>
 /// Finds a realised element in the control template
 /// </summary>
 /// <param name="e">The framework element instance</param>
 /// <param name="name">The name of the template part</param>
 public static DependencyObject GetTemplateChild(this IFrameworkElement e, string name)
 {
     return(e.FindName(name));
 }