The only way I know of is to use two text boxes or a converter.

Regards,
Philip Beadle
Readify | Principal Consultant
Microsoft MVP - ASP/ASP.NET, MCAD, MCT
Suite 408 LifeLabs Building | 198 Harbour Esplanade | Docklands | VIC 3008 | 
Australia
M: +61 417 301 024 | E: 
[email protected]<mailto:[email protected]> | C: 
[email protected]<sip:[email protected]> | W: 
www.readify.net<http://www.readify.net/>
[cid:[email protected]]<http://readify.net/about-readify/press/readify-makes-2008-mis-strategic-100-list/>

From: [email protected] [mailto:[email protected]] 
On Behalf Of Asheesh Soni
Sent: Tuesday, 19 May 2009 10:37 AM
To: [email protected]
Subject: Silverlight Binding Expressions

Hello

I have a very trivial problem, but all the solutions to it seem to be a bit of 
an overkill. Just looking for a simple solution....

So here's the problem: Bind a Textblock to more than one field.... (or a string 
and a field)

For example: <Textblock Text="{Binding FirstName + " " + LastName}" />
Or, <Textblock Text="{Binding "You are logged in as:" + {LoginName}}" />

I know the following solutions already:

1. Have two Textblocks with clean and simple bindings.
2. Use a Converter (with ConvertBack for two way binding).
3. Use Xambda (Yeah, I mean a Generic Lambda Converter used in Xaml with a 
Lambda expression)

References for Xambda:
http://www.fikrimvarnet/lestirelim/?p=15<http://www.fikrimvar.net/lestirelim/?p=15>
http://marlongrech.wordpress.com/2008/02/10/embed-code-in-xaml/

And I know advocates of Designer/Developer work flow will argue that embedding 
complex expressions in Xaml defeats the whole purpose and leads to the bad (or 
good) old days of spaghetti code. But I guess, having trivial code in Xaml (eg 
{FirstName} + {LastName}) shouldn't really be a problem.

Basically, All I need is a built-in, in-line Converter for one-way binding in 
Xaml, without having to create my own one line Converters for such trivial 
transformations.

Any ideas?


Thanks

Soni
________________________________
Support procedure: https://www.codify.com/lists/support
List address: 
[email protected]<mailto:[email protected]>
Subscribe: 
[email protected]<mailto:[email protected]>
Unsubscribe: 
[email protected]<mailto:[email protected]>
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists
--------------------------------------------------------------------------------
Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists

<<inline: image001.jpg>>

Reply via email to