private void AttachAcceptCommand(IFrameworkElement rootControl) { var acceptButton = rootControl.FindName("AcceptButton") as Button; if (acceptButton != null && acceptButton.Command == null) { acceptButton.Command = new DelegateCommand(Accept); } }
private void AttachDismissCommand(IFrameworkElement rootControl) { var dismissButton = rootControl.FindName("DismissButton") as Button; if (dismissButton != null && dismissButton.Command == null) { dismissButton.Command = new DelegateCommand(Dismiss); } }
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()); } }
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); }
/// <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)); }