RadWindow Cascading

3 posts, 0 answers
  1. Naseem
    Naseem avatar
    70 posts
    Member since:
    Nov 2010

    Posted 17 Mar 2011 Link to this post

    Hi,

    I'd like to define multiple RadWindow in cascading order (attached file).

    I have read the link bellow
    http://www.telerik.com/help/silverlight/radwindow-features-positioning.html

    Also I have read the code for RadWindow/Ordering  (which was in demo/Window/Ordering)
    private void window_Opened(object sender, RoutedEventArgs e)
            {
                window.Opened -= window_Opened;
                int offsetLeft = 500;
                int offsetTop = 200;
                foreach (ExampleWindow w in windows)
                {
                    w.Left = offsetLeft;
                    w.Top = offsetTop;
                    w.Show();
                    offsetLeft += 20;
                    offsetTop += 20;
                }
            }

    but still I'm not sure how I can implement cacading functionality. Since in the sample the specific left and top has been set , whereas I'm looking for a solution that the first window open in the center and the next windows opens with left+=20 and Top+=20

    I'd be thankful you guide me what is the best solution for that

    Thank you,
  2. Naseem
    Naseem avatar
    70 posts
    Member since:
    Nov 2010

    Posted 17 Mar 2011 Link to this post

    Hi again,

    I have realized how I can achive cascading functionality . I needed to use

    CategoryInfoPage.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterOwner;

     

    And also

     

    void CategoryInfoPage_Opened(object sender, RoutedEventArgs e)
           {
               IList<Telerik.Windows.Controls.RadWindow> lst = Telerik.Windows.Controls.RadWindowManager.Current.GetWindows();
               CategoryInfoPage.Opened -= CategoryInfoPage_Opened;
               int offsetLeft = 500;
               int offsetTop = 200;
               foreach (CategoryInfoPage w in lst)
               {
                   w.Left = offsetLeft;
                   w.Top = offsetTop;
                   w.Show();
                   offsetLeft += 20;
                   offsetTop += 20;
               }
           }

    It's working fine now with cascading . However as I said earlier I'm looking for a solution not to specify the offset left and top , as I'd like to show it in the center of screen.
    I'm looking for either of the bellow solutions:
    1. Show the first window in the center and the rest of windows displaying cascading way based on the first window top and left
    2. Find the center of screen position and set top and left with that

    Thank you for your help,
  3. DevCraft banner
  4. Naseem
    Naseem avatar
    70 posts
    Member since:
    Nov 2010

    Posted 17 Mar 2011 Link to this post

    Here is the final solution I have found:
    void CategoryInfoPage_Opened(object sender, RoutedEventArgs e)
            {
                IList<Telerik.Windows.Controls.RadWindow> lst = Telerik.Windows.Controls.RadWindowManager.Current.GetWindows();
      
                CategoryInfoPage.Opened -= CategoryInfoPage_Opened;
                double offsetLeft = ((System.Collections.ObjectModel.ReadOnlyCollection<Telerik.Windows.Controls.RadWindow>)(lst))[0].Left; 
                double offsetTop = ((System.Collections.ObjectModel.ReadOnlyCollection<Telerik.Windows.Controls.RadWindow>)(lst))[0].Top;
      
                foreach (CategoryInfoPage w in lst)
                {
                    w.Left = offsetLeft;
                    w.Top = offsetTop;
                    w.Show();
                    offsetLeft += 20;
                    offsetTop += 20;
                }
      
            }

     

     

     

    It gave me the left and top of first window,

     

     

     

Back to Top