/// <summary> /// Opens the editor, binding it to a temporary copy of the current location /// that can be saved, or discarded if the user dismisses the editor. /// </summary> /// <param name="location"></param> private void EditLocation(LocationData location) { this.locationInEdit = location; var element = this.GetTemplateRootForLocation(location); var flyout = Flyout.GetAttachedFlyout(element) as Flyout; (flyout.Content as FrameworkElement).DataContext = location.Clone(); flyout.ShowAt(element); }