Wrapping text around an image or linking two TextBlocks in C# WPF

前端 未结 1 1506
抹茶落季
抹茶落季 2020-12-06 08:30

I am creating a program that shows text and an image in the same window. The Image is in the top-left corner of the screen and the Text will begin to the right of it, and th

1条回答
  •  青春惊慌失措
    2020-12-06 08:56

    I would not recommend using TextBlocks to achieve this type of layout. As Kieren suggests, a FlowDocument would be ideal for this type of a design. Take a look at this XAML snippet and the resulting WPF app screenshot using a FlowDocument with a Paragraph element and a Floater element containing an image:

    
        
                            
                
                    
                        
                             
                        
                    
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
                    Suspendisse et diam felis. Vestibulum ac nisl mi. 
                    Etiam varius velit lobortis nibh vestibulum nec consequat velit pellentesque. 
                    Cras commodo libero placerat nulla dapibus eget porttitor ligula tempor. 
                    Donec nisl massa, congue et pretium sit amet, feugiat vel est. 
                    Nulla dapibus metus in justo pulvinar sit amet viverra lorem rhoncus. 
                    Integer placerat interdum massa et mattis.
            
        
    
    

    alt text

    0 讨论(0)
提交回复
热议问题