Checkbox in wpf radgrid

4 posts, 0 answers
  1. vikas
    vikas avatar
    11 posts
    Member since:
    May 2011

    Posted 30 Jun 2014 Link to this post

    Hi team,
    I am currently using 2013.3.1204.40 version of Telerik.(MVVM, WPF application)

    I have checkbox column and 5 text boxes in grid.
    when the checkbox is checked, i want 3 textboxes in grid to be disabled.
    when the checkbox is unchecked, i want 2 other textboxes in grid to be disabled.
     
    Can you please help on how to achieve the above functionality.

    Thanks,




  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 Jul 2014 Link to this post

    Hello,

    You can use the ReadOnlyBinding property at column level for the columns with TextBoxes. You then need to set the binding to the property bound to the CheckBox column.
    Please take a look at the Read Only Rows and Cells article for a further reference.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. vikas
    vikas avatar
    11 posts
    Member since:
    May 2011

    Posted 01 Jul 2014 in reply to Dimitrina Link to this post

    Hi,
    Thanks for the reply.
    But I have a checkbox in the first column. Checking on the checkbox, I need to disable the textboxes. I have understood on how to use check box in the grid, but would like to know which is the event which is fired by the check box on checking it and how to find the textboxes .

    Thanks,
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 Jul 2014 Link to this post

    Hello,

    There is not such an event.
    What I am suggesting you is to only rely on the bound data item and its properties.
    For example if you have a property of the bound object defined as follows:
    private bool isChecked;
    public int IsChecked
    {
        get { return isChecked; }
        set
        {
            if (isChecked!= value)
            {
                isChecked = value;
           this.OnPropertyChanged("IsChecked");
            }
        }
    }

    Then, you can define your columns like so:
    <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsChecked}" />
    <telerik:GridViewDataColumn DataMemberBinding="{Binding ID}" IsReadOnlyBinding="{Binding IsChecked}" />

    The second column will be readonly or not based on the value of the IsChecked property.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top