Is there a way to recover the area that was being used by the expander when the expander is collapsed? I have the event captured and I have the contents set to Collapsed but the space is still left on the screen rather than yielding it to the other row in the grid.
<Window x:Class="WpfApplication1.Window1" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
Title="Test" Height="350" Width="250" Background="Beige"> |
<Grid> |
<Grid.RowDefinitions> |
<RowDefinition Height="Auto" /> |
<RowDefinition Height="Auto" /> |
</Grid.RowDefinitions> |
<Image Grid.Row="0" |
Name="imageBackground" |
HorizontalAlignment="Left" |
VerticalAlignment="Top" |
Source="/WpfApplication1;component/Images/master.png" |
Stretch="Uniform" MaxHeight="250" /> |
<telerik:RadExpander x:Name="radExpander" |
Grid.Row="1" |
IsExpanded="True" |
telerik:StyleManager.Theme="Vista" |
VerticalAlignment="Stretch" HorizontalAlignment="Stretch" |
Collapsed="radExpander_Collapsed" Expanded="radExpander_Expanded"> |
<telerik:RadExpander.Header> |
<TextBlock x:Name="expanderCaption" Foreground="#FFFFFFFF" Text="Test Box" |
Visibility="Visible" /> |
</telerik:RadExpander.Header> |
<telerik:RadExpander.Content> |
<WrapPanel x:Name="imageContainer" Orientation="Horizontal"> |
<Image Margin="12" Width="200" Height="64" Stretch="Uniform" Source="/WpfApplication1;component/Images/test.png" /> |
<Image Margin="12" Width="200" Height="64" Stretch="Uniform" Source="/WpfApplication1;component/Images/test.png" /> |
</WrapPanel> |
</telerik:RadExpander.Content> |
</telerik:RadExpander> |
</Grid> |
</Window> |
code:
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Text; |
using System.Windows; |
using System.Windows.Controls; |
using System.Windows.Data; |
using System.Windows.Documents; |
using System.Windows.Input; |
using System.Windows.Media; |
using System.Windows.Media.Imaging; |
using System.Windows.Navigation; |
using System.Windows.Shapes; |
namespace WpfApplication1 |
{ |
/// <summary> |
/// Interaction logic for Window1.xaml |
/// </summary> |
public partial class Window1 : Window |
{ |
public Window1() |
{ |
InitializeComponent(); |
} |
private void radExpander_Collapsed(object sender, RoutedEventArgs e) |
{ |
if (imageContainer != null) |
imageContainer.Visibility = Visibility.Collapsed; |
} |
private void radExpander_Expanded(object sender, RoutedEventArgs e) |
{ |
if (imageContainer != null) |
imageContainer.Visibility = Visibility.Visible; |
} |
} |
} |