RadTreeView doesn't display any items if change the template

4 posts, 1 answers
  1. Tina
    Tina avatar
    17 posts
    Member since:
    May 2011

    Posted 25 Aug 2012 Link to this post

    I'm trying to dislpay a text informing the user that more items are loaded on the background of the tree view. I am trying to change the template. As soon as the ItemsPresenter is not a direct child of ScrollViewer the tree stops displaying the items.

    Here is my template:

        <ControlTemplate x:Key="RadTreeViewWithLoadingTemplate" TargetType="{x:Type telerik:RadTreeView}">
            <Grid x:Name="RootElement">         
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                    <Grid>
                        <ScrollViewer x:Name="ScrollViewer" BorderThickness="0" Background="{x:Null}" CanContentScroll="True" HorizontalScrollBarVisibility="Auto" IsTabStop="False"
                                      Padding="{TemplateBinding Padding}" VerticalScrollBarVisibility="Auto"
                                      Style="{DynamicResource LoadingScrollViewerStyle}">
                            <Grid>
                                <Grid.RowDefinitions>
                                  <RowDefinition Height="Auto" />
                                  <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <ItemsPresenter/>
                                <TextBlock Text="Loading more items!" Height="20" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="1"/>                       
                        </ScrollViewer>
                        </Grid>
                </Border>
            </Grid>
        </ControlTemplate>

    Thanks,
    Justyna
  2. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 29 Aug 2012 Link to this post

    Hello Justyna,

     This is a known issue in the control and it is logged in our PITS. Until the issue gets addressed, it's better to display the TextBlock on top of the enitre RadTreeView in your window definition. This way you won't have to edit the template of the control at all. Let me know if such an approach can work for you.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jeff
    Jeff avatar
    12 posts
    Member since:
    Sep 2012

    Posted 02 Oct 2012 Link to this post

    Has there been a fix to this? I'd like to give an affect to the right side of the tree but cannot wrap the ItemsPresenter inside anything because the ScrollViewer can only set its content once.

    The items still disappear...
    <Setter Property="Template">
    <Setter.Value>
        <ControlTemplate TargetType="telerik:RadTreeView">
            <ScrollViewer x:Name="ScrollViewer"
            BorderThickness="0" Background="{StaticResource VeryLightGreyBrush}"
            telerik:ScrollViewerExtensions.EnableMouseWheel="True"
            IsTabStop="False" 
            Padding="{TemplateBinding Padding}">   
         <Grid>
        <ItemsPresenter x:Name="ItemsPresenter"> </ItemsPresenter>
        <Rectangle Style="{StaticResource RightShadowStyle}"/>
        </Grid>
    </ScrollViewer>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 04 Oct 2012 Link to this post

    Hi Jeff,

    Unfortunately this issue isn't addressed yet. This is why it might be better to place the shadow Rectangle next to the RadTreeView definition in your UserControl/Window, instead in the ControlTemplate of the control.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top