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

RadTreeView doesn't display any items if change the template

3 Answers 115 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 25 Aug 2012, 09:04 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 29 Aug 2012, 02:53 PM
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.

0
Jeff
Top achievements
Rank 1
answered on 02 Oct 2012, 07:13 PM
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>
0
Tina Stancheva
Telerik team
answered on 04 Oct 2012, 01:04 PM
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.

Tags
TreeView
Asked by
Tina
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or