I have a long text and show first sentence in a TextBlock. I wish by clicking the TextBlock or a button to show a panel below the TextBlock with full text. I wish this panel be absolutely positioned and be displayed above any other elements, you can do a similar thing in HTML showing and hiding absolutely positioned 'div' element. How to do this in WPF? Thank you for any suggestions.
A:
Put the long text in an AdornerLayer is the best option. Check out some links http://msdn.microsoft.com/en-us/library/ms743737.aspx http://wangmo.wordpress.com/2008/10/19/relations-between-adorner-adornerlayer-and-adornerdecorator/
Jobi Joy
2009-03-02 16:00:25
A:
AdornerLayer
can work, but may be a little complex. Other options include using PopUps
or ToolTips
-- you should look into those first as your easiest options.
If these all don't work, it'll really depends on what kind of panel you're using. For example, if you're using a Canvas
, all you have to do is make sure to set the correct ZIndex
on the element.
In order to make this more robust, I'd suggest the following:
<!-- Set Panel.ZIndex="99" when showing hidden area to ensure top placement -->
<Grid>
<TextBlock>This is my primary bit of text ...</TextBlock>
<!-- Canvas stays hidden until we want to show the rest of the text -->
<Canvas Visibility="Hidden">
<TextBlock Canvas.Bottom="-10">Content goes here</TextBlock>
</Canvas>
</Grid>
Fortes
2009-03-05 14:03:28