내보내기(0) 인쇄
모두 확장

ContentControl 클래스

Represents a control with a single piece of content.

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

[LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)] 
[ContentPropertyAttribute("Content")] 
public class ContentControl : Control, IAddChild
/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) */ 
/** @attribute ContentPropertyAttribute("Content") */ 
public class ContentControl extends Control implements IAddChild
LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) 
ContentPropertyAttribute("Content") 
public class ContentControl extends Control implements IAddChild
<ContentControl>
  Content
</ContentControl>

A ContentControl has a limited default style. If you want to enhance the appearance of the control, you can create a new control template. For more information, see Data Templating Overview. Another typical scenario is to use the ContentControl to show more information about an item selected in an ItemsControl control. For more information, see How to: Bind to a Collection and Display Information Based on Selection.

Content Model: ContentControl is the class from which other content controls inherit. For more information on the content model for ContentControl, see ContentControl Content Model.

The following example shows how to make a style for a ContentControl so that the control has an enhanced visual appearance.

<Style x:Key="ContentCtrl" TargetType="{x:Type ContentControl}">
      <Setter Property="Foreground" Value="Green"/>
      <Setter Property="FontSize" Value="20"/>
      <Setter Property="FontWeight" Value="Bold"/>
      <Setter Property="Template">
          <Setter.Value>
               <ControlTemplate TargetType="{x:Type ContentControl}">
                    <ContentControl ContentControl.Content="Hello"/>      
               </ControlTemplate>
          </Setter.Value>
      </Setter>   
</Style>

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
                 파생 클래스

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

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

.NET Framework

3.0에서 지원

커뮤니티 추가 항목

추가
표시:
© 2015 Microsoft