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

Tri-state checkboxes and drag and drop

8 Answers 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 13 Jul 2011, 08:57 PM
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?

8 Answers, 1 is accepted

Sort by
0
Derek
Top achievements
Rank 1
answered on 13 Jul 2011, 11:30 PM
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!).
0
Petar Mladenov
Telerik team
answered on 19 Jul 2011, 09:26 AM
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!

0
Derek
Top achievements
Rank 1
answered on 26 Jul 2011, 10:41 PM
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.
0
Tina Stancheva
Telerik team
answered on 01 Aug 2011, 09:18 AM
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 >>

0
Hieu
Top achievements
Rank 1
answered on 09 Feb 2012, 11:33 AM
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
0
Hieu
Top achievements
Rank 1
answered on 10 Feb 2012, 03:25 AM
Hi all,

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

Hieu Nguyen
0
Hieu
Top achievements
Rank 1
answered on 13 Feb 2012, 11:10 AM
Hi all,

Is there anything new?

Hieu Nguyen
0
Tina Stancheva
Telerik team
answered on 14 Feb 2012, 09:10 AM
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 >>
Tags
TreeView
Asked by
Derek
Top achievements
Rank 1
Answers by
Derek
Top achievements
Rank 1
Petar Mladenov
Telerik team
Tina Stancheva
Telerik team
Hieu
Top achievements
Rank 1
Share this question
or