Scrollviewer on template

4 posts, 1 answers
  1. Marco
    Marco avatar
    21 posts
    Member since:
    Aug 2010

    Posted 18 Apr 2011 Link to this post

    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.

  2. Marco
    Marco avatar
    21 posts
    Member since:
    Aug 2010

    Posted 19 Apr 2011 Link to this post

    Any ideas?

    All I want is the treeview not to have scrollbars and let the parent control handle that.
    Thanks
  3. DevCraft banner
  4. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Apr 2011 Link to this post

    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
  5. Marco
    Marco avatar
    21 posts
    Member since:
    Aug 2010

    Posted 21 Apr 2011 Link to this post

    Excellent!
    Worked exactly as I needed!

    Thanks.
Back to Top