tags:

views:

33

answers:

5

I need to display the image at start and end of the text in silverlight. For e.g. The text should be

" welcome to silverlight " . The code in this text should be image and it was coming from database

Any help please. Thanks in advance.

A: 

Have a StackPanel with 1 image, then a textbox, then another image

<StackPanel Height="100" HorizontalAlignment="Left" Margin="26,164,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="200">
    <Image Height="150" Name="image2" Source="Peter-Gfader-head.png"  Stretch="Fill" Width="200" />
    <TextBox Height="23" Name="textBox2" Text="{Binding MessageFromDataBase}" Width="120" />
    <Image Height="150" Name="image1" Source="Peter.png" Stretch="Fill" Width="200" />
</StackPanel>
Peter Gfader
A: 

Hi Peter,

Thanks for your answer. but the image was found to in fixed position. The end image should vary according to the length of the text.

ramesh
+1  A: 

One way to do this is to put a Textblock instead of your textbox{hoping here that you are not seeking user input}, set its TextWrapping property to Wrap.

Important to NOT assign any value to the height property of the textblock.

Sample code:

     <ScrollViewer VerticalScrollBarVisibility="Auto">
        <StackPanel HorizontalAlignment="Left" Name="stackPanel1" VerticalAlignment="Top" Width="200" Orientation="Vertical">
            <Image Height="150" Name="image2" Source="arrow.png" Stretch="Fill" Width="200" />
            <TextBlock Name="textBox2" Width="200" TextWrapping="Wrap" LineStackingStrategy="MaxHeight" Text="The trouble with a lot of software development today I think lies with an incomplete understanding of what Software Development really is, or what kind of work relates to it.  Most people in the general populace have very little understanding of software, and tend to concentrate on the layer they can see, which is understandable, the UI; while the UI is very important, most of the work lies beneath.  Managers of programmers meanwhile, tend to see them as engineers and some even take the title, Software Engineer.  In many cases this title is accurate: building mission critical applications that manage money, space shuttles, or medical equipment are very engineer-oriented work that require attention to detail and much left-brain thinking. However, a lot of Software Development can afford to be more “experimental,” like how GMail was notoriously in beta for years. Without that experimental nature, we wouldn’t have a lot of the great software we have today.

So if software development isn’t engineering, what is it? Science? Yes, partly. Science implies making a hypothesis and testing it. Every method that is tested could be considered a hypothesis. In most software projects there are teams of Testers who are confirming the hypothesis “the software works as intended” and there are reams of documentation about what “works as intended” means.  But when it comes to the UI (or Human-Computer-Interface), it is difficult to test and design becomes a mix of Art and Science. Testing is great, but without creativity, how would you ever devise your interface to begin with?

Since the beginning of software history, some User-Interface has existed and they have become progressively more beautiful and interactive over time. We’ve gone from the Lisa to the iPad. As the hardware has improved, so has our ability to create more complex interactive interfaces.  Art doesn’t stop at the UI either. Programmers are humans too, so I would argue that Art permeates every level of Software Development.  That’s why coders often say (or think) “this code is ugly”, “that language is beautiful.”

Some argue that all software developers should practice engineering, regardless of what happens today, but without Art and Science, software development would be lacking.  Would you say Frank Lloyd Wright only practiced engineering?"/>
            <Image Height="150" Name="image1" Source="arrow.png" Stretch="Fill" Width="200" />
        </StackPanel>
            </ScrollViewer>
</Grid>

I have used a scrollviewer so I can scroll to view the content.

Hope this helps you.

Abhi
A: 

Hi Abhi,

Thanks for your reply.

But what I exactly need is to display the image at end of the text in silverlight. For e.g

1.welcome to silverlight.

2.welcome to Microsoft silverlight ver 1.0 .

3.welcome to Microsoft silverlight ver 1.0 and the latest was 4.0 .

For img1, I can place it in fixed position but for img2,it should vary in position acc to text

Urgent Please.

Thanks

Ramesh
A: 

Hi Guys,

I am in need of a help in silverlight

what I exactly need is to display the image at end of the text in silverlight.

The text will comes from db and length will differ For e.g

1."img1" welcome to silverlight*."img2"*

2*."img1"* Welcome to Microsoft silverlight ver 1.0 ."img2"

3*."img1"* welcome to Microsoft silverlight ver 1.0 and the latest was 4.0 ."img2"

For img1, I can place it in fixed position but for img2,it should vary in position acc to text

Urgent Please.

Thanks

Ramesh