コード例 #1
0
        // needed because the ActualWidth and ActualHeight properties dont post updates when its changed
        // see: https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.frameworkelement.actualwidth
        private void UpdateNotePopupSizeAndPosition()
        {
            InvalidateArrange();
            InvalidateMeasure();

            if (ActualWidth < 768)
            {
                NotePopup.HorizontalOffset = 0;
                NotePopup.VerticalOffset   = -48;// CommandBar Height

                NoteFrame.Width  = (ActualWidth <= 0 ? App.RootFrame.ActualWidth : ActualWidth) - NotePopup.HorizontalOffset;
                NoteFrame.Height = (ActualHeight <= 0 ? App.RootFrame.ActualHeight : ActualHeight) - NotePopup.VerticalOffset;
                NoteFrame.ClearValue(FrameworkElement.MaxHeightProperty);
            }
            else
            {
                var   ttv   = NoteQuickBoxContainer.TransformToVisual(Content);
                Point point = ttv.TransformPoint(new Point(0, 0));

                NotePopup.HorizontalOffset = point.X;
                NotePopup.VerticalOffset   = point.Y;

                NoteFrame.Width = (NoteQuickBoxContainer.ActualWidth <= 0 ? App.RootFrame.ActualWidth : NoteQuickBoxContainer.ActualWidth);
                NoteFrame.ClearValue(FrameworkElement.HeightProperty);

                ttv   = NoteQuickBoxContainer.TransformToVisual(ContentRoot);
                point = ttv.TransformPoint(new Point(0, 0));

                NoteFrame.MaxHeight = Math.Max(0, ContentRoot.ActualHeight - NotePopup.VerticalOffset - point.Y);
            }
        }