最終更新:2020-04-03 (金) 15:15:04 (1446d)
System.Windows.Controls.ContentControl
Top / System.Windows.Controls.ContentControl
任意の種類のコンテンツが 1 つあるコントロールを表します。
概要
- ContentControl には、任意の型の共通言語ランタイムオブジェクト (文字列、DateTime オブジェクトなど) または UIElement オブジェクト (Rectangle や Panelなど) を含めることができます。 これにより、Button や CheckBox?などのコントロールにリッチコンテンツを追加できます。
- 1つの子要素(Contentプロパティ)を持つ
- 子要素は文字列かUIElementオブジェクト
継承
- System.Object
- System.Windows.Threading.DispatcherObject
- System.Windows.DependencyObject
- System.Windows.Media.Visual
- System.Windows.UIElement
- System.Windows.FrameworkElement
- System.Windows.Controls.Control
派生クラス
- System.Activities.Presentation.WorkflowElementDialog?
- System.Activities.Presentation.WorkflowItemPresenter?
- System.Activities.Presentation.WorkflowItemsPresenter?
- System.Activities.Presentation.WorkflowViewElement?
- System.Activities.Presentation.View.ExpressionTextBox?
- System.Activities.Presentation.View.TypePresenter?
- System.Windows.Window
- System.Windows.Controls.DataGridCell?
- System.Windows.Controls.Frame
- System.Windows.Controls.GroupItem?
- System.Windows.Controls.HeaderedContentControl
- System.Windows.Controls.Expander
- System.Windows.Controls.GroupBox
- System.Windows.Controls.TabItem?
- System.Windows.Controls.Label
- System.Windows.Controls.ListBoxItem?
- System.Windows.Controls.ScrollViewer
- System.Windows.Controls.ToolTip?
- System.Windows.Controls.UserControl?
- System.Windows.Controls.Primitives.ButtonBase
- System.Windows.Controls.Primitives.StatusBarItem?
- System.Windows.Controls.Ribbon.RibbonControl?
- System.Windows.Controls.Ribbon.RibbonGalleryItem?
- System.Windows.Controls.Ribbon.RibbonTabHeader?
関連コントロール
- System.Windows.Controls.Button
- System.Windows.Controls.CheckBox
- System.Windows.Controls.RadioButton?
- System.Windows.Controls.Expander
- System.Windows.Controls.GroupBox
- System.Windows.Window
プロパティ
object ContentControl.Content ContentControl のコンテンツを取得または設定します。
コンテンツ
- UIElementクラスの場合、そのままUI要素として表示が行われる(OnRender?メソッドで描画を行う)
- そのほかのクラスの場合、データ・テンプレートが設定されていればテンプレートを使った表示が行われる(連載第5回を参照)
- データ・テンプレートも設定されていない場合、ToString?メソッドを使って文字列化された結果が表示される
メモ
- ContentControlクラスの派生クラスの中に複数のUI要素を並べたい場合、まず<Grid>要素などのパネルを置いて、その中にUI要素を並べる。
- WPF/パネル