locked
Wrapping Text in a ContentPresenter RRS feed

  • Question

  • I have a ControlTemplate that contains a ContentPresenter. My Content is text, and I want to control whether or not that text wraps. It seems that right now it is not wrapping, but I want it to wrap, and I cannot find any properties in the ContentPresenter than allow you to specify this. How can I wrap the text using a ContentPresenter? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Sunday, November 17, 2013 5:09 PM

Answers

  • Hi,Nathan

    You can define a ContentTemplate in a ContentPresenter:

    <ContentPresenter VerticalAlignment="Center"
     
                           x:Name="Presenter">
     
                                <ContentPresenter.ContentTemplate>
     
                                    <DataTemplate>
     
                                        <TextBlock Text="{TemplateBinding Content}" TextWrapping="Wrap" />
     
                                    </DataTemplate>
     
                                </ContentPresenter.ContentTemplate>
     
                            </ContentPresenter>
     
    
    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 18, 2013 6:44 AM