Binding Convention Related Problem

Topics: Conventions
May 22, 2012 at 11:32 AM

Hi all....     

    I am a beginner to this new framework. I am facing a simple problem as described below.

I have a property named EmpName in the ViewModel. Accordint to the naming convention to bind it with a TextBlock, I have to assign the Name property with EmpName. Just like...

<TextBlock Name="EmpName "/>

Suppose i want to bind the same property "EmpName" with more than one TextBlock. If i shall do it in the previous way, then it cannot be possible because we cannot instantiate more than one TextBlocks with same name. So how to resolve this problem? :(

Please do suggest. Waiting for your reply.............:)

May 22, 2012 at 12:26 PM

Convention is a 1-on-1 mechanism, if you need the same property to be bound to more than one control, simply use a Binding directly, as you would without using CM.

Conventions are a shortcut, but you can always use the standard XAML syntax.

May 22, 2012 at 12:35 PM

Actually I thought like there may be some different approach to do through Convention. Ok now i got the solution. Thanks.........:)