Expand Collapse containing window

3 posts, 0 answers
  1. Xaria D
    Xaria D avatar
    68 posts
    Member since:
    May 2010

    Posted 10 Aug 2010 Link to this post

    I have a Rad Expander inside a RadPane.
    I wish to expand or resize the width of the pane when the expander is expanded and likewise, reduce the width when expander is collapsed.
    How to get the desired behavior?
  2. Xaria D
    Xaria D avatar
    68 posts
    Member since:
    May 2010

    Posted 10 Aug 2010 Link to this post

    Bump.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 13 Aug 2010 Link to this post

    Hi Xaria D,

    Is it a floating / undocked pane?

    Then you can use this code:

    static MainWindow()
    {
        EventManager.RegisterClassHandler(typeof(RadPane), 
            RadExpander.CollapsedEvent, new RoutedEventHandler(OnExpanderToggled));
        EventManager.RegisterClassHandler(typeof(RadPane), 
            RadExpander.ExpandedEvent, new RoutedEventHandler(OnExpanderToggled));
    }
      
    private static void OnExpanderToggled(object sender, RoutedEventArgs e)
    {
        var pane = sender as RadPane;
        var window = pane.GetVisualParent<ToolWindow>();
      
        if (window != null
            && (pane.IsFloating || pane.IsFloatingOnly))
        {
            window.ClearValue(Control.HeightProperty);
        }
    }

    Whenever an expander in the content is toggled, the height would size to the desired size of the content.

    Regards,
    Miroslav
    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
Back to Top