Tri-state checkboxes and drag and drop

9 posts, 0 answers
  1. Derek
    Derek avatar
    3 posts
    Member since:
    May 2011

    Posted 13 Jul 2011 Link to this post

    Hi,

    I have a tree view with IsTriStateMode set to false, but when I reorder the children of an unchecked item - some of which are checked - the item goes to an indeterminate state. Any ideas why this might be happening?
  2. Derek
    Derek avatar
    3 posts
    Member since:
    May 2011

    Posted 13 Jul 2011 Link to this post

    I'm having another issue with the checkboxes; I'm using them to indicate items to be deleted, but when I delete an item that has children which are checked, the children remain in the CheckedItems collection (even though they're no longer in the tree!).
  3. DevCraft banner
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 19 Jul 2011 Link to this post

    Hi Derek,

    We are aware of several existing issues with the CheckedItems collection of the RadTreeView, one of them is:
    TreeView: When a checked item is removed from the Items collection it is still listed in the CheckedItems collection

    The good news is that we will be working on RadTreeView`s issues during the second half of the current Q3 (September- November). We also wanted to ask you the exact steps you perform in reproducing the issue with the drag and drop operation and the undesired Indeterminate state. Any runnable sample or just XAML will  be highly appreciated. Thank you in advance for your cooperation.
    Best wishes,
    Petar Mladenov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  5. Derek
    Derek avatar
    3 posts
    Member since:
    May 2011

    Posted 26 Jul 2011 Link to this post

    So this drag and drop problem only appears to happen when it is bound to a data source, rather than filled with treeviewitems.
    Here's the xaml and code-behind to reproduce:
    <UserControl x:Class="ESC.Sandboxes.DLudwig.Silverlight.MainPage"
            mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
        <UserControl.Resources>
            <telerik:HierarchicalDataTemplate x:Key="dataItemTemplate" ItemsSource="{Binding Children}" >
                <TextBlock Text="{Binding Name}" />
            </telerik:HierarchicalDataTemplate>
        </UserControl.Resources>
        <Grid x:Name="LayoutRoot">
            <telerik:RadTreeView
                IsTriStateMode="False"
                IsDragDropEnabled="True"
                IsOptionElementsEnabled="True"
                ItemsOptionListType="CheckList"
                ItemsSource="{Binding Items}"
                ItemTemplate="{StaticResource dataItemTemplate}">
            </telerik:RadTreeView>
        </Grid>
    </UserControl>
    using System.Windows.Controls;
    using System.Collections.ObjectModel;
     
    namespace ESC.Sandboxes.DLudwig.Silverlight
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                InitializeComponent();
                DataContext = new DataSource();
            }
        }
     
        public class DataSource
        {
            public ObservableCollection<DataItem> Items { get; set; }
            public DataSource()
            {
                Items = new ObservableCollection<DataItem>()
                {
                    new DataItem()
                    {
                        Name = "Parent",
                        Children = new ObservableCollection<DataItem>()
                        {
                            new DataItem() { Name = "Child 1", Children = new ObservableCollection<DataItem>() },
                            new DataItem() { Name = "Child 2", Children = new ObservableCollection<DataItem>() },
                            new DataItem() { Name = "Child 3", Children = new ObservableCollection<DataItem>() }
                        }
                    }
                };
            }
        }
     
        public class DataItem
        {
            public string Name { get; set; }
            public ObservableCollection<DataItem> Children { get; set; }
        }
    }

    To reproduce, simply check one of the children, and reorder the children. If a checked child is reordered, it loses its checked status (which seems reasonable); but if another child is reordered, or there are any checked children, the parent's checked state goes to indeterminate.
  6. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 01 Aug 2011 Link to this post

    Hello Derek,

    Thank you for sending us more information about this issue. We managed to reproduce it and we logged it as a bug in our PITS where you can track its progress.

    I updated your Telerik points for bringing the issue to our attention.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  7. Hieu
    Hieu avatar
    7 posts
    Member since:
    Feb 2012

    Posted 09 Feb 2012 Link to this post

    Hi,

    Is there anyone help me with this concern? Does the Telerik support CheckBox control? Does it provide tri-state on CheckBox control?

    If yes, can you give me any sample about this, it would be a big help with me. Thank you all,

    Hieu Nguyen
  8. Hieu
    Hieu avatar
    7 posts
    Member since:
    Feb 2012

    Posted 09 Feb 2012 Link to this post

    Hi all,

    I'm looking forward to your response. Thank you.

    Hieu Nguyen
  9. Hieu
    Hieu avatar
    7 posts
    Member since:
    Feb 2012

    Posted 13 Feb 2012 Link to this post

    Hi all,

    Is there anything new?

    Hieu Nguyen
  10. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 14 Feb 2012 Link to this post

    Hi Hieu,

    The RadTreeView control exposes CheckBox functionality and you can find more info about it here. However, it is important to keep in mind that the ''tri-state" built-in logic of the RadTreeView will work as expected only if the RadTreeView control is manually populated with RadTreeViewItems (in xaml or from code-behind). This means that in databinding scenarios you'll have to create your own custom "tri-state" logic. So if you're binding the RadTreeView control, I'd suggest following the approach described in this code library.

    Let us know if the information helps or if we can further assist you.

    Greetings,
    Tina Stancheva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
DevCraft banner