이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

Expander 클래스

Represents the control that displays a header that has a collapsible window that displays content.

네임스페이스: System.Windows.Controls
어셈블리: PresentationFramework(presentationframework.dll)
XML 네임스페이스:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)] 
public class Expander : HeaderedContentControl
/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) */ 
public class Expander extends HeaderedContentControl
LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) 
public class Expander extends HeaderedContentControl
<Expander>
  Content
</Expander>

Content Model: Expander is a HeaderedContentControl and has two content properties: Header and Content. For information about how to set these properties, see Headered Content Control Content Model.

The following illustration shows an Expander control.

Expander example

If the content of the expanded window is too large for the window, you can wrap the content of the Expander in a ScrollViewer control to provide scrollable content. Scrolling capability is not automatically provided by the Expander control.

For an Expander to work correctly, do not specify a Height on the Expander control when the ExpandDirection property is set to Down or Up. Similarly, do not specify a Width on the Expander control when the ExpandDirection property is set to Left or Right. When you set a size on the Expander control in the direction that the expanded content is displayed, the area that is defined by the size parameter is displayed with a border around it. This area displays even when the window is collapsed. To set the size of the expanded window, set size dimensions on the content of the Expander control or the ScrollViewer that encloses the content.

When an Expander control is the last element in a DockPanel, the Expander is sized to fill the remaining area of the DockPanel. To prevent this, set the LastChildFill property on the DockPanel to false, or make sure that the Expander is not the last element in a DockPanel.

The alignment of Expander content can be defined by setting the HorizontalContentAlignment and VerticalContentAlignment properties on the control. These properties are applied to the header and to the contents of the expanded window.

The following example shows how to create a simple Expander control.

<Expander Name="myExpander" Background="Tan" 
          HorizontalAlignment="Left" Header="My Expander" 
          ExpandDirection="Down" IsExpanded="True" Width="100">
  <TextBlock TextWrapping="Wrap">
    Lorem ipsum dolor sit amet, consectetur
    adipisicing elit, sed do eiusmod tempor incididunt ut
    labore et dolore magna aliqua
  </TextBlock>
</Expander>

추가 코드

How to: Create an Expander

This example shows how to create an Expander control. An Expander control enables users to view a header that expands to display more content or collapses to save space.

How to: Create an Expander with a ScrollViewer

This example shows how to create an Expander control that contains complex content, such as an image and text. The example also encloses the content of the Expander in a ScrollViewer control.

How to: Create a Control That Has an Access Key and Text Wrapping

This example shows how to create a control that has an access key and supports text wrapping. The example uses a Label control to illustrate these concepts.

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.Media.Visual
         System.Windows.UIElement
           System.Windows.FrameworkElement
             System.Windows.Controls.Control
               System.Windows.Controls.ContentControl
                 System.Windows.Controls.HeaderedContentControl
                  System.Windows.Controls.Expander
이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

Microsoft .NET Framework 3.0은 Windows Vista, Microsoft Windows XP SP2 및 Windows Server 2003 SP1에서 지원됩니다.

.NET Framework

3.0에서 지원
이 정보가 도움이 되었습니까?
(1500자 남음)

커뮤니티 추가 항목

추가
© 2013 Microsoft. All rights reserved.