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
2349
Why is it so hard to set a grid to read-only and allow scrolling?
posted

I have an editable grid with xamnumericeditor, xammaskededitors, etc.  I allow the users to fill out the info and once it's submitted, they cannot edit, but they should still be able to look at it.I have done everything that I can think of to set the xamdatagrid to a readonly state and even filtered through each cell to set the editor to read-only.  Now when I'm doing this, it does not allow scrolling.  Isn't there a simple property somewhere for this?  I have spent 8 hours on this so I'd appreciate some help please.

  • 69686
    posted

    Hello,

    I am attaching a sample showing one way to achieve this. Here is some code snippets from the sample:

    <Style TargetType="{x:Type igEditors:ValueEditor}" x:Key="style">

                        <Style.Triggers>

                            <DataTrigger Binding="{Binding Path=Tag}" Value="false">

                                <Setter Property="IsReadOnly" Value="True"/>

                                <Setter Property="BorderBrush" Value="LightGray"/>

                            </DataTrigger>

                        </Style.Triggers>

                    </Style>

    void xamDataGrid1_RecordUpdated(object sender, Infragistics.Windows.DataPresenter.Events.RecordUpdatedEventArgs e)

            {

                DataRecord dr = e.Record as DataRecord;

                dr.Tag = false;

            }

    XamDataGrid_ReadOnly.zip