Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "float" image in XAML (Windows 8 Metro)

Is it possible to do in XAML something like ffloat:left for an image in CSS. I need to create something like this:

enter image description here

with variable image dimensions and text length.

Edit: The text warp around the image is not static in my case, it is create in C# code that returns a list of TextBlock elements (with Runs)

like image 865
Igor Kulman Avatar asked May 04 '12 08:05

Igor Kulman


Video Answer


2 Answers

With Silverlight 4 you would achieve this using a RichTextBox:

 <RichTextBox TextWrapping="Wrap"  IsReadOnly="False">  
   <Paragraph>  
        More text here .. 
        <InlineUIContainer>  
            <Image Source="abc.jpg"/>  
        </InlineUIContainer>   
        more and more text here;  
        <LineBreak />  
    </Paragraph>  
</RichTextBox> 

It looks like Win8 Metro has a RichTextBox, and also has an InlineUIContainer, so something like the above should work!

like image 137
ColinE Avatar answered Oct 03 '22 09:10

ColinE


The solution seems to be using RichTextBlockOverflow and OverflowContentTarget described in this presentation: http://video.ch9.ms/build/2011/slides/APP-914T_Street.pptx

like image 44
Igor Kulman Avatar answered Oct 03 '22 08:10

Igor Kulman