I’m trying to create a simple textblock control and I’m trying to insert a property from my ViewModel in the middle of the string.
E.G. “Hello, My name is XX, bla, bla.”
(XX is a property from my ViewModel)
<TextBlock Text="Hello, My name is {Binding SelectedUser.Name}, bla, bla." />
Is that possible?
Regards,
Adrian
Similar feature has been added to WPF with .NET 3.5 sp1,
but not to Slverlight
See Link: WPF 3.5 SP1 Feature: String Format
WPF Example:
As far as Silverlight is concerned, you are stuck to either creating another property in your view model that does the concatenation for you, or creating an IValueConverter