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

WPF RadTreeView is generating the following warnings and I don't understand why?

9 Answers 89 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ollie
Top achievements
Rank 1
Ollie asked on 31 Jan 2013, 03:09 PM
I'm seeing the following messages appear in the output window of visual studio (2012).

I'm not sure why or how to resolve them, can anyone explain how?

The XAML is defined as follows, we use a behaviour to expand the rows when first loaded.

                                       <telerik:RadTreeView Margin="5"
                                                         controls3:StyleManager.Theme="Windows7"
                                                         IsExpandOnSingleClickEnabled="True"
                                                         SelectionMode="Single"
                                                         IsEditable="False"
                                                         IsRootLinesEnabled="True"
                                                         DisplayMemberPath="Title"
                                                         ItemsSource="{Binding Filters, Mode=OneWay}">

                                        <i:Interaction.Behaviors>
                                            <behaviors:ExpandFiltersBehavior ParentBinding="{Binding}" />
                                        </i:Interaction.Behaviors>
                                        
                                        <telerik:RadTreeView.ItemTemplate>
                                            <HierarchicalDataTemplate ItemsSource="{Binding SubFilters, Mode=OneWay}">
                                                
                                                <StackPanel Orientation="Horizontal">
                                                    <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" />
                                                    <TextBlock VerticalAlignment="Center" 
                                                               Margin="5,0,0,0"
                                                               Text="{Binding Title, Mode=OneWay}" />
                                                </StackPanel>
                                                
                                            </HierarchicalDataTemplate>
                                        </telerik:RadTreeView.ItemTemplate>
                                        
                                    </telerik:RadTreeView>





System.Windows.Data Error: 25 : Both 'ItemTemplate' and 'ItemTemplateSelector' are set;  'ItemTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'HeaderTemplate' and 'HeaderTemplateSelector' are set;  'HeaderTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'ItemTemplate' and 'ItemTemplateSelector' are set;  'ItemTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'HeaderTemplate' and 'HeaderTemplateSelector' are set;  'HeaderTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'ItemTemplate' and 'ItemTemplateSelector' are set;  'ItemTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'HeaderTemplate' and 'HeaderTemplateSelector' are set;  'HeaderTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'ItemTemplate' and 'ItemTemplateSelector' are set;  'ItemTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'HeaderTemplate' and 'HeaderTemplateSelector' are set;  'HeaderTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='8322828'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='8322828'; TargetElement.Type='System.Windows.Media.Animation.Storyboard'
System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='3060505'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='3060505'; TargetElement.Type='System.Windows.Media.Animation.Storyboard'
System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='27544548'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='27544548'; TargetElement.Type='System.Windows.Media.Animation.Storyboard'

9 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 05 Feb 2013, 11:47 AM
Hello Ollie,

I wasn't able to reproduce these exceptions. But I noticed that you have applied both the RadTreeView DisplayMemberPath and an ItemTemplate. As soon as you remove the DisplayMemberPath settings and use the ItemTemplate to apply a HierarchicalDataTemplate, the solution works as expected and there are no exceptions.

Can you please take a look at the attached sample and let me know if I'm missing something? Thank you in advance.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ollie
Top achievements
Rank 1
answered on 06 Feb 2013, 12:48 PM
The reason I am setting the 'DisplayMemberPath' property is to allow a behaviour used in the XAML to manipulate which nodes are to expanded when the tree view is first shown.

I did this because I wanted to manipulate the IsExpanded property but I am unable to declare the binding in the ItemTemplate or HierarchicalDataTemplate.

If you can tell me how I can bind the IsExpanded property to my HierarchicalDataTemplate (i.e to my Model class) then I can remove the DisplayMemberPath property.


Cheers

Ollie

0
Accepted
Tina Stancheva
Telerik team
answered on 06 Feb 2013, 12:53 PM
Hello Ollie,

You can't bind the IsExpanded property of the RadTreeViewItems in the HierarchicalDataTemplate, but you can use Style bindings instead:
<Style TargetType="telerik:RadTreeViewItem">
  <Setter Property="IsExpanded" Value="{Binding Expanded, Mode=TwoWay}"/>
</Style>
This is an implicit style which will be applied on all RadTreeViewItems inside its scope of action. This is why if you define it in the resource section of the view where the RadTreeView is hosted, all TreeViewItems IsExpanded properties will be properly binded.

Please give this a try and let me know if it helps.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ollie
Top achievements
Rank 1
answered on 07 Feb 2013, 04:54 PM
this worked perfectly...

ta

Ollie
0
Manuel
Top achievements
Rank 1
answered on 15 Apr 2014, 01:03 PM
Hello, I hope I can help, I do not work the solution you have given to Ollie

telerik v 2013.3.1316.45

System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='52581927'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='52581927'; TargetElement.Type='System.Windows.Media.Animation.Storyboard'
System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='49452405'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement.HashCode='49452405'; TargetElement.Type='System.Windows.Media.Animation.Storyboard'
0
Pavel R. Pavlov
Telerik team
answered on 16 Apr 2014, 08:43 AM
Hello Manuel,

Are you saying that the project provided by Tina is not working with the 2013.3.1316.45 release? I tested it with our latest official and the release that you refer to but I couldn't reproduce the reported issue.

However, in order to investigate the reported behavior we will need to reproduce it on our side. The best way to do it is to send us a project which reproduces it. Only after reproducing an issue on our side we will be able to further investigate the reasons behind.

Thank you for understanding.

Regards,
Pavel R. Pavlov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jakub
Top achievements
Rank 1
answered on 23 Nov 2015, 05:21 PM

Hi Telerik,

 

I am having the following issue: 

I have a RadTreeView with ItemTemplateSelector. The ItemTemplateSelector can assign one of the two templates for every tree node. Most of the time everything works perfectly fine but once every twenty times I load the screen with the treeview and only the root nodegets through the SelectTemplate method - the other nodes don't hit it. I decided to report this issue here as I receive the same error in the output:

 

PresentationHost.exe Information: 0 : app.Procast_SP_ADMIN_ApplySelectionGetList: <GetList><User_Idx>13</User_Idx><SalesOrg_Idx>1</SalesOrg_Idx><MenuItem_Idx>21</MenuItem_Idx><SelectedItems><Item_Idx>2</Item_Idx><Item_Idx>8</Item_Idx><Item_Idx>20051</Item_Idx><Item_Idx>20080</Item_Idx><Item_Idx>7</Item_Idx><Item_Idx>20039</Item_Idx><Item_Idx>20077</Item_Idx></SelectedItems></GetList>

System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.Brush' for 'en-GB' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: BrushConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.BrushConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'
System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.Brush' for 'en-GB' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: BrushConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.BrushConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'
System.Windows.Data Error: 25 : Both 'ItemTemplate' and 'ItemTemplateSelector' are set;  'ItemTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'HeaderTemplate' and 'HeaderTemplateSelector' are set;  'HeaderTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.Brush' for 'en-GB' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: BrushConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.BrushConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'
System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.Brush' for 'en-GB' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: BrushConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.BrushConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'
System.Windows.Data Error: 25 : Both 'ItemTemplate' and 'ItemTemplateSelector' are set;  'ItemTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'HeaderTemplate' and 'HeaderTemplateSelector' are set;  'HeaderTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.Brush' for 'en-GB' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: BrushConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.BrushConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'
System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.Brush' for 'en-GB' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: BrushConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.BrushConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'
System.Windows.Data Error: 25 : Both 'ItemTemplate' and 'ItemTemplateSelector' are set;  'ItemTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 25 : Both 'HeaderTemplate' and 'HeaderTemplateSelector' are set;  'HeaderTemplateSelector' will be ignored. RadTreeViewItem:'RadTreeViewItem' (Name='')
System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.Brush' for 'en-GB' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: BrushConverter cannot convert from (null).
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.Windows.Media.BrushConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'


        IsOptionElementsEnabled="{Binding IsSingleSelect, Converter={StaticResource InvertedBooleanConverter}, ElementName=Tree, Mode=TwoWay}"
        telerik:AnimationManager.IsAnimationEnabled="False"
        SelectionMode="{Binding IsSingleSelect, Converter={StaticResource BoolToSelectionModeConverter}, ElementName=Tree, Mode=TwoWay}"
        IsTriStateMode="{Binding IsSingleSelect, Converter={StaticResource InvertedBooleanConverter}, ElementName=Tree, Mode=TwoWay}"
        x:Name="MainRadTreeViewNew"
        IsVirtualizing="True"
        telerik:TreeViewPanel.TreeVirtualizationMode="Hierarchical"
        Checked="TreeView_OnChecked"
        Unchecked="TreeView_OnChecked"
        PreviewSelectionChanged="SingleSelect_OnPreviewSelected"
        Selected="SingleSelect_OnSelected"
        Unselected="SingleSelect_OnUnselected"
        ItemClick="TreeView_OnItemClick"
        ItemsSource="{Binding ElementName=Tree, Path=TreeSource.ListTree, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
        Visibility="{Binding ElementName=Tree, Path=TreeSource.IsTreeLoading, Converter={StaticResource InvertedBoolToVisibilityConverter}}" 
                        ItemTemplateSelector="{StaticResource TreeNodeTemplateSelector}"
                        >

 

This is how I declare my RadTreeView:

 

                    <telerik:RadTreeView
        IsOptionElementsEnabled="{Binding IsSingleSelect, Converter={StaticResource InvertedBooleanConverter}, ElementName=Tree, Mode=TwoWay}"
        telerik:AnimationManager.IsAnimationEnabled="False"
        SelectionMode="{Binding IsSingleSelect, Converter={StaticResource BoolToSelectionModeConverter}, ElementName=Tree, Mode=TwoWay}"
        IsTriStateMode="{Binding IsSingleSelect, Converter={StaticResource InvertedBooleanConverter}, ElementName=Tree, Mode=TwoWay}"
        x:Name="MainRadTreeViewNew"
        IsVirtualizing="True"
        telerik:TreeViewPanel.TreeVirtualizationMode="Hierarchical"
        Checked="TreeView_OnChecked"
        Unchecked="TreeView_OnChecked"
        PreviewSelectionChanged="SingleSelect_OnPreviewSelected"
        Selected="SingleSelect_OnSelected"
        Unselected="SingleSelect_OnUnselected"
        ItemClick="TreeView_OnItemClick"
        ItemsSource="{Binding ElementName=Tree, Path=TreeSource.ListTree, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
        Visibility="{Binding ElementName=Tree, Path=TreeSource.IsTreeLoading, Converter={StaticResource InvertedBoolToVisibilityConverter}}" 
                        ItemTemplateSelector="{StaticResource TreeNodeTemplateSelector}"
                        >

 

Here is the template selector:

 

    public class TreeNodeTemplateSelector : DataTemplateSelector
    {
        public DataTemplate DefaultNodeTemplate { get; set; }
        public DataTemplate DateNodeTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            TreeViewHierarchy treeViewHierarchy = item as TreeViewHierarchy;
            if (treeViewHierarchy == null) return null;

            if (treeViewHierarchy.Template.ToLower() == "date") return DateNodeTemplate;
            return DefaultNodeTemplate;
        }
    }

 

And here are the two templates:

 

        <controls:TreeNodeTemplateSelector x:Key="TreeNodeTemplateSelector">
            
            <controls:TreeNodeTemplateSelector.DefaultNodeTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Children, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemContainerStyle="{StaticResource StatusItemContainerStyle}">
                    <TextBlock Text="{Binding Name}" Background="{Binding StringBackground, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
                        <telerik:RadContextMenu.ContextMenu>
                        <telerik:RadContextMenu x:Name="ItemContextMenu" Opened="RadContextMenu_Opened">
                        <telerik:RadMenuItem Header="Toggle - plan at this level"  />
                        </telerik:RadContextMenu>
                        </telerik:RadContextMenu.ContextMenu>
                    </TextBlock>
                </HierarchicalDataTemplate>
            </controls:TreeNodeTemplateSelector.DefaultNodeTemplate>
            
            <controls:TreeNodeTemplateSelector.DateNodeTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Children, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemContainerStyle="{StaticResource StatusItemContainerStyle}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <!--Setting fixed width for all date pickers-->
                            <ColumnDefinition Width="102"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock x:Name="Name" Text="{Binding Name}" Background="{Binding StringBackground, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center">
                            <telerik:RadContextMenu.ContextMenu>
                            <telerik:RadContextMenu x:Name="ItemContextMenu" Opened="RadContextMenu_Opened">
                            <telerik:RadMenuItem Header="Toggle - plan at this level"  />
                            </telerik:RadContextMenu>
                            </telerik:RadContextMenu.ContextMenu>
                        </TextBlock>
                        <!--
                        Height is bound so the date picker is the same height as the text block (normally is a bit bigger).
                        SelectedDateChanged handles setting dates of a node's children and parent according to the current node selection made by a user.
                        Tag holds the item idx so the node can be recognised in the SelectedDateChanged event handler.
                        -->
                        <DatePicker Grid.Column="1" SelectedDate="{Binding Date}" Height="{Binding Height, ElementName=Name}" BorderThickness="0" SelectedDateChanged="DatePicker_OnSelectedDateChanged" Tag="{Binding Idx}"/>
                    </Grid>
                </HierarchicalDataTemplate>
            </controls:TreeNodeTemplateSelector.DateNodeTemplate>
            
        </controls:TreeNodeTemplateSelector>

 

 

Let me know if you need anything else (unfortunately I'm not able to provide the full example) and feel free to move this reply if you find it posted in an inappropriate place.

 

Regars,

Jakub Siuda.

0
Jakub
Top achievements
Rank 1
answered on 24 Nov 2015, 02:41 PM

I just found out the reason of the issue - if I remove the TreeViewPanel.TreeVirtualizationMode everything works fine.

Is there any way to have ItemTemplateSelector and TreeVirtualizationMode together in one treeview and make it work?

0
Peshito
Telerik team
answered on 25 Nov 2015, 12:30 PM
Hi Jakub,

I tried to reproduce the issue using ItemTemplateSelector along with treeview virtualization enabled but to no avail. It is hard to reproduce the behavior and this is why I would like to ask you to provide a sample runnable project reproducing the issue so I could debug it locally and give you an appropriate solution. Please note that this is a forum thread so you could either share the project using a third party web site for files sharing or submit a support ticket from your account.

Regards,
Peshito
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
Ollie
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Ollie
Top achievements
Rank 1
Manuel
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Jakub
Top achievements
Rank 1
Peshito
Telerik team
Share this question
or