Cube with 6 similar sides programmatically

7 posts, 0 answers
  1. pratik mehta
    pratik mehta avatar
    17 posts
    Member since:
    May 2010

    Posted 17 Jun 2010 Link to this post

    Hello,

        I need to create a cube with 6 faces each having the same look and feel. For example, if I have a Grid with a RadGridView and RadChart on one face, I want to have the same displayed on other faces as well when rotating. My business logic will take care of modifying the faces as per requirement, but as such my UI is same across all faces.

    From a designing point of view, its not ideal to develop 6 sections (copy-pasted) in the Xaml. Is there a way I can have only section (for one face) designed in the xaml and programmatically render on the other 5 faces with rotation.

    Awaiting a quick reply,
    Vish
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 22 Jun 2010 Link to this post

    Hi pratik mehta,

    The only way to achieve the desired functionality in the RadCube for now is to use a UserControl defining the content of each side of the cube. For example, you can define a UserControl containing a Grid with a RadGridView and a RadChart. However, in the RadCube definition you will need to apply the same user control for each side:
    <telerikNavigation:RadCube x:Name="myCube"
            IsRotateOnClickEnabled="True"
            SelectedIndex="0"
        RotateSpeed="1" IsRotateOnStart="False"
        XWidth="200" YWidth="200" ZWidth="200"
        HorizontalAlignment="Center" VerticalAlignment="Center" >
       <local:MyUserControl/>
       <local:MyUserControl/>
       <local:MyUserControl/>
       <local:MyUserControl/>
       <local:MyUserControl/>
       <local:MyUserControl/>
    </telerikNavigation:RadCube>

    I attached a sample project illustrating this approach. Please take a look at it and let me know if it works for you.

    Greetings,
    Tina Stancheva
    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. Nick
    Nick avatar
    21 posts
    Member since:
    Sep 2007

    Posted 12 Jul 2010 Link to this post

    is there any way to use RADCUBE using VB.Net or C# and not in XAML? Is there sample available?
    Also can I use RadCube in WPF?
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 15 Jul 2010 Link to this post

    Hello Nick,

    Silverlight is a language independent platform so you can develop both on VB and C#. I've prepared a small project demonstrating how to create a cube programatically.
    As for your other question, we do not have RadCube for WPF.

    Greetings,
    Kiril Stanoev
    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. Nick
    Nick avatar
    21 posts
    Member since:
    Sep 2007

    Posted 15 Jul 2010 Link to this post

    Thank you very much. Any possibilty of cube including in WPF?
  7. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 19 Jul 2010 Link to this post

    Hello Nick,

    For the moment we don't have such plans.

    Greetings,
    Valentin.Stoychev
    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
  8. Vijay
    Vijay avatar
    29 posts
    Member since:
    Nov 2011

    Posted 02 Jun 2012 Link to this post

    Hello Vish

        Please find the below source code, try to append any controls onto the each face of RadCube as per the requirements. Then define any customization that you want to programmatically code for each unique face using appropriate UI designing.

    <UserControl x:Class="RadCubeApplication.MainPage"
     mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
     <Grid x:Name="LayoutRoot" Width="626">
     
    <TextBlock Grid.Row="1"
     Height="23"
     HorizontalAlignment="Left"
     Margin="72,61,0,0"
     Name="textBlock1"
     FontFamily="Verdana"
     FontSize="15"
     Text="Please Enter First Number: "
     VerticalAlignment="Top"
     Width="214" />
     
    <TextBox Grid.Row="1"
     Height="23"
     HorizontalAlignment="Left"
     Margin="320,60,0,0"
     Name="textBox1"
     VerticalAlignment="Top"
     Width="120" />
     
    <TextBlock Grid.Row="1"
     Height="23"
     HorizontalAlignment="Left"
     Margin="58,121,0,0"
     FontFamily="Verdana"
     FontSize="15"
     Name="textBlock2"
     Text="Please Enter Second Number: "
     VerticalAlignment="Top"
     Width="228" />
     
    <TextBox Grid.Row="1"
     Height="23"
     HorizontalAlignment="Left"
     Margin="320,120,0,0"
     Name="textBox2"
     VerticalAlignment="Top"
     Width="120" />
     
    <Button Content="Arthmetic Operation"
     Height="23"
     HorizontalAlignment="Left"
     Margin="320,180,0,0"
     Name="button1"
     VerticalAlignment="Top"
     Width="120"
     Background="DeepSkyBlue"
     Click="button1_Click"/>
     
    <telerik:RadCube XWidth="200"
     YWidth="200"
     ZWidth="200"
     Margin="339,360,301,120"
     IsRotateOnClickEnabled="True"
     HorizontalAlignment="Center"
     VerticalAlignment="Center"
     Name="radCube1"
     Side1Background="LightBlue"
     Side2Background="LightCoral"
     Side3Background="LightCyan"
     Side4Background="LightGray"
     Side5Background="LightGreen"
     Side6Background="LightGoldenrodYellow">
     
    <!--Addition Operation Cube Side-->
     <Grid>
     <Grid.RowDefinitions>
     <RowDefinition Height="Auto" />
     <RowDefinition Height="*" />
     <RowDefinition Height="Auto" />
     </Grid.RowDefinitions>
     <TextBlock FontFamily="Verdana"
     FontSize="12"
     HorizontalAlignment="Stretch"
     VerticalAlignment="Center"
     FontWeight="Bold"
     Name="textBlockAdd"
     Width="200"/>
     </Grid>
     <!--Subtraction Operation Cube Side-->
     <Grid>
     <Grid.RowDefinitions>
     <RowDefinition Height="Auto" />
     <RowDefinition Height="*" />
     <RowDefinition Height="Auto" />
     </Grid.RowDefinitions>
     <TextBlock FontFamily="Verdana"
     FontSize="12"
     HorizontalAlignment="Stretch"
     VerticalAlignment="Center"
     FontWeight="Bold"
     Name="textBlockSub"
     Width="200"/>
     </Grid>
     
    <!--Multiplication Operation Cube Side-->
     <Grid>
     <Grid.RowDefinitions>
     <RowDefinition Height="Auto" />
     <RowDefinition Height="*" />
     <RowDefinition Height="Auto" />
     </Grid.RowDefinitions>
     <TextBlock FontFamily="Verdana"
     FontSize="12"
     HorizontalAlignment="Stretch"
     VerticalAlignment="Center"
     FontWeight="Bold"
     Name="textBlockMul"
     Width="200"/>
     </Grid>
     
    <!--Division Operation Cube Side-->
     <Grid>
     <Grid.RowDefinitions>
     <RowDefinition Height="Auto" />
     <RowDefinition Height="*" />
     <RowDefinition Height="Auto" />
     </Grid.RowDefinitions>
     <TextBlock FontFamily="Verdana"
     FontSize="12"
     HorizontalAlignment="Stretch"
     VerticalAlignment="Center"
     FontWeight="Bold"
     Name="textBlockDiv"
     Width="200"/>
     </Grid>
     
    <!--Modulos Operation Cube Side-->
     <Grid>
     <Grid.RowDefinitions>
     <RowDefinition Height="Auto" />
     <RowDefinition Height="*" />
     <RowDefinition Height="Auto" />
     </Grid.RowDefinitions>
     <TextBlock FontFamily="Verdana"
     FontSize="12"
     HorizontalAlignment="Stretch"
     VerticalAlignment="Center"
     FontWeight="Bold"
     Name="textBlockMod"
     Width="200"/>
     </Grid>
     
    <!--Total Operation Cube Side-->
     <Grid>
     <Grid.RowDefinitions>
     <RowDefinition Height="Auto" />
     <RowDefinition Height="*" />
     <RowDefinition Height="Auto" />
     </Grid.RowDefinitions>
     <TextBlock FontFamily="Verdana"
     FontSize="12"
     HorizontalAlignment="Stretch"
     VerticalAlignment="Center"
     FontWeight="Bold"
     Name="textBlockTotal"
     Width="200"/>
     </Grid>
     
    </telerik:RadCube>
     </Grid>
    </UserControl>
    Hope this should be useful for startup. Thanks and Regards, Vijay
Back to Top
DevCraft banner