By the provided description I guess you're using the WPF Report Viewer. This viewer shows a XAML markup, provided by the reporting engine during the report rendering. In order to follow the internal report structure, the markup elements are not created the same way as they would in an ordinary WPF designer. For example, the TextBox report item is represented by a TextBlock and a Border element, which are siblings. The Border element has the same position and size as the TextBlock, but it may have a different size, depending on TextBox text alignment and associated action. We decided to build the markup this way because it's more efficient to use a TextBlock for the text content and then add a new Border element on the background on foreground for the additional features - borders, action, color, etc. I hope the explanation make sense and answers to your question why the Border doesn't actually have a child representing the text content.
In the current scenario I can suggest two approaches:
1) use a semi-transparent color as a Border's background, which will allow to see the text in the TextBlock underneath.
2) Get the actual TextBlock element by obtaining the previous sibling from the Border's parent with the following example code:
TextBlock GetTextBlock(Border b)
var parent = b.GetVisualParent<Canvas>();
var borderIndex = parent.Children.IndexOf(b);
borderIndex == 0 ?
: parent.Children[borderIndex - 1]
Once you've obtained the TextBlock, its background can be changed as needed. Please note that the size of the TextBlock and the size of the Border may differ, depending on the vertical alignment used in reporting TextBox.
Please take a look at this KB article
that elaborates on the same subject, but provides more details on graphics paths and a tooltips. And finally, please have in mind that the produced markup is not intended to be modified on the client and may be changed in a future release of our product.
If you have further questions, please let us know.
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items