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

Databinding for CheckState

5 Answers 137 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 09 Feb 2010, 09:52 AM
I started with the example with the Leages and Division (as example for data binding from the Demo) and added a tristate checkbox to the treeview and a "bool?" in each class. Initially all items are set to "true".
public League(string name) 
  _name = name; 
  _divisions = new List<Division>(); 
  _selected = true
 
string _name; 
bool? _selected; 
 
public string Name { get { return _name; } } 
public bool? Selected { get { return _selected; } } 
 

As described here I added the CheckStateConverter class which also handles the Indeterminate state.

public class CheckStateConverter : IValueConverter 
  public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
  { 
    bool? result = (bool?)value; 
    ToggleState returnValue = ToggleState.Indeterminate; 
    if (result == true
      returnValue = ToggleState.On; 
    else 
    { 
      if (result == false
        returnValue = ToggleState.Off; 
    } 
 
    return returnValue; 
  } 
//.... 

The data binding works fine, but the thing I can't understand: If I expand "League A" and "Division A" and uncheck "Team I",  "League A" and "Division A" also switch to "unchecked" instead of "indeterminate". If I uncheck "League A" and check it again the whole tree behaves correctly. What is wrong in my example?

Thanks in advance!
Jan

5 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 12 Feb 2010, 02:52 PM
Hi Jan,

There are several things that may be causing the problem.

 However, the code snippets you provided are not sufficient to investigate the issue in detail.

 Can you please send us your project so that we can take a look?

Greetings,
Tina Stancheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Anil
Top achievements
Rank 2
answered on 03 May 2010, 03:07 PM
Hi

I am also getting the similar problem. I think there is some bug in the control. if there are 3 child nodes and 2 are checked and 1 is unchecked, then the parent node check box should be intermediate but it shows the value depending on the value of the property rather then values of the children. If all the 3 child nodes are checked then also the checkbox shows the value of the property rather than the considering child nodes value.
Please help me. Thanks for any help.

Anil.
0
Anil
Top achievements
Rank 2
answered on 05 May 2010, 06:31 AM
Can someone help me in this.
0
Valentin.Stoychev
Telerik team
answered on 06 May 2010, 09:55 AM
Hello Jan,

Can you open a support ticket and send us an example where the problem is reproducible.

Thanks!

Kind regards,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rick Bednarik
Top achievements
Rank 1
answered on 06 May 2010, 10:19 AM
Hi,

The issue is fixed in new version of controls.

Rick.
Tags
TreeView
Asked by
Jan
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Anil
Top achievements
Rank 2
Valentin.Stoychev
Telerik team
Rick Bednarik
Top achievements
Rank 1
Share this question
or