Vertical orientation of Header Text

3 posts, 1 answers
  1. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 03 Feb 2013 Link to this post

    Hi,

    using Sample http://demos.telerik.com/silverlight/#Expander/FirstLook
    If you choose left or right as expand direction the Header text of the expander is orientated in a vertical way.

    How can I do the same?

    The sample coding just use:

    <telerik:RadExpander.Header>
        <TextBlock x:Name="expanderCaption" Text="Header" />
    </telerik:RadExpander.Header>

    Thanks

    Stefan
  2. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 06 Feb 2013 Link to this post

    Hi,

    If you take a closer look at the demonstration project and open the Example.xaml.cs file you will find the following code:

    private void OnDirectionsClick(object sender, RoutedEventArgs e)
    {
        System.Windows.Controls.RadioButton radioButton = e.OriginalSource as System.Windows.Controls.RadioButton;
        if(radioButton != null)
        {
            Telerik.Windows.Controls.ExpandDirection expandDirection = (Telerik.Windows.Controls.ExpandDirection)System.Enum.Parse(typeof(Telerik.Windows.Controls.ExpandDirection), radioButton.Content.ToString(), true);
            this.radExpander.ExpandDirection = expandDirection;
     
            switch (expandDirection)
            {
                case Telerik.Windows.Controls.ExpandDirection.Down:
                    this.radExpander.VerticalContentAlignment = System.Windows.VerticalAlignment.Top;
                    this.radExpander.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    break;
                case Telerik.Windows.Controls.ExpandDirection.Left:
                    this.radExpander.VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;
                    this.radExpander.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                    break;
                case Telerik.Windows.Controls.ExpandDirection.Right:
                    this.radExpander.VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;
                    this.radExpander.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    break;
                case Telerik.Windows.Controls.ExpandDirection.Up:
                    this.radExpander.VerticalContentAlignment = System.Windows.VerticalAlignment.Bottom;
                    this.radExpander.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    break;
                default:
                    break;
            }
        }
    }

    This is the implementation of the Click event handler of all radio buttons in the ConfigurationPanel. And this code is used to rotate the header. Basically we set the ExpandDirection property of the RadExpander control and the control internally handles the rotation of the header.

    Kind regards,
    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. schneeflocke
    schneeflocke avatar
    31 posts
    Member since:
    Jan 2010

    Posted 06 Feb 2013 Link to this post

    Thanks for your help. I missed the yellow marked line of code.

    Thanks

    Stefan
Back to Top