Multi-line tool tip in wpf using c #

I want to use a multiple line tooltip in wpf but it looks like

line 1 
    line2

      

but I want to display this prompt on the command line in the given format

line 1
line 2

      

+3


source to share


3 answers


I personally prefer to insert 


(newline) into lines that I will use as hints.

ex. Tooltip="line 1 
line 2"



I can then load the strings from the resource files and use them conveniently if I don't want them to go through any additional formatting.

+5


source


Here's how to do it using Label as an example:



<Label>
    <Label.ToolTip>
        <StackPanel>
             <TextBlock>Line 1</TextBlock>
             <TextBlock>Line 2</TextBlock>
        </StackPanel>
    </Label.ToolTip>
</Label>

      

+4


source


This worked for me and I don't see anything like this in the answers:

<[ParentControl].ToolTip>
    <TextBlock>
        Some text here.
        <LineBreak/>    
        And more text in a new line.
    </TextBlock>
</[ParentControl].ToolTip>

      

+3


source







All Articles