Gets the
AnnContainer that contains this
AnnObjectBase.
This is a dependency property.
Syntax
Visual Basic (Declaration) | |
---|
Public ReadOnly Property Container As AnnContainer |
XAML Syntax | |
---|
You cannot set this property in XAML. |
XAML Syntax | |
---|
You cannot set this property in XAML. |
Return Value
The
AnnContainer that contains this
AnnObjectBase.
Example
This example creates two containers, adds an object to the first container then moves it to the second while checking the Container property of the object.
Visual Basic | Copy Code |
---|
Public Sub AnnObject_Container()
Dim firstContainer As AnnContainer = New AnnContainer()
firstContainer.Name = "FirstContainer"
Dim secondContainer As AnnContainer = New AnnContainer()
secondContainer.Name = "SecondContainer"
Dim line As AnnLineObject = New AnnLineObject()
line.Header = "Line1"
firstContainer.Children.Add(line)
Dim s As String = String.Format("Container: {0}", line.Container.Name)
MessageBox.Show(s)
firstContainer.Children.Remove(line)
secondContainer.Children.Add(line)
s = String.Format("Container: {0}", line.Container.Name)
MessageBox.Show(s)
End Sub |
C# | Copy Code |
---|
public void AnnObject_Container() { // create 2 containers AnnContainer firstContainer = new AnnContainer(); firstContainer.Name = "FirstContainer"; AnnContainer secondContainer = new AnnContainer(); secondContainer.Name = "SecondContainer"; // add an object to the first container AnnLineObject line = new AnnLineObject(); line.Header = "Line1"; // add the object to the first container firstContainer.Children.Add(line); string s = string.Format("Container: {0}", line.Container.Name); MessageBox.Show(s); // move the object to the second container firstContainer.Children.Remove(line); secondContainer.Children.Add(line); s = string.Format("Container: {0}", line.Container.Name); MessageBox.Show(s); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family
See Also