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

Scrollviewer on template

3 Answers 110 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 18 Apr 2011, 10:30 AM
I have created a custom control with a RadPanelBar and RadPanelBarItems (which are using HierarchicalDataTemplate) and inside one of those RadPanelBarItem is a RadTreeView which is also using a HierarchicalDataTemplate.
I've tried to costumize the RadTreeView on Blender to REMOVE the scrollviewer from the tree items panel to make use of the RadPanelBarItem scroll.

Original template:
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<Grid>
<ScrollViewer x:Name="ScrollViewer" BorderThickness="0" Background="{x:Null}"
  telerik:ScrollViewerExtensions.EnableMouseWheel="True" IsTabStop="False"
Padding="{TemplateBinding Padding}" telerik:StyleManager.Theme="{StaticResource Theme}">
<ItemsPresenter/>
</ScrollViewer>
<Grid x:Name="DragBetweenItemsFeedback" HorizontalAlignment="Left" Height="8" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Ellipse HorizontalAlignment="Left" Height="8" Stroke="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}" StrokeThickness="2" VerticalAlignment="Center" Width="8"/>
<Rectangle Grid.Column="1" Fill="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}" Height="2" Margin="-2,3,0,0" RadiusY="2" RadiusX="2" VerticalAlignment="Top"/>
</Grid>
</Grid>
</Border>

If i place only the itemspresenter inside the grid, I can only see the root node.
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<Grid>
<ItemsPresenter/>
<Grid x:Name="DragBetweenItemsFeedback" HorizontalAlignment="Left" Height="8" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Ellipse HorizontalAlignment="Left" Height="8" Stroke="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}" StrokeThickness="2" VerticalAlignment="Center" Width="8"/>
<Rectangle Grid.Column="1" Fill="{StaticResource DragBetweenItemsFeedback_BackgroundBrush}" Height="2" Margin="-2,3,0,0" RadiusY="2" RadiusX="2" VerticalAlignment="Top"/>
</Grid>
</Grid>
</Border>


What can I do or what do I need to costumize also to achive the desired behaviour?
Can you post a sample?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Marco
Top achievements
Rank 1
answered on 19 Apr 2011, 01:54 PM
Any ideas?

All I want is the treeview not to have scrollbars and let the parent control handle that.
Thanks
0
Accepted
Petar Mladenov
Telerik team
answered on 21 Apr 2011, 09:59 AM
Hello Marco,

Have tried using the attached property ScrollViewer like so:
<ScrollViewer >
         <telerik:RadTreeView x:Name="treeView" 
                              ScrollViewer.VerticalScrollBarVisibility="Disabled"
                              ScrollViewer.HorizontalScrollBarVisibility="Disabled" />
     </ScrollViewer>
In this case the outer ScrollViewer is just the simplest way to show a parent control that uses its ScrollViewer instead of the TreeViews`s one. Let us know if this helps you or not.

All the best,
Petar Mladenov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Marco
Top achievements
Rank 1
answered on 21 Apr 2011, 01:22 PM
Excellent!
Worked exactly as I needed!

Thanks.
Tags
TreeView
Asked by
Marco
Top achievements
Rank 1
Answers by
Marco
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or