PRISM Scrolling in region

I use regions with Prism. In the main window I have defined regions and in the region LeftNavigationRegion I inject a module which consist of basically a treeview. When the main region resizes I want a scrollbar from the treeview, but I instead get the scrollbar from the content control. This means that the header control in the treeview disappears. Does anyone know how to show the scrollbar of the treeview

XAML in main window...

<ContentControl  x:Name="ActionContent"
                 cal:RegionManager.RegionName="{x:Static inf:RegionNames.LeftNavigationRegion}"
        <ControlTemplate TargetType="ContentControl">
            <ContentPresenter  Content="{TemplateBinding Content}" />
                <Trigger Property="HasContent" Value="false">
                    <Setter Property="Visibility" Value="Collapsed" />


You need to limit the size of the TreeView in some way. By default, it is probably being allowed to stretch to whatever size it needs, so the TreeView doesn't think it ever needs to scroll so don't show it's ScrollBars

You can do this by binding the Height/Width of the TreeView to your ContentControl's Height/Width. (If your outer ScrollViewer is inside the ContentControl, then bind to the it's Height/Width instead)

<TreeView Height="{Binding ElementName=ActionContent, Path=ActualHeight}"
          Width="{Binding ElementName=ActionContent, Path=ActualWidth}">

Think i solved it, the problem was related to how i renderede the treeview columns, i was using a static Grid inside the style template of the treeview. When i realized that if i changed my custom treeview to a standard listview the scrolling worked. So i extracted the styles for the standard listview and made some changes to the treeview style and it worked, now the header for the treeview stays on top and the scrollbar for the treeview is shown instead of the scrollbar for the content control


<Style TargetType="{x:Type TreeView}".....

is added

                <Border BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" Name="Bd" SnapsToDevicePixels="True">

                    <ScrollViewer Style="{DynamicResource
                {x:Static GridView.GridViewScrollViewerStyleKey}}">
                        <ItemsPresenter />


for the control template. And in

<Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}" TargetType="ScrollViewer">

I added

  <ScrollViewer DockPanel.Dock="Top"
                                    <GridViewHeaderRowPresenter Name="hrp" Columns="{StaticResource gvcc}"  
                                 "{StaticResource MyHeaderStyle}" />

So i can define my columns outside from style as treeview does not have .view property

Hope this helps someone and thanks Rachel for your efforts

Need Your Help

Place two objects at THE SAME spot in css

html css

Let's assume I have 2 objects, em and a button

Why Zend_View_Helper_Url returns relative path when using the default route and absolute path when using a custom route?

zend-framework url zend-route view-helpers

I have an application running on Zend Framework 1.12 and I am using the URL view helper. I also have a few custom routes which I use with the URL helper to clean the code.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.