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

Probles with RadWindow using Rotate

0 Answers 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sun
Top achievements
Rank 1
sun asked on 13 Apr 2012, 04:24 AM
Dear,  sir

       Today, i want to rotate RadWindow to display two different UI Pages.  but i surprisely find that there is something wrong with RadWindow  about doing (UIElement.Projection).(RotationY).  Here are my codes  :
a)  //Show my first window content, just common usage.
  void TestCode()
     {
    win = new RadWindow();
      win.Content = new VisMyUIContent(); // here you should change it to your UserControl element.
     win.Left = (App.Current.Host.Content.ActualWidth - 800) / 2 ;
     win.Top = (App.Current.Host.Content.ActualHeight - 600) / 2 ;
     win.Header = "xxxx";
     win.Width = 800;
     win.Height = 600;
     win.Show();
    //then i slowly change the content of the RadWindow, to show another UI content.
    Storyboard sb = GetFlipPageStoryBoard(win, 0, 90, 1000); //first rotateY with 90 degree 
    sb.Begin();
    sb.Completed += (new EventHandler(this.OnFlipStoryboadCompleted));
  }
  // win is a gloabal variant.
  RadWindow win = null;

//Get an animation storyboard to show another page content in the RadWindow  

 private Storyboard GetFlipPageStoryBoard(RadWindow obj, double dAngleFom, double dAngleTo, double dTime)
        {
            double time = dTime;
            Storyboard sb = new Storyboard();
            PlaneProjection pProj = new PlaneProjection();
                pProj.CenterOfRotationX = 0.5; //the default setting
                obj.Projection = pProj;
                ScaleTransform sTr = new ScaleTransform();
                obj.RenderTransform = sTr;

                //RotateY
                DoubleAnimation animation = new DoubleAnimation();
                animation.From = (new double?(dTime));
                animation.To = (new double?(dAngleTo));
                animation.Duration = (new Duration(TimeSpan.FromMilliseconds((double)time)));
                Storyboard.SetTarget(animation, obj);
                Storyboard.SetTargetProperty(animation, new PropertyPath("(UIElement.Projection).(RotationY)", new object[0]));
                sb.Children.Add(animation);

           
            return sb;
        }


// after rotating Y axis with 90 degree, i change the content of this RadWindow, and then continue suddenly rotateY with 180 degree,
// and the continue rotateY from 270 degree to 360 degree, to show smoothly another page within the same RadWindow;
 private void OnFlipStoryboadCompleted(object sender, EventArgs e)

{
            (sender as Storyboard).Completed -= (new EventHandler(this.OnFlipStoryboadCompleted));
           //here win.Content should be set to your  UI Content.
            win.Content = new VisTwoPillarTable(lstXstring, lstQ1, lstQ2, "xxxxxxx", 20000, 1000);
            win.Show();
            win.Projection = new PlaneProjection()
            {
                RotationY = 180
            };
            Storyboard sb = GetFlipPageStoryBoard(win, 270, 360, 1000);
            sb.Begin();
  }


b) and here ,i think it is should ok ,but the result  do surprise me greatly.  Some part of the RadWindow  is clipped , the corner of the  window, i think the RadWindow maybe show  its content  without thinking about Rotating,  After Rotating ,the size of the RadWindow  is changed ,so it cannot show normally! Then i test this guess using the System.Windows.Controls.ChildWindow, Just Perfect, it do can show normally,even Rotating any angle.            the error.png  has this uncorrect example.

c) and now ,do i already  tell the question clearly ? and Can you  give me  any help?  thanks a Lot.

Tags
General Discussions
Asked by
sun
Top achievements
Rank 1
Share this question
or