It's a good idea in principal - but if it were me I wouldn't let my model 
anywhere near my UI on all but the smallest projects. More often than not it 
causes heartache down the track...

From: OzSilverlight@ozsilverlight.com [mailto:ozsilverli...@ozsilverlight.com] 
On Behalf Of Stephen Price
Sent: Tuesday, 19 May 2009 5:09 PM
To: OzSilverlight@ozsilverlight.com
Subject: Re: Silverlight Binding Expressions

I read a blog post not so long ago that showed an example of this but rather 
than modifying the Data class being bound to, they uses a partial class 
(effectively adding an additional property to the Dataclass in its own file). 
This enabled them to bind to the new property without having to have access to 
the data class (ie if the data class was part of the generated proxy)

Not actually tried it and not sure where that blog post is... will check my 
Del.icio.us<http://Del.icio.us> links and see if I bookmarked it.

cheers,
Stephen
On Tue, May 19, 2009 at 8:42 AM, Ross Jempson 
<ross.jemp...@michaelhill.com.au<mailto:ross.jemp...@michaelhill.com.au>> wrote:

Assuming the binding is one-way, and you 'own' the model to which you are 
binding, can't you extend it and create a derived property there?



Lets say you were binding to a Person class



public string  Firstname { get; set; }

public string LastName { get; set; }



        public string FullName

        {

            get { return Firstname + " " + LastName; }

            set { }

        }







<Textblock Text="{Binding FullName



From: Asheesh Soni [mailto:asheeshs...@gmail.com<mailto:asheeshs...@gmail.com>]
Sent: Tuesday, 19 May 2009 10:37 AM
To: OzSilverlight@ozsilverlight.com<mailto:OzSilverlight@ozsilverlight.com>
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: 
ozsilverlight@ozsilverlight.com<mailto:ozsilverlight@ozsilverlight.com>
Subscribe: 
ozsilverlight-subscr...@ozsilverlight.com<mailto:ozsilverlight-subscr...@ozsilverlight.com>
Unsubscribe: 
ozsilverlight-unsubscr...@ozsilverlight.com<mailto:ozsilverlight-unsubscr...@ozsilverlight.com>
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
________________________________
Support procedure: https://www.codify.com/lists/support
List address: 
ozsilverlight@ozsilverlight.com<mailto:ozsilverlight@ozsilverlight.com>
Subscribe: 
ozsilverlight-subscr...@ozsilverlight.com<mailto:ozsilverlight-subscr...@ozsilverlight.com>
Unsubscribe: 
ozsilverlight-unsubscr...@ozsilverlight.com<mailto:ozsilverlight-unsubscr...@ozsilverlight.com>
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: 
ozsilverlight@ozsilverlight.com<mailto:ozsilverlight@ozsilverlight.com>
Subscribe: 
ozsilverlight-subscr...@ozsilverlight.com<mailto:ozsilverlight-subscr...@ozsilverlight.com>
Unsubscribe: 
ozsilverlight-unsubscr...@ozsilverlight.com<mailto:ozsilverlight-unsubscr...@ozsilverlight.com>
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.329 / Virus Database: 270.12.32/2118 - Release Date: 05/16/09 
17:05:00
--------------------------------------------------------------------------------
Support procedure: https://www.codify.com/lists/support
List address: ozsilverlight@ozsilverlight.com
Subscribe: ozsilverlight-subscr...@ozsilverlight.com
Unsubscribe: ozsilverlight-unsubscr...@ozsilverlight.com
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists

Reply via email to