ContentControl.HasContent Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that indicates whether the ContentControl contains content.
public:
property bool HasContent { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool HasContent { get; }
[<System.ComponentModel.Browsable(false)>]
member this.HasContent : bool
Public ReadOnly Property HasContent As Boolean
Property Value
true
if the ContentControl has content; otherwise false
. The default value is false
.
- Attributes
Examples
The following example shows how to use the HasContent property to determine whether a content control contains content.
void OnClick(object sender, RoutedEventArgs e)
{
if (contCtrl.HasContent == true)
{
MessageBox.Show("contCtrl has content");
}
}
Private Sub OnClick(ByVal Sender As Object, ByVal e As RoutedEventArgs)
If (contCtrl.HasContent = True) Then
MessageBox.Show("contCtrl has content")
End If
End Sub
Remarks
If the Content property is null
, this property returns false
.
Dependency Property Information
Identifier field | HasContentProperty |
Metadata properties set to true |
None |
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET