ReadOnly DataFormDataField is editable

3 posts, 0 answers
  1. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 10 Apr 2011 Link to this post

    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. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 10 Apr 2011 Link to this post

    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.



  3. DevCraft banner
  4. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 10 Apr 2011 Link to this post

    Thanks.
    Yes, this is better solution, but problem where Id is not displayed (after load when content is set explicitly) is the same.
    Leos
Back to Top