void window_Closed(object sender, EventArgs e)
 {
     RemoveFromWindowsList();
     Window.Closing -= window_Closing;
     Window.Closed  -= window_Closed;
     DocumentViewModelHelper.OnDestroy(GetContent());
 }
        public static void SetTitleBinding(object documentContentView, DependencyProperty property, FrameworkElement target, bool convertToString = false)
        {
#if !SILVERLIGHT && !NETFX_CORE
            target.SetBinding(TitleListenProperty, new Binding()
            {
                Source = target, Path = new PropertyPath(property), Mode = BindingMode.OneWay
            });
#endif
            object viewModel = ViewHelper.GetViewModelFromView(documentContentView);
            if (!DocumentViewModelHelper.IsDocumentContentOrDocumentViewModel(viewModel))
            {
                return;
            }
            if (DocumentViewModelHelper.TitlePropertyHasImplicitImplementation(viewModel))
            {
                Binding binding = new Binding()
                {
                    Path = new PropertyPath("Title"), Source = viewModel
                };
#if !SILVERLIGHT && !NETFX_CORE
                if (convertToString)
                {
                    binding.Converter = new ObjectToStringConverter();
                }
#endif
                target.SetBinding(property, binding);
            }
            else
            {
                new TitleUpdater(convertToString, viewModel, target, property).Update(target, viewModel);
            }
        }
        void OnPopup_Closing(CancelEventArgs e)
        {
#if DEBUG
            OnClosing(e);
#endif
            DocumentViewModelHelper.OnClose(ViewHelper.GetViewModelFromView(Content), e);
        }
 void OnWindowClosed(object sender, EventArgs e)
 {
     window.Closing -= OnWindowClosing;
     window.Closed  -= OnWindowClosed;
     DocumentViewModelHelper.OnDestroy(GetViewModel(window.RealWindow));
     window = null;
 }
 void window_Closing(object sender, CancelEventArgs e)
 {
     DocumentViewModelHelper.OnClose(GetContent(), e);
     if (!destroyOnClose && !e.Cancel)
     {
         e.Cancel = true;
         HideWindow(Window.RealWindow);
     }
 }
예제 #6
0
            public void Update(DependencyObject target, object documentContentOrDocumentViewModel)
            {
                object title = DocumentViewModelHelper.GetTitle(documentContentOrDocumentViewModel);

                if (convertToString)
                {
                    title = title == null ? string.Empty : title.ToString();
                }
                target.SetValue(targetProperty, title);
            }
예제 #7
0
 void window_Closing(object sender, CancelEventArgs e)
 {
     onClosing = true;
     DocumentViewModelHelper.OnClose(GetContent(), e);
     if (!destroyOnClose && !e.Cancel)
     {
         e.Cancel = true;
         Window.Hide();
     }
     onClosing = false;
 }
 public bool Close(bool force = false)
 {
     if (!force)
     {
         var eventArgs = new CancelEventArgs();
         OnPopup_Closing(eventArgs);
         if (eventArgs.Cancel)
         {
             return(false);
         }
     }
     if (AsyncAction != null)
     {
         AsyncAction.Cancel();
     }
     Window.Current.CoreWindow.SizeChanged -= CoreWindow_SizeChanged;
     if (Popup != null)
     {
         DocumentViewModelHelper.OnDestroy(ViewHelper.GetViewModelFromView(Content));
         Popup.IsOpen = false;
         Popup        = null;
     }
     return(true);
 }
 void OnWindowClosing(object sender, CancelEventArgs e)
 {
     DocumentViewModelHelper.OnClose(GetViewModel(window.RealWindow), e);
 }