When a render object is created, the data binding for it is not created initially. It is created when the DataBinding property is referenced in user code. For example:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim rt As RenderText = New RenderText ' ... If Not (rt.DataBinding Is Nothing) Then MessageBox.Show("Data binding defined.") End If |
To write code in C#
C# |
Copy Code
|
---|---|
RenderText rt = new RenderText(); // ... if (rt.DataBinding != null) { MessageBox.Show("Data binding defined."); } |
The condition in the previous code will always evaluate to True. Thus if you only want to check whether data binding exists on a particular render object, you should use the DataBindingDefined property instead:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim rt As RenderText = New RenderText ' ... If rt.DataBindingDefined Then MessageBox.Show("Data binding defined.") End If |
To write code in C#
C# |
Copy Code
|
---|---|
RenderText rt = new RenderText(); // ... if (rt.DataBindingDefined) { MessageBox.Show("Data binding defined."); } |
During document generation the RenderObjectsList collection is formed. Three different situations are possible as a result: