Ejemplo n.º 1
0
 private void HandleSizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (view != null)
     {
         var bounds = GetCurrentPopupBounds();
         ResizablePopupFrameBehavior.SetResizeBounds(view, bounds);
         RepositionPopup(bounds, e.PreviousSize, e.NewSize);
     }
 }
Ejemplo 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
            });
        }