コード例 #1
0
        // ReSharper restore UnusedMethodReturnValue.Local
        // ReSharper disable UnusedMethodReturnValue.Local
        private static ControlBase StoreWindowProperties(this ControlBase control, WindowBase targetWindow)
        {
            //preserve LUCAStackPanel attached properties for later restores into new LUCATabWindow
            if (targetWindow.ContainerContextSet())
            {
                control.StoreProperty(LUCAStackPanel.ColumnDefinitionProperty,
                                      LUCAStackPanel.GetColumnDefinition(targetWindow), true);
                control.StoreProperty(LUCAStackPanel.RowDefinitionProperty,
                                      LUCAStackPanel.GetRowDefinition(targetWindow), true);

                var pos = targetWindow.GetPosition(control.LayoutContext.RootVisual);

                control.StoreProperty(Canvas.LeftProperty, pos.X, true);
                control.StoreProperty(Canvas.TopProperty, pos.Y, true);
                control.StoreProperty(FrameworkElement.WidthProperty, targetWindow.Width, true);
                control.StoreProperty(FrameworkElement.HeightProperty, targetWindow.Height, true);
            }

            return control;
        }