CheckedItems doesn't fire CollectionChanged event to update bound objects?

2 posts, 0 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 19 Jan 2011 Link to this post


    I am attempting to element bind a TextBox.Text property to the RadTreeView.CheckedItems collection like the sample below.  I have added a converter just so that I can see if the CheckedItems collection is actually changing but it doesn't appear to be.  Have I done something incorrectly?  The converter never fires after the initial load even though I am checking items.

    I noticed a statement in the online documentation (here) "Raised when the CheckedItems change. Currently it is only raised with 'Reset' since the set of items in unordered."  Is this part of the problem?  I would expect that anytime any item is checked/unchecked the event would be raised.

            <local:MyConverter x:Key="MyConverter" />
                <RowDefinition Height="50" />
                <RowDefinition Height="1*" />
                <ColumnDefinition Width="1*" />
            <TextBox Text="{Binding ElementName=RadTreeView1, Path=CheckedItems, Converter={StaticResource MyConverter}}" />
            <telerik:RadDropDownButton Grid.Row="1" Grid.Column="0">
                    <telerik:RadTreeView x:Name="RadTreeView1" IsLineEnabled="True" BorderThickness="0" SelectionMode="Multiple" IsEditable="False" IsOptionElementsEnabled="True" IsTriStateMode="False" ItemsOptionListType="CheckList">
                        <telerik:RadTreeViewItem Header="1" IsExpanded="True">
                            <telerik:RadTreeViewItem Header="aaa" />
                            <telerik:RadTreeViewItem Header="bbb" />
                            <telerik:RadTreeViewItem Header="ccc" />
                            <telerik:RadTreeViewItem Header="ddd" />
                        <telerik:RadTreeViewItem Header="2" IsExpanded="True">
                            <telerik:RadTreeViewItem Header="aaa" />
                            <telerik:RadTreeViewItem Header="bbb" IsExpanded="True">
                                <telerik:RadTreeViewItem Header="b1" />
                                <telerik:RadTreeViewItem Header="b2" />
                                <telerik:RadTreeViewItem Header="b3" />
                                <telerik:RadTreeViewItem Header="b4" />
                            <telerik:RadTreeViewItem Header="ccc" />
                            <telerik:RadTreeViewItem Header="ddd" />

    public class MyConverter : IValueConverter
            #region IValueConverter Members
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
                return "a";
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
                throw new NotImplementedException();
  2. Petar Mladenov
    Petar Mladenov avatar
    3152 posts

    Posted 21 Jan 2011 Link to this post

    Hello Rob,

    Yes, the problem is the one you have mentioned: CollectionChaged of the ChekedItems is raised only Initially. I prepared a sample to workaround this with a ViewModel that uses the Checked event of the RadTreeView. Please give it a try and let me know if it satisfies you or not.

    All the best,
    Petar Mladenov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top