Configuring Window Max and Minimize

7 posts, 0 answers
  1. Graham
    Graham avatar
    11 posts
    Member since:
    Jan 2010

    Posted 18 Mar 2010 Link to this post

    I suspect that the problems I am having are fairly trivial.

    We are using a MainPage with a rad ribbon bar, rad ribbon tabs and rad ribbon buttons to open rad windows.

    There are certain things I would like to be able to do:

    1. I want to be able to be able to open a rad window maximized so that fits in the available area. This would include the available browser window minus the area taken up by the rad ribbon - I will probably have to handle the ribbon 'min' and 'max' events when the ribbon is collapsed and expanded to make adjustments.

    2. I want to always minimise so that the window just displays the title bar with all the title text visible. This seems to be the default behaviour but I am not always getting it.  (Note I have inherited this code and I am trying to get i to behave as required.)

    3. I am also able to drag the minimized window outside the browser so that I can not see it or access it.  How can I prevent this?

    Regards
    Graham

  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 19 Mar 2010 Link to this post

    Hi Graham,

     For the first request you could experiment with the RestrictedAreaMargin property of the RadWindow control. It describes a margin from the edges of the Silverlight plugin in which the RadWindow will be maximized. In combination with the IsRestricted property of the RadWindow control it restricts the drag and resize of the RadWindow in this area too. This might help for the third request.

    About the second one - what happens when you are not getting this behavior? If you could provide us with sample application it will be very helpful.

    Best wishes,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Graham
    Graham avatar
    11 posts
    Member since:
    Jan 2010

    Posted 23 Mar 2010 Link to this post

    Miroslav

    Thanks very much for your response.  I am now working on this.

    I have managed to set the RestrictedAreaMargin for when the RadWindow is maximized and trapped the event when the RadRibbonBar is miminimised.  I set the RestrictedAreaMargin in code BUT this does alter the size of the maximised window - I have also tried calling UpdateLayout() on the RadWindow.

    Please see the code below (note that this code is not complete just work in progress).

            private void Ribbon_MinimizedChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                RadRibbonBar radRibbon = e.OriginalSource as RadRibbonBar;
                //  update the RestrictedAreaMargin for the radwindows
                if (radRibbon.IsMinimized == true)
                {
                    Thickness ribbonMinimizedRestrictedArea = new Thickness(0.0, 75.0, 0.0, 0.0);
                    radWin.RestrictedAreaMargin = ribbonMinimizedRestrictedArea;
                    if (radWin.WindowState == WindowState.Maximized)
                    {
                        radWin.UpdateLayout();
                    }
                }
                else
                {
                    Thickness ribbonMaximizedRestrictedArea = new Thickness(0.0, 75.0, 0.0, 0.0);
                    radWin.RestrictedAreaMargin = ribbonMaximizedRestrictedArea;
                }
            }

    Thanks again for you efforts - they are much appreciated.

    Regards

    Graham
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 23 Mar 2010 Link to this post

    Hi Graham,

     The RestrictedAreaMargin does affect the size of the maximized window. Could you please describe what is the searched behavior?

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Graham
    Graham avatar
    11 posts
    Member since:
    Jan 2010

    Posted 23 Mar 2010 Link to this post

    Hi Miroslav

    I want to be able to maximise my rad window so that it does not go over the RadRibbonBar that we have.  I have been able to this by setting the RestrictedAre Margin as you advised.

    What I now want to be able to do is is increase the size of the maximised window when the RadRibbonBar is miminised and then reduce it when then RadRibbonBar is maximised - basically I want to use the maximium space available without going over the RadRibbonBar.

    Using the code above will not change the size of the maximised window dynamically BUT if, as a user, I minimise and then maximise the window the updated RestrictedAreaMargin takes effect.  I was hoping that UpdateLayout() on the RadWindow would change the size of the maximised window after changing the RestrictedAreaMargin.

    Hope I have managed to better explain what I would like to do and how I am trying to do it.

    Regards
    Graham
  7. Graham
    Graham avatar
    11 posts
    Member since:
    Jan 2010

    Posted 24 Mar 2010 Link to this post

    Hi Miroslav

    At the moment I have put the resizing of the maximized window when the RadRibbonBar is maximised and minimised to one side until I get a response.

    In the meantime I am looking at restricting where the minimised and resized RadWindow can be dragged.  As you suggested I am using the IsRestricted property of the RadWindow.  This works fine unless the RadWindow contains RadDocking and I minimise the window then I get the following error:

    Unhandled error in Silverlight application

    Code: 4004

    Category: Managed Runtime Error

    This error does not happen when IsRestricted is false.

    Regards
    Graham

  8. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 25 Mar 2010 Link to this post

    Hello Graham,

     About the second problem - could you please send us a sample project that reproduces the issue? This will be very helpful in investigating what the problem is and will let us provide you with better solution.

    About the RastrictedAreaMargin - we decided that the window will not auto update its size and position when the restricted area is updated. In order to work-around this limitation you might use the following code:

    var state = window.WindowState;
    window.WindowState = state == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
    window.WindowState = state;

    Please, find the attached project for the entire example.

    All the best,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
DevCraft banner