views:

173

answers:

0

I have a DataForm in Silverlight.

I have a single <DataForm.EditTemplate> defined for this control.

I want to bind to the Mode (Edit/ReadOnly/AddNew) from within the template (I have a convertor to show or hide things depending upon the mode).

Element binding doesn't work from within the EditTemplate but couldn't get RelativeSource to work either.

Tried these and they don't work

<TextBlock Foreground="Red" Text="{Binding ElementName=dfMyDataForm,Path=Mode,Mode=TwoWay,FallbackValue='DIDNT WORK'}" />

<TextBlock Foreground="Red" Text="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Mode,Mode=TwoWay,FallbackValue='DIDNT WORK'}" />

Is there a way to bind to the Mode of the parent DataForm from within its EditTemplate - or do I have to completely duplicate the template and make my changes there.