Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1935
Problem with IsReadOnly and XamTextEditor
posted

 

I'm using the XamDataGrid to display notes for some projects in my application. For some users it shouldn't be possible to edit these notes. I therefore used FieldSettings to bind the IsReadOnly-property to a property in my ViewModel. The problem however, is, that the IsReadOnly-property only works on the XamComboEditor, and not the XamTextEditor.

 

XamComboEditor-field:

 

                    <igDP:Field Name="NoteType" Label="Type">

                        <igDP:Field.Settings>

                            <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}">

                                <igDP:FieldSettings.EditorStyle>

                                    <Style TargetType="{x:Type igEditors:XamComboEditor}">

                                        <Setter Property="DataContext" Value="{Binding ElementName=layoutRoot, Path=DataContext}"/>

                                        <Setter Property="ItemsSource" Value="{Binding NoteTypes}" />

                                        <Setter Property="DisplayMemberPath" Value="Name" />

                                        <Setter Property="ValuePath" Value="NoteTypeId" />

                                        <Setter Property="IsReadOnly" Value="{Binding M.AccessReadOnly}" />

                                    </Style>

                                </igDP:FieldSettings.EditorStyle>

                            </igDP:FieldSettings>

                        </igDP:Field.Settings>

                    </igDP:Field>

 

 

XamTextEditor-field:

 

<igDP:Field Name="NoteText" Label="" Width="*">

                        <igDP:Field.Settings>

                            <igDP:FieldSettings EditorType="{x:Type igEditors:XamTextEditor}">

                                <igDP:FieldSettings.EditorStyle>

                                    <Style TargetType="{x:Type igEditors:XamTextEditor}">

                                        <Setter Property="IsReadOnly" Value="{Binding M.AccessReadOnly}" />

                                    </Style>

                                </igDP:FieldSettings.EditorStyle>

                            </igDP:FieldSettings>

                        </igDP:Field.Settings>

                    </igDP:Field>

The IsReadOnly-property works just fine if I set it to false in the XAML. But when I use databinding it doesn't...

 

 

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello Christian,

    Thank you for your post. I have been looking through it and the code you have provided and I suggest you change the Binding in the XamTextEditor to the following one:

    <Setter Property="IsReadOnly" Value="{Binding DataItem.M.AccessReadonly}" />

    Because the DataContext there is DataRecord. Please let me know if this helps you or you need further clarifications on this matter.

    Looking forward for your reply.

Children