HierarchicalDataTemplate Binding Exceptions

4 posts, 0 answers
  1. Matthias Bibo
    Matthias Bibo avatar
    72 posts
    Member since:
    Mar 2010

    Posted 21 Oct 2013 Link to this post


    Hi,

    I am having a problem with the new Release in the RadTreeView. I have a HierarchicalDataTemplate on a Tree witch works fine with the previouse release without throwing Binding Excpetions. Now I get Expection for the Children Probetry as well as for the ContainerBindings.

    Here the example:
    ...
    <telerik:ContainerBindingCollection x:Key="TreeViewContainerBindings">
        <telerik:ContainerBinding PropertyName="IsSelected" Binding="{Binding IsSelected}" />
        <telerik:ContainerBinding PropertyName="IsExpanded" Binding="{Binding IsExpanded, Mode=TwoWay}" />
    </telerik:ContainerBindingCollection>
     
    ...
             
    <telerik:RadTreeView Grid.Row="0" Grid.Column="0"
                 telerik:TextSearch.TextPath="DisplayName"
                 x:Name="treeViewGeschaeftspartner"
                 MouseRightButtonUp="TreeViewGeschaeftspartner_MouseRightButtonUp"
                 ItemsSource="{Binding GeschaeftspartnerDisplay}"
                 SelectedItem="{Binding CurrentSelectedGeschaeftspartnerListDisplay, Mode=TwoWay}"
                 IsVirtualizing="True"
                 BringIntoViewMode="HeaderAndItems"
                 AutoScrollToSelectedItem="True"
                 IsTextSearchEnabled="True"
                 IsDragPreviewEnabled="False"
                 IsDragTooltipEnabled="True"                                       
                 IsDragDropEnabled="True">
        <telerik:RadTreeView.ItemTemplate>
            <telerik:HierarchicalDataTemplate ItemsSource="{Binding Children}" telerik:ContainerBinding.ContainerBindings="{StaticResource TreeViewContainerBindings}">
                <StackPanel Orientation="Horizontal" Background="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter='Aktiv'}">
                    <Image Height="16" Source="{Binding ImageSource}" Margin="0,0,3,0"></Image>
                    <Grid>
                        <TextBlock Foreground="{Binding Self, Converter={StaticResource GPForegroundConverter}}"
                                   Text="{Binding FirmenName}"
                                   Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter='Firma'}" />
                        <TextBlock Foreground="{Binding Self, Converter={StaticResource GPForegroundConverter}}"
                                   Text="{Binding AbteilungName}"
                                   Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter='Abteilung'}" />
                        <TextBlock Foreground="{Binding Self, Converter={StaticResource GPForegroundConverter}}"
                                   Text="{Binding PersonName}"
                                   Visibility="{Binding Converter={StaticResource VisibilityConverter}, ConverterParameter='Person'}" />
                    </Grid>
                </StackPanel>
            </telerik:HierarchicalDataTemplate>
        </telerik:RadTreeView.ItemTemplate>
    </telerik:RadTreeView>

    How can we avoid these Exceptions? They cause the TreeView to perform badly.

    Best Regards
    Matthias
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 24 Oct 2013 Link to this post

    Hi Matthias,

    I tried to reproduce the reported behavior on our side with our latest official release and it seems that the code works as expected. Could you please take a look at the attached project and let me know if I missed something. It will be great if you can change the implementation so that the issue can be reproduced in this project and send it back. By doing so we will be able to fully understand your custom scenario and suggest a proper approach in your case.

    Also, I noticed that you use ContainerBindingCollection. Please note that this collection was created to allow Silverlight4 users to use bindings. However, in Silverlight5 you can use Style bindings instead. Furthermore, we no longer support Silverlight4, you can find more info here, and we strongly encourage our customers to migrate to Silverlight5.

    I hope this information is helpful.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Matthias Bibo
    Matthias Bibo avatar
    72 posts
    Member since:
    Mar 2010

    Posted 24 Oct 2013 Link to this post

    Hallo Pavlov,

    thank you very much for the Sample. The sample its self works perfectly as it should. I was how ever able die create the behavior I am having by modifying the MainPage like this:

    <Grid x:Name="LayoutRoot" Background="White">
           <Grid.RowDefinitions>
               <RowDefinition Height="100" />
           </Grid.RowDefinitions>
           <Grid.Resources>
               <telerik:BooleanToVisibilityConverter x:Key="conv" />
     
               <telerik:HierarchicalDataTemplate x:Key="FirstLevelItemTemplate" ItemsSource="{Binding Children}">
                   <TextBlock Text="{Binding Header}" />
               </telerik:HierarchicalDataTemplate>
     
               <Style TargetType="telerik:RadTreeViewItem">
                   <Setter Property="IsEditable" Value="{Binding IsEditable, Mode=TwoWay}" />
                   <Setter Property="Visibility" Value="{Binding IsVisible, Mode=TwoWay, Converter={StaticResource conv}}" />
                   <Setter Property="IsInEditMode" Value="{Binding IsInEditMode, Mode=TwoWay}" />
               </Style>
           </Grid.Resources>
           <telerik:RadTreeView  Grid.Row="0" telerik:TextSearch.TextPath="DisplayName" Grid.Column="0" x:Name="xTree"
                                        ItemTemplate="{StaticResource FirstLevelItemTemplate}"
                                        ItemsSource="{Binding Items}"
                                        IsVirtualizing="True"
                                        IsTextSearchEnabled="True"
                                        IsDragPreviewEnabled="False"
                                        IsDragTooltipEnabled="True"
                                        IsDragDropEnabled="True" />
       </Grid>


    It seems to have something to do with being in a Grid.Row with limited hight an Virtualizing enabled...

    I hope you can furthur investigate this behaivor with the modified Mainpage.

    Best Regards,
    Matthias
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 29 Oct 2013 Link to this post

    Hello Matthias,

    Thank you for elaborating on your custom scenario. You are right that the exceptions can be observed at run-time. This behavior is observed when the ScrollViewer of the control is visualized - either by setting a height of a container or resizing the root window.

    This is why we decided to log this behavior as a bug in our PITS. You can give your vote for it and follow its progress here.

    Also, as a small sign of appreciation I updated your Teleric account. Please accept our apology for the inconvenience caused.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top