RadPane, Fixed Size

8 posts, 0 answers
  1. Jay
    Jay avatar
    11 posts
    Member since:
    Sep 2010

    Posted 02 Aug 2011 Link to this post

    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
  2. bg
    bg avatar
    19 posts
    Member since:
    Jul 2006

    Posted 03 Aug 2011 Link to this post

    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.
  3. DevCraft banner
  4. Jay
    Jay avatar
    11 posts
    Member since:
    Sep 2010

    Posted 04 Aug 2011 Link to this post

    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?

  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 09 Aug 2011 Link to this post

    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 >>
  6. Jay
    Jay avatar
    11 posts
    Member since:
    Sep 2010

    Posted 09 Aug 2011 Link to this post

    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;
    }
            
  7. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 10 Aug 2011 Link to this post

    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 >>
  8. Cody
    Cody avatar
    9 posts
    Member since:
    Mar 2011

    Posted 24 Aug 2011 Link to this post

    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
  9. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 29 Aug 2011 Link to this post

    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 >>

Back to Top
DevCraft banner