Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

ContentControl.Content Property

Gets or sets the content of a ContentControl. This is a dependency property.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(true)] 
public Object Content { get; set; }
/** @property */
public final Object get_Content ()

/** @property */
public final void set_Content (Object value)

public final function get Content () : Object

public final function set Content (value : Object)

<object> content</object>
 Content  Text or a single UIElement. 

Property Value

An object that contains the control's content. The default value is a null reference (Nothing in Visual Basic).

Identifier field

ContentProperty

Metadata properties set to true

None

Content Model: This property is used to set the content of controls that inherit from ContentControl. For more information, see the Content Control Content Model.

The following examples show how to add content to a Button using the Content property that button inherits.

void OnClick5(object sender, RoutedEventArgs e)
{
    btn6.FontSize = 16;
    btn6.Content = "This is my favorite photo.";
    btn6.Background = Brushes.Red;
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.