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

Expand Collapse containing window

2 Answers 119 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Xaria D
Top achievements
Rank 1
Xaria D asked on 10 Aug 2010, 07:31 AM
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 Answers, 1 is accepted

Sort by
0
Xaria D
Top achievements
Rank 1
answered on 11 Aug 2010, 03:55 AM
Bump.
0
Miroslav
Telerik team
answered on 13 Aug 2010, 08:02 AM
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
Tags
Expander
Asked by
Xaria D
Top achievements
Rank 1
Answers by
Xaria D
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or