Пример #1
0
        /// <summary>
        /// Sets up the size of the dialog and adds it to the specified container.</summary>
        /// <param name="window">The window in which to host the dialog content</param>
        /// <param name="dialog">The user control containing the dialog content</param>
        /// <returns>An event handler for when the size of the dialog changes</returns>
        public static SizeChangedEventHandler SetupAndOpenDialog(IDialogSite window, Control dialog)
        {
            dialog.MinHeight = window.Site.ActualHeight / 4.0;
            dialog.MaxHeight = window.Site.ActualHeight;

            SizeChangedEventHandler sizeHandler = null; //an event handler for auto resizing an open dialog.

            sizeHandler = (sender, args) =>
            {
                dialog.MinHeight = window.Site.ActualHeight / 4.0;
                dialog.MaxHeight = window.Site.ActualHeight;
            };

            window.Site.SizeChanged += sizeHandler;

            window.Site.Children.Add(dialog); //add the dialog to the container

            return(sizeHandler);
        }
Пример #2
0
        /// <summary>
        /// Sets up the size of the dialog and adds it to the specified container.</summary>
        /// <param name="window">The window in which to host the dialog content</param>
        /// <param name="dialog">The user control containing the dialog content</param>
        /// <returns>An event handler for when the size of the dialog changes</returns>
        public static SizeChangedEventHandler SetupAndOpenDialog(IDialogSite window, Control dialog)
        {
            dialog.MinHeight = window.Site.ActualHeight / 4.0;
            dialog.MaxHeight = window.Site.ActualHeight;

            SizeChangedEventHandler sizeHandler = null; //an event handler for auto resizing an open dialog.
            sizeHandler = (sender, args) =>
                {
                    dialog.MinHeight = window.Site.ActualHeight / 4.0;
                    dialog.MaxHeight = window.Site.ActualHeight;
                };

            window.Site.SizeChanged += sizeHandler;

            window.Site.Children.Add(dialog); //add the dialog to the container

            return sizeHandler;
        }