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

When going from face 2 to face 4 - can you specify that it pass through face 5?

3 Answers 36 Views
Cube
This is a migrated thread and some comments may be shown as answers.
Brett Gilbert
Top achievements
Rank 1
Brett Gilbert asked on 05 Oct 2009, 11:17 PM
I am trying to lock the cube and only use 4 faces (faces 2-5) This is based off of the form wizard example.  my problem is that I want to go from face 2 to face 4 in the same visual fashion as going from face 2 to 3 or 2 to 5. A nice horizontal rotation.  Instead it rotates vertically and horizontally resulting in an ugly face change.

Are there any parameters or suggestions on how to get this to happen?
Thanks,

3 Answers, 1 is accepted

Sort by
0
Hristo Borisov
Telerik team
answered on 06 Oct 2009, 10:27 AM
Hello Brett Gilbert,

Unfortunately, we made a mistake when we designed the layout of the RadCube. As a consequence our cube doesn't have the same layout as a regular dice. That is why, you expect faces 1 and 6 to have no point of contact, which is not true for our RadCube. If you take a closer look at the layout of the faces you will notice that faces from 3 to 6 all lay on the same plane. Thus, my advise is to use sides from 3 to 6 to achieve only horizontal rotation of the cube. Here is a quick example of this.

        <telerikNav:RadCube x:Name="cube" XWidth="300" YWidth="300" SelectedIndex="2" ZWidth="300" Margin="300,300,0,0"  IsRotateOnClickEnabled="False"
            <TextBlock FontSize="20" Text="1"/> 
            <TextBlock FontSize="20" Text="2"/> 
            <TextBlock FontSize="20" Text="3"/> 
            <TextBlock FontSize="20" Text="4"/> 
            <TextBlock FontSize="20" Text="5"/> 
            <TextBlock FontSize="20" Text="6"/> 
        </telerikNav:RadCube> 

And the code behind part:

        private void Button_Click(object sender, RoutedEventArgs e) 
        { 
            cube.SelectedIndex++; 
        } 

Sorry once again for the inconvenience. If you have need any further assistance, don't hesitate to contact us again.

Best wishes,
Hristo Borisov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brett Gilbert
Top achievements
Rank 1
answered on 06 Oct 2009, 05:00 PM
This is the answer to my other question. =]

This question is when on face 3 and I want to go to the opposite face (face 5), I want the cube to rotate from face 3 to face 4 on to face 5.  instead it rotates on a diagonal axis straight from face 3 to face 5.

I found a solution using a Dispatch Timer.

I have 4 buttons that i can click to go to any face from any face.
On click, if the target face is the opposing face of the current face, it runs through the delay timer. 
basically forcing it to animate from face 3 to face 4 to face 5 and then turns off the timer.



public partial class Page : UserControl 
    { 
        private int faceIndex = 2
        public Page() 
        { 
            InitializeComponent(); 
            RadCube1.SelectedIndex = 2
        } 
        int timerCount = 2
        int starter = 0
        public void StartTimer() 
        { 
            System.Windows.Threading.DispatcherTimer myDispatcherTimer = new System.Windows.Threading.DispatcherTimer(); 
            myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 250); // 100 Milliseconds 
            if (starter == 0) 
            { 
                myDispatcherTimer.Tick += new EventHandler(Each_Tick); 
                starter = 1
            } 
            if (timerCount == 0) 
            { 
                myDispatcherTimer.Start(); 
            } 
            else if (timerCount == 2) 
            { 
                myDispatcherTimer.Tick -Each_Tick
                myDispatcherTimer.Stop(); 
            } 
        } 
 
        // Fires every 100 miliseconds while the DispatcherTimer is active. 
        public void Each_Tick(object o, EventArgs sender) 
        { 
            if (timerCount == 0) 
            { 
                this.faceIndex++; 
                if (this.faceIndex > 5) 
                { 
                    this.faceIndex = 2
                } 
                RadCube1.SelectedIndex = this.faceIndex; 
                timerCount = 1
            } 
            else if (timerCount == 1) 
            { 
                this.faceIndex++; 
                if (this.faceIndex > 5) 
                { 
                    this.faceIndex = 2
                } 
                RadCube1.SelectedIndex = this.faceIndex; 
                timerCount = 2
            } 
            else if (timerCount == 2) 
            { 
                StartTimer(); 
            } 
        } 

Hope this helps.
0
Hristo Borisov
Telerik team
answered on 06 Oct 2009, 08:30 PM
Hello Brett Gilbert,

We will consider changing the layout of the cube in order to reflect a regular dice which will get rid of some of your problems. If you have any other feedback that you are willing to share feel free to contact us again.

Sincerely yours,
Hristo Borisov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Cube
Asked by
Brett Gilbert
Top achievements
Rank 1
Answers by
Hristo Borisov
Telerik team
Brett Gilbert
Top achievements
Rank 1
Share this question
or