This is a migrated thread and some comments may be shown as answers.

RadPane, Fixed Size

7 Answers 183 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 02 Aug 2011, 04:37 PM
Hi,

I'm using Silverlight 4 and Telerik 2011.1.419.1040.  Is there any way to set a fixed width and height for a floating RadPane?  I found the post referring to SL3, however, the assemblies are different and the resource does not compile.

SL3 Post:
http://www.telerik.com/community/forums/silverlight/docking/disable-the-possibility-to-let-the-user-resize-a-radpane.aspx

7 Answers, 1 is accepted

Sort by
0
bg
Top achievements
Rank 1
answered on 03 Aug 2011, 10:49 PM
You can force a minimum size or set the size explicitly when the pane switches to a floating pane from a docked pane. You will need to handle the PaneStateChange event on the rad docking control like this:
private void radDocking_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            foreach (RadPane pane in radDocking.Panes)
            {
                if (pane != null && pane.IsFloating)
                {
                    ToolWindow toolWindow = GetToolWindow(pane);
                    toolWindow.Height = 200;
                    toolWindow.Width = 200;
                }
            }
        }
 
private ToolWindow GetToolWindow(RadPane pane)
        {
            ToolWindow window = pane.ParentOfType<ToolWindow>();
            if (window == null)
            {
                window = (((pane.Parent as RadPaneGroup).Parent as RadSplitContainer).Parent) as ToolWindow;
            }
            return window;
        }

Hope that helps.
0
Jay
Top achievements
Rank 1
answered on 04 Aug 2011, 05:19 PM

A good idea, however not really the solution I’m looking for.  If I could disable the ability to resize, that would work.  These windows are more like dialogs and cannot dock when they’re in a different state.

Is there any way to prevent the RadPane from resizing at all?

0
Konstantina
Telerik team
answered on 09 Aug 2011, 12:13 PM
Hello Jay,

You could set the Max/Min Width and Height of the ToolWindow like this:

toolwindow.MinHeight = 200;
toolwindow.MinWidth = 300;
toolwindow.MaxHeight = 200;
toolwindow.MaxWidth = 300;

That will prevent the resize.

Hope this helps.

Greetings,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Jay
Top achievements
Rank 1
answered on 09 Aug 2011, 02:47 PM

That worked, partially.  It prevents the window from resizing but the resize icon (arrows) still shows up when hovering over the edges.  Is there any way to prevent the resize icon from displaying?

Code:

ToolWindow parentToolWindow = Telerik.Windows.Controls.UIElementExtensions.ParentOfType<ToolWindow>(radPane);
 
if (parentToolWindow != null)
{
    parentToolWindow.MinHeight =
        parentToolWindow.MaxHeight = FixedHeight;
 
    parentToolWindow.MinWidth =
        parentToolWindow.MaxWidth = FixedWidth;
}
        
0
Konstantina
Telerik team
answered on 10 Aug 2011, 12:47 PM
Hello Jay,

I thought of a better way to do this. Since Q2 2011 the ToolWindow and the RadWindow inherit a common class. So, you could set the ResizeMode property of the ToolWindow, instead of setting the Min and Max sizes. In that way the ToolWindow won't be resizable and the arrows will be gone.
Another approach is to inherit the DefaultGeneratedItemsFactory and override the CreateToolWindow property.
Please find attached a sample project which illustrates both approaches.

Best wishes,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Cody
Top achievements
Rank 1
answered on 24 Aug 2011, 04:24 PM
Awesome, now how do I get rid of the little 'X' in the upper corner?  It is disabled since the PaneHeader is not visible, but you can see it.

Cody
0
Boyan
Telerik team
answered on 29 Aug 2011, 01:35 PM
Hello Cody,

You can try to set CanClose= false, another property that comes from the common class of ToolWindow and RadWindow.

All the best,
Boyan
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Docking
Asked by
Jay
Top achievements
Rank 1
Answers by
bg
Top achievements
Rank 1
Jay
Top achievements
Rank 1
Konstantina
Telerik team
Cody
Top achievements
Rank 1
Boyan
Telerik team
Share this question
or