0

I have created 3 Expanders in 3 different User Controls,and these User Controls is invoked from a Master User Control from within an Expander. How can I enable Expand/Collapse i.e.,when one Expander is expanded others should be collapsed. Initially when the App comes up, First Expander should be expanded and others should be collapsed.

Thanks in advance!

<UserControl x:Class="WpfUserControlLibrary.MasterTaskControl"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:myUserDisplayControl="clr-namespace:WpfUserControlLibrary"
         mc:Ignorable="d" 
         d:DesignHeight="941" d:DesignWidth="1213">
 <DockPanel Name="MasterDockPanel" Grid.Row="1" Grid.Column="0" Height="Auto">

       <Expander
            x:Name="Expander1"
            ExpandDirection="Left"
            DockPanel.Dock="Left"
            IsExpanded="True"
            >

        <Grid Background="DarkSlateBlue" Height="Auto">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

            <Label Content="BasicImagingControlArea"
                   Grid.Row="0"
                   Name="BasicImagingLabel"
                   FontWeight="Bold"/>
            <myUserDisplayControl:DisplayControl Grid.Row="1" Visibility="Visible" x:Name="DisplayControl"/>
            <myUserDisplayControl:ExamControl Grid.Row="2" Visibility="Visible" x:Name="ExamControl"/>
            <myUserDisplayControl:Visualization Grid.Row="3" Visibility="Visible" x:Name="Visualization"/>
        </Grid>
        </Expander>
    </DockPanel>

</UserControl>

Display Control,ExamControl,Visualization are the 3 User Controls that has the respective Expanders.

I have included the main parts of the xaml.Please reply with an answer asap

Maria
  • 77
  • 5
  • 13
  • 3
    Please post some XAML code to present exact scenario of your implementation. – Nitesh Aug 01 '13 at 13:58
  • There is a collapsed event. – paparazzo Aug 01 '13 at 14:04
  • As Blam pointed out: there is a collapsed event when an expander, well, collapses. You can then command the other expanders to collapse. – oddparity Aug 01 '13 at 14:45
  • Yes,the Expander has a Collapse Event.But it cannot access Expanders of other User Controls – Maria Aug 02 '13 at 02:55
  • Possible duplicate of [Multiple Expander have to collapse if ONE is expanded](http://stackoverflow.com/questions/4449000/multiple-expander-have-to-collapse-if-one-is-expanded) – Dzyann Oct 07 '15 at 15:16

0 Answers0