This is a migrated thread and some comments may be shown as answers.

Checkbox in wpf radgrid

3 Answers 185 Views
GridView
This is a migrated thread and some comments may be shown as answers.
vikas
Top achievements
Rank 1
vikas asked on 30 Jun 2014, 12:08 PM
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,




3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 01 Jul 2014, 08:30 AM
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.
 
0
vikas
Top achievements
Rank 1
answered on 01 Jul 2014, 09:19 AM
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,
0
Dimitrina
Telerik team
answered on 01 Jul 2014, 01:37 PM
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.
 
Tags
GridView
Asked by
vikas
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
vikas
Top achievements
Rank 1
Share this question
or