RadGridView set ReadOnly or Enabled on a column based on a checkbox

2 posts, 0 answers
  1. Andy
    Andy avatar
    1 posts
    Member since:
    May 2013

    Posted 22 Jul 2013 Link to this post

    I have a RadGridView and in this RadGridView I have the following column:

    <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding Revoked}" AutoSelectOnEdit="True" Header="Revoked" UniqueName="Revoked" Width="Auto" IsReadOnly="False" FooterTextAlignment="Right" CellStyle="{StaticResource GridCellStyle}" />

    I want to either enable/disable or set the read only flag on another two columns in the grid based on the checkbox column.

         DataMemberBinding="{Binding RevokedBy}"
         Header="Revoked By"
         IsReadOnly="{Binding Revoked}"
         CellStyle="{StaticResource GridCellStyle}" />
         DataMemberBinding="{Binding RevokedDateTime}"
         DataFormatString="dd/MM/yyyy HH:mm:ss"
         Header="Revoked Date Time"
         IsReadOnly="{Binding Revoked}"
         CellStyle="{StaticResource GridCellStyle}">
                <WrapPanel Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="4">
                        Margin="0 5 5 5"
                        DateTimeWatermarkContent="Select Date"
                        SelectedDate="{Binding RevokedDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                        EmptyContent="Enter Time"
                        Value="{Binding RevokedTime, Mode=TwoWay}"/>

    So far I have tried binding the `IsReadOnly` and `IsEnabled` property to `Revoked` but this doesn't seem to work, and I can see that the `Revoked` property is being set and the `RaisePropertyChanged` event is recurring.

    Any help would be much appreciated.

    Further details of the code in the ViewModel

    /// <summary>
    /// The agreements.
    /// </summary>
    private ObservableCollection<NotificationAgreement> agreements;
    /// <summary>
    /// Gets or sets the agreements.
    /// </summary>
    public ObservableCollection<NotificationAgreement> Agreements
            return this.agreements ?? (this.agreements = new ObservableCollection<NotificationAgreement>());
            this.agreements = value;
            this.RaisePropertyChanged(() => this.Agreements);

    And the NotificationAgreement class has the following property.

    /// <summary>
    /// Gets or sets a value indicating whether revoked.
    /// </summary>
    public bool Revoked
            return this.revoked;
            this.revoked = value;
            this.RaisePropertyChanged(() => this.Revoked);

  2. Yoan
    Yoan avatar
    1180 posts

    Posted 23 Jul 2013 Link to this post

    Hi Andy,

    I can suggest you to check this help article which shows how to control which rows or cells to be read only.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top