Databinding for CheckState

6 posts, 0 answers
  1. Jan
    Jan avatar
    4 posts
    Member since:
    Jan 2010

    Posted 09 Feb 2010 Link to this post

    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
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 12 Feb 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Anil
    Anil avatar
    58 posts
    Member since:
    Nov 2007

    Posted 03 May 2010 Link to this post

    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.
  5. Anil
    Anil avatar
    58 posts
    Member since:
    Nov 2007

    Posted 05 May 2010 Link to this post

    Can someone help me in this.
  6. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 06 May 2010 Link to this post

    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.
  7. Rick Bednarik
    Rick Bednarik avatar
    1 posts
    Member since:
    Nov 2009

    Posted 06 May 2010 Link to this post

    Hi,

    The issue is fixed in new version of controls.

    Rick.
Back to Top
UI for WPF is Visual Studio 2017 Ready