C#, WPF. Length of string that will fit in a specific width.
        Posted  
        
            by 
                Ian
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ian
        
        
        
        Published on 2010-12-27T23:50:42Z
        Indexed on 
            2010/12/27
            23:54 UTC
        
        
        Read the original article
        Hit count: 417
        
wpf
|wpf-controls
Hi,
I'm sure I'm missing something obvious, I have an area in which I intend to draw text. I know its (the area) height and width. I wish to know how many characters/Words will fit in the width, characters preferably. Second question, If the line is too long I'll want to draw a second line, so I guess I need to get the height of the text as well, including what ever it considers the right vertical padding?
I'd also rather like to know the inverse, i.e. how many characters I can fit in a specific width.
I assume the fact that WPF isn't constrained to pixels will have some bearing on the answer?
Ultimately I'm planning on wrapping text around irregular shaped images embedded in the text.
Any pointers in the right direction would be great.
Thanks
© Stack Overflow or respective owner