Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1564
ScrollViewer template problem !
posted

 Hi,

 I have create a custom template for the ScrollViewer and since this :

- The grid only show a few row

- The scrolling does not work very well... by example the "Record tool tips" only display the first row ! 

 Here is the template :

<Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid Background="Red">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ScrollContentPresenter/>

                        <ScrollBar Name="PART_VerticalScrollBar"
                          Grid.Column="1"
                          Value="{TemplateBinding VerticalOffset}"
                          Maximum="{TemplateBinding ScrollableHeight}"
                          ViewportSize="{TemplateBinding ViewportHeight}"
                          Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                       
                        <ScrollBar Name="PART_HorizontalScrollBar"
                          Orientation="Horizontal"
                          Grid.Row="1"
                          Grid.Column="0"
                          Value="{TemplateBinding HorizontalOffset}"
                          Maximum="{TemplateBinding ScrollableWidth}"
                          ViewportSize="{TemplateBinding ViewportWidth}"
                          Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Parents
  • 1564
    Verified Answer
    posted

     I have find the problem, it is in my scrollviewer template :

     I have take a look at the template used in xamDataGrid and find the solution , I have to change the scrollcontentpresenter to :

    <ScrollContentPresenter CanContentScroll="True" Content="{TemplateBinding ScrollViewer.Content}"/> 

Reply Children
No Data