Esempio n. 1
0
        private void HandleLoaded(object sender, RoutedEventArgs e)
        {
            popup = new Popup();

            view = new DocumentPadView() {DataContext = ApplicationModel.Current.DocumentPad};

            ResizablePopupFrameBehavior.SetParentPopup(view, popup);
            ResizablePopupFrameBehavior.SetResizeBounds(view, GetCurrentPopupBounds());

            view.Width = 300;
            view.Height = 300;

            PropertyChangedEventHandler documentPadOnPropertyChanged = null;
            documentPadOnPropertyChanged = (s, args) =>
            {
                ApplicationModel.Current.DocumentPad.PropertyChanged -= documentPadOnPropertyChanged;
                var bounds = GetCurrentPopupBounds();
                if (args.PropertyName == "IsOpen")
                {
                    popup.HorizontalOffset = bounds.Right - view.Width;
                    popup.VerticalOffset = bounds.Bottom - view.Height;
                }
            };

            ApplicationModel.Current.DocumentPad.PropertyChanged += documentPadOnPropertyChanged;
            

            popup.Child = view;
            popup.SetBinding(Popup.IsOpenProperty, new Binding("IsOpen") {Source = ApplicationModel.Current.DocumentPad});
        }
Esempio n. 2
0
        private void HandleLoaded(object sender, RoutedEventArgs e)
        {
            popup = new Popup();

            view = new DocumentPadView()
            {
                DataContext = ApplicationModel.Current.DocumentPad
            };

            ResizablePopupFrameBehavior.SetParentPopup(view, popup);
            ResizablePopupFrameBehavior.SetResizeBounds(view, GetCurrentPopupBounds());

            view.Width  = 300;
            view.Height = 300;

            PropertyChangedEventHandler documentPadOnPropertyChanged = null;

            documentPadOnPropertyChanged = (s, args) =>
            {
                ApplicationModel.Current.DocumentPad.PropertyChanged -= documentPadOnPropertyChanged;
                var bounds = GetCurrentPopupBounds();
                if (args.PropertyName == "IsOpen")
                {
                    popup.HorizontalOffset = bounds.Right - view.Width;
                    popup.VerticalOffset   = bounds.Bottom - view.Height;
                }
            };

            ApplicationModel.Current.DocumentPad.PropertyChanged += documentPadOnPropertyChanged;


            popup.Child = view;
            popup.SetBinding(Popup.IsOpenProperty, new Binding("IsOpen")
            {
                Source = ApplicationModel.Current.DocumentPad
            });
        }