This is a migrated thread and some comments may be shown as answers.

ReadOnly DataFormDataField is editable

2 Answers 170 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Leos
Top achievements
Rank 1
Leos asked on 10 Apr 2011, 12:07 PM
Hello,

I have defined following easy DataTemplate, where ID is defined as ReadOnly, because value of this field is server-generated (identity field).
<telerik:DataFormDataField Label="Id:"
DataMemberBinding="{Binding Id,Mode=TwoWay}"
IsReadOnly="True"/>

This DataTemplate is defined for all Templates: ReadOnlyTemplate, EditTemplate and NewItemTemplate.

When Edit button is pressed, ID is editable. This is probably bug.

Workaround exists, using TextBlock in explicit Content:
<telerik:DataFormDataField Label="Id:" DataMemberBinding="{Binding Id,Mode=TwoWay}" IsReadOnly="True">
  <telerik:DataFormDataField.Content>
  <TextBlock Text="{Binding Id, Mode=TwoWay}"/>
  </telerik:DataFormDataField.Content>
</telerik:DataFormDataField>

But this workaround has problem with other bug, where Id is not displayed:
http://www.telerik.com/community/forums/silverlight/data-form/data-template.aspx

Leos

2 Answers, 1 is accepted

Sort by
0
HDC
Top achievements
Rank 1
answered on 10 Apr 2011, 12:18 PM
Hi Leos,

I know it's not quite the same, but i use this:

<telerik:DataFormDataField Grid.Column="1" Grid.Row="0">
<TextBox Text="{Binding Name}" IsEnabled="False"></TextBox>
</telerik:DataFormDataField>

The IsEnabled property works, of course it also changes the color of the text and make it less readable to some.



0
Leos
Top achievements
Rank 1
answered on 10 Apr 2011, 12:37 PM
Thanks.
Yes, this is better solution, but problem where Id is not displayed (after load when content is set explicitly) is the same.
Leos
Tags
DataForm
Asked by
Leos
Top achievements
Rank 1
Answers by
HDC
Top achievements
Rank 1
Leos
Top achievements
Rank 1
Share this question
or