How to change WPF ScrollViewer RepeatButton Height and Width











up vote
1
down vote

favorite












I would like to change the size of the RepeatButton UP and DOWN of a ScrollViewer, to get a touchable size on industrial touch panels.



How can I access these properties?



I was able to change the size of the ScrollViewer globally within a ResourceDictionary like this:



<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsFlicksEnabled" Value="True" />
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Height" Value="{StaticResource widthScrollbarNormal}" />
<Setter Property="MinHeight" Value="{StaticResource widthScrollbarNormal}" />
</Trigger>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Width" Value="{StaticResource widthScrollbarNormal}" />
<Setter Property="MinWidth" Value="{StaticResource widthScrollbarNormal}" />
</Trigger>
</Style.Triggers>




But I cannot find the way to change the RepeatButton size.



Thanks










share|improve this question


























    up vote
    1
    down vote

    favorite












    I would like to change the size of the RepeatButton UP and DOWN of a ScrollViewer, to get a touchable size on industrial touch panels.



    How can I access these properties?



    I was able to change the size of the ScrollViewer globally within a ResourceDictionary like this:



    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
    <Setter Property="Stylus.IsFlicksEnabled" Value="True" />
    <Style.Triggers>
    <Trigger Property="Orientation" Value="Horizontal">
    <Setter Property="Height" Value="{StaticResource widthScrollbarNormal}" />
    <Setter Property="MinHeight" Value="{StaticResource widthScrollbarNormal}" />
    </Trigger>
    <Trigger Property="Orientation" Value="Vertical">
    <Setter Property="Width" Value="{StaticResource widthScrollbarNormal}" />
    <Setter Property="MinWidth" Value="{StaticResource widthScrollbarNormal}" />
    </Trigger>
    </Style.Triggers>




    But I cannot find the way to change the RepeatButton size.



    Thanks










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I would like to change the size of the RepeatButton UP and DOWN of a ScrollViewer, to get a touchable size on industrial touch panels.



      How can I access these properties?



      I was able to change the size of the ScrollViewer globally within a ResourceDictionary like this:



      <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
      <Setter Property="Stylus.IsFlicksEnabled" Value="True" />
      <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
      <Setter Property="Height" Value="{StaticResource widthScrollbarNormal}" />
      <Setter Property="MinHeight" Value="{StaticResource widthScrollbarNormal}" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
      <Setter Property="Width" Value="{StaticResource widthScrollbarNormal}" />
      <Setter Property="MinWidth" Value="{StaticResource widthScrollbarNormal}" />
      </Trigger>
      </Style.Triggers>




      But I cannot find the way to change the RepeatButton size.



      Thanks










      share|improve this question













      I would like to change the size of the RepeatButton UP and DOWN of a ScrollViewer, to get a touchable size on industrial touch panels.



      How can I access these properties?



      I was able to change the size of the ScrollViewer globally within a ResourceDictionary like this:



      <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
      <Setter Property="Stylus.IsFlicksEnabled" Value="True" />
      <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
      <Setter Property="Height" Value="{StaticResource widthScrollbarNormal}" />
      <Setter Property="MinHeight" Value="{StaticResource widthScrollbarNormal}" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
      <Setter Property="Width" Value="{StaticResource widthScrollbarNormal}" />
      <Setter Property="MinWidth" Value="{StaticResource widthScrollbarNormal}" />
      </Trigger>
      </Style.Triggers>




      But I cannot find the way to change the RepeatButton size.



      Thanks







      wpf size scrollviewer repeatbutton






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 at 15:37









      almonsin

      61




      61
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          In yout view, in case if is datagrid, add this resource:



          <DataGrid.Resources>
          <Style TargetType="{x:Type ScrollBarStyle}" BasedOn="{StaticResource ScrollBarStyle}"/>
          </DataGrid.Resources>


          Then create all of this styles in styles file (if you don't have it, check how you can create and use one!!):
          (add the normal one, the horizontal and the vertical!



          Normal:



          <!--scroll bar style (normal/large one)-->
          <Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
          <Setter Property="SnapsToDevicePixels" Value="True"/>
          <Setter Property="OverridesDefaultStyle" Value="true"/>
          <Style.Triggers>
          <Trigger Property="Orientation" Value="Horizontal">
          <Setter Property="Width" Value="Auto"/>
          <Setter Property="Height" Value="30"/>
          <Setter Property="MinHeight" Value="0"/>
          <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
          </Trigger>
          <Trigger Property="Orientation" Value="Vertical">
          <Setter Property="Width" Value="30"/>
          <Setter Property="MinWidth" Value="0"/>
          <Setter Property="Height" Value="Auto" />
          <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
          </Trigger>
          </Style.Triggers>
          </Style>


          And for horizontal:



           <!--horizontal scrollbar itself template (normal)-->
          <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
          <Grid >
          <Grid.ColumnDefinitions>
          <ColumnDefinition MaxWidth="30"/>
          <ColumnDefinition Width="0.00001*"/>
          <ColumnDefinition MaxWidth="30"/>
          </Grid.ColumnDefinitions>
          <Border
          Grid.ColumnSpan="3"
          CornerRadius="0"
          Background="#F0F0F0" />
          <RepeatButton
          Grid.Column="0"
          Style="{StaticResource ScrollBarLineButton}"
          Width="Auto"
          Command="ScrollBar.LineLeftCommand"
          Content="M 4 0 L 4 8 L 0 4 Z" />
          <Track
          Name="PART_Track"
          Grid.Column="1"
          IsDirectionReversed="False">
          <Track.DecreaseRepeatButton>
          <RepeatButton
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageLeftCommand" />
          </Track.DecreaseRepeatButton>
          <Track.Thumb>
          <Thumb
          Style="{StaticResource ScrollBarThumb}"
          Margin="1,0,1,0"
          Background="{DynamicResource NormalBrush}"
          BorderBrush="Transparent" />
          </Track.Thumb>
          <Track.IncreaseRepeatButton>
          <RepeatButton
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageRightCommand" />
          </Track.IncreaseRepeatButton>
          </Track>
          <RepeatButton
          Grid.Column="3"
          Style="{StaticResource ScrollBarLineButton}"
          Width="Auto"
          Command="ScrollBar.LineRightCommand"
          Content="M 0 0 L 4 4 L 0 8 Z"/>
          </Grid>
          </ControlTemplate>


          And for vertical:



           <!--vertical scrollbar itself template (normal)-->
          <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
          <Grid >
          <Grid.RowDefinitions>
          <RowDefinition MaxHeight="30"/>
          <RowDefinition Height="0.00001*"/>
          <RowDefinition MaxHeight="30"/>
          </Grid.RowDefinitions>
          <Border
          Grid.RowSpan="3"
          CornerRadius="0"
          Background="#F0F0F0" />
          <RepeatButton
          Grid.Row="0"
          Style="{StaticResource ScrollBarLineButton}"
          Height="Auto"
          Command="ScrollBar.LineUpCommand"
          Content="M 0 4 L 8 4 L 4 0 Z" />
          <Track
          Name="PART_Track"
          Grid.Row="1"
          IsDirectionReversed="true">
          <Track.DecreaseRepeatButton>
          <RepeatButton
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageUpCommand" />
          </Track.DecreaseRepeatButton>
          <Track.Thumb>
          <Thumb
          Style="{StaticResource ScrollBarThumb}"
          Margin="0,1,0,1"
          Background="{DynamicResource NormalBrush}"
          BorderBrush="Transparent" />
          </Track.Thumb>
          <Track.IncreaseRepeatButton>
          <RepeatButton
          Style="{StaticResource ScrollBarPageButton}"
          Command="ScrollBar.PageDownCommand" />
          </Track.IncreaseRepeatButton>
          </Track>
          <RepeatButton
          Grid.Row="3"
          Style="{StaticResource ScrollBarLineButton}"
          Height="Auto"
          Command="ScrollBar.LineDownCommand"
          Content="M 0 0 L 4 4 L 8 0 Z"/>
          </Grid>
          </ControlTemplate>





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434265%2fhow-to-change-wpf-scrollviewer-repeatbutton-height-and-width%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            In yout view, in case if is datagrid, add this resource:



            <DataGrid.Resources>
            <Style TargetType="{x:Type ScrollBarStyle}" BasedOn="{StaticResource ScrollBarStyle}"/>
            </DataGrid.Resources>


            Then create all of this styles in styles file (if you don't have it, check how you can create and use one!!):
            (add the normal one, the horizontal and the vertical!



            Normal:



            <!--scroll bar style (normal/large one)-->
            <Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
            <Setter Property="Width" Value="Auto"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="MinHeight" Value="0"/>
            <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
            <Setter Property="Width" Value="30"/>
            <Setter Property="MinWidth" Value="0"/>
            <Setter Property="Height" Value="Auto" />
            <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
            </Trigger>
            </Style.Triggers>
            </Style>


            And for horizontal:



             <!--horizontal scrollbar itself template (normal)-->
            <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
            <Grid >
            <Grid.ColumnDefinitions>
            <ColumnDefinition MaxWidth="30"/>
            <ColumnDefinition Width="0.00001*"/>
            <ColumnDefinition MaxWidth="30"/>
            </Grid.ColumnDefinitions>
            <Border
            Grid.ColumnSpan="3"
            CornerRadius="0"
            Background="#F0F0F0" />
            <RepeatButton
            Grid.Column="0"
            Style="{StaticResource ScrollBarLineButton}"
            Width="Auto"
            Command="ScrollBar.LineLeftCommand"
            Content="M 4 0 L 4 8 L 0 4 Z" />
            <Track
            Name="PART_Track"
            Grid.Column="1"
            IsDirectionReversed="False">
            <Track.DecreaseRepeatButton>
            <RepeatButton
            Style="{StaticResource ScrollBarPageButton}"
            Command="ScrollBar.PageLeftCommand" />
            </Track.DecreaseRepeatButton>
            <Track.Thumb>
            <Thumb
            Style="{StaticResource ScrollBarThumb}"
            Margin="1,0,1,0"
            Background="{DynamicResource NormalBrush}"
            BorderBrush="Transparent" />
            </Track.Thumb>
            <Track.IncreaseRepeatButton>
            <RepeatButton
            Style="{StaticResource ScrollBarPageButton}"
            Command="ScrollBar.PageRightCommand" />
            </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton
            Grid.Column="3"
            Style="{StaticResource ScrollBarLineButton}"
            Width="Auto"
            Command="ScrollBar.LineRightCommand"
            Content="M 0 0 L 4 4 L 0 8 Z"/>
            </Grid>
            </ControlTemplate>


            And for vertical:



             <!--vertical scrollbar itself template (normal)-->
            <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
            <Grid >
            <Grid.RowDefinitions>
            <RowDefinition MaxHeight="30"/>
            <RowDefinition Height="0.00001*"/>
            <RowDefinition MaxHeight="30"/>
            </Grid.RowDefinitions>
            <Border
            Grid.RowSpan="3"
            CornerRadius="0"
            Background="#F0F0F0" />
            <RepeatButton
            Grid.Row="0"
            Style="{StaticResource ScrollBarLineButton}"
            Height="Auto"
            Command="ScrollBar.LineUpCommand"
            Content="M 0 4 L 8 4 L 4 0 Z" />
            <Track
            Name="PART_Track"
            Grid.Row="1"
            IsDirectionReversed="true">
            <Track.DecreaseRepeatButton>
            <RepeatButton
            Style="{StaticResource ScrollBarPageButton}"
            Command="ScrollBar.PageUpCommand" />
            </Track.DecreaseRepeatButton>
            <Track.Thumb>
            <Thumb
            Style="{StaticResource ScrollBarThumb}"
            Margin="0,1,0,1"
            Background="{DynamicResource NormalBrush}"
            BorderBrush="Transparent" />
            </Track.Thumb>
            <Track.IncreaseRepeatButton>
            <RepeatButton
            Style="{StaticResource ScrollBarPageButton}"
            Command="ScrollBar.PageDownCommand" />
            </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton
            Grid.Row="3"
            Style="{StaticResource ScrollBarLineButton}"
            Height="Auto"
            Command="ScrollBar.LineDownCommand"
            Content="M 0 0 L 4 4 L 8 0 Z"/>
            </Grid>
            </ControlTemplate>





            share|improve this answer

























              up vote
              0
              down vote













              In yout view, in case if is datagrid, add this resource:



              <DataGrid.Resources>
              <Style TargetType="{x:Type ScrollBarStyle}" BasedOn="{StaticResource ScrollBarStyle}"/>
              </DataGrid.Resources>


              Then create all of this styles in styles file (if you don't have it, check how you can create and use one!!):
              (add the normal one, the horizontal and the vertical!



              Normal:



              <!--scroll bar style (normal/large one)-->
              <Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
              <Setter Property="SnapsToDevicePixels" Value="True"/>
              <Setter Property="OverridesDefaultStyle" Value="true"/>
              <Style.Triggers>
              <Trigger Property="Orientation" Value="Horizontal">
              <Setter Property="Width" Value="Auto"/>
              <Setter Property="Height" Value="30"/>
              <Setter Property="MinHeight" Value="0"/>
              <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
              </Trigger>
              <Trigger Property="Orientation" Value="Vertical">
              <Setter Property="Width" Value="30"/>
              <Setter Property="MinWidth" Value="0"/>
              <Setter Property="Height" Value="Auto" />
              <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
              </Trigger>
              </Style.Triggers>
              </Style>


              And for horizontal:



               <!--horizontal scrollbar itself template (normal)-->
              <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
              <Grid >
              <Grid.ColumnDefinitions>
              <ColumnDefinition MaxWidth="30"/>
              <ColumnDefinition Width="0.00001*"/>
              <ColumnDefinition MaxWidth="30"/>
              </Grid.ColumnDefinitions>
              <Border
              Grid.ColumnSpan="3"
              CornerRadius="0"
              Background="#F0F0F0" />
              <RepeatButton
              Grid.Column="0"
              Style="{StaticResource ScrollBarLineButton}"
              Width="Auto"
              Command="ScrollBar.LineLeftCommand"
              Content="M 4 0 L 4 8 L 0 4 Z" />
              <Track
              Name="PART_Track"
              Grid.Column="1"
              IsDirectionReversed="False">
              <Track.DecreaseRepeatButton>
              <RepeatButton
              Style="{StaticResource ScrollBarPageButton}"
              Command="ScrollBar.PageLeftCommand" />
              </Track.DecreaseRepeatButton>
              <Track.Thumb>
              <Thumb
              Style="{StaticResource ScrollBarThumb}"
              Margin="1,0,1,0"
              Background="{DynamicResource NormalBrush}"
              BorderBrush="Transparent" />
              </Track.Thumb>
              <Track.IncreaseRepeatButton>
              <RepeatButton
              Style="{StaticResource ScrollBarPageButton}"
              Command="ScrollBar.PageRightCommand" />
              </Track.IncreaseRepeatButton>
              </Track>
              <RepeatButton
              Grid.Column="3"
              Style="{StaticResource ScrollBarLineButton}"
              Width="Auto"
              Command="ScrollBar.LineRightCommand"
              Content="M 0 0 L 4 4 L 0 8 Z"/>
              </Grid>
              </ControlTemplate>


              And for vertical:



               <!--vertical scrollbar itself template (normal)-->
              <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
              <Grid >
              <Grid.RowDefinitions>
              <RowDefinition MaxHeight="30"/>
              <RowDefinition Height="0.00001*"/>
              <RowDefinition MaxHeight="30"/>
              </Grid.RowDefinitions>
              <Border
              Grid.RowSpan="3"
              CornerRadius="0"
              Background="#F0F0F0" />
              <RepeatButton
              Grid.Row="0"
              Style="{StaticResource ScrollBarLineButton}"
              Height="Auto"
              Command="ScrollBar.LineUpCommand"
              Content="M 0 4 L 8 4 L 4 0 Z" />
              <Track
              Name="PART_Track"
              Grid.Row="1"
              IsDirectionReversed="true">
              <Track.DecreaseRepeatButton>
              <RepeatButton
              Style="{StaticResource ScrollBarPageButton}"
              Command="ScrollBar.PageUpCommand" />
              </Track.DecreaseRepeatButton>
              <Track.Thumb>
              <Thumb
              Style="{StaticResource ScrollBarThumb}"
              Margin="0,1,0,1"
              Background="{DynamicResource NormalBrush}"
              BorderBrush="Transparent" />
              </Track.Thumb>
              <Track.IncreaseRepeatButton>
              <RepeatButton
              Style="{StaticResource ScrollBarPageButton}"
              Command="ScrollBar.PageDownCommand" />
              </Track.IncreaseRepeatButton>
              </Track>
              <RepeatButton
              Grid.Row="3"
              Style="{StaticResource ScrollBarLineButton}"
              Height="Auto"
              Command="ScrollBar.LineDownCommand"
              Content="M 0 0 L 4 4 L 8 0 Z"/>
              </Grid>
              </ControlTemplate>





              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                In yout view, in case if is datagrid, add this resource:



                <DataGrid.Resources>
                <Style TargetType="{x:Type ScrollBarStyle}" BasedOn="{StaticResource ScrollBarStyle}"/>
                </DataGrid.Resources>


                Then create all of this styles in styles file (if you don't have it, check how you can create and use one!!):
                (add the normal one, the horizontal and the vertical!



                Normal:



                <!--scroll bar style (normal/large one)-->
                <Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="OverridesDefaultStyle" Value="true"/>
                <Style.Triggers>
                <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="30"/>
                <Setter Property="MinHeight" Value="0"/>
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
                </Trigger>
                <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="30"/>
                <Setter Property="MinWidth" Value="0"/>
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
                </Trigger>
                </Style.Triggers>
                </Style>


                And for horizontal:



                 <!--horizontal scrollbar itself template (normal)-->
                <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
                <Grid >
                <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="30"/>
                <ColumnDefinition Width="0.00001*"/>
                <ColumnDefinition MaxWidth="30"/>
                </Grid.ColumnDefinitions>
                <Border
                Grid.ColumnSpan="3"
                CornerRadius="0"
                Background="#F0F0F0" />
                <RepeatButton
                Grid.Column="0"
                Style="{StaticResource ScrollBarLineButton}"
                Width="Auto"
                Command="ScrollBar.LineLeftCommand"
                Content="M 4 0 L 4 8 L 0 4 Z" />
                <Track
                Name="PART_Track"
                Grid.Column="1"
                IsDirectionReversed="False">
                <Track.DecreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                <Thumb
                Style="{StaticResource ScrollBarThumb}"
                Margin="1,0,1,0"
                Background="{DynamicResource NormalBrush}"
                BorderBrush="Transparent" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton
                Grid.Column="3"
                Style="{StaticResource ScrollBarLineButton}"
                Width="Auto"
                Command="ScrollBar.LineRightCommand"
                Content="M 0 0 L 4 4 L 0 8 Z"/>
                </Grid>
                </ControlTemplate>


                And for vertical:



                 <!--vertical scrollbar itself template (normal)-->
                <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
                <Grid >
                <Grid.RowDefinitions>
                <RowDefinition MaxHeight="30"/>
                <RowDefinition Height="0.00001*"/>
                <RowDefinition MaxHeight="30"/>
                </Grid.RowDefinitions>
                <Border
                Grid.RowSpan="3"
                CornerRadius="0"
                Background="#F0F0F0" />
                <RepeatButton
                Grid.Row="0"
                Style="{StaticResource ScrollBarLineButton}"
                Height="Auto"
                Command="ScrollBar.LineUpCommand"
                Content="M 0 4 L 8 4 L 4 0 Z" />
                <Track
                Name="PART_Track"
                Grid.Row="1"
                IsDirectionReversed="true">
                <Track.DecreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                <Thumb
                Style="{StaticResource ScrollBarThumb}"
                Margin="0,1,0,1"
                Background="{DynamicResource NormalBrush}"
                BorderBrush="Transparent" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton
                Grid.Row="3"
                Style="{StaticResource ScrollBarLineButton}"
                Height="Auto"
                Command="ScrollBar.LineDownCommand"
                Content="M 0 0 L 4 4 L 8 0 Z"/>
                </Grid>
                </ControlTemplate>





                share|improve this answer












                In yout view, in case if is datagrid, add this resource:



                <DataGrid.Resources>
                <Style TargetType="{x:Type ScrollBarStyle}" BasedOn="{StaticResource ScrollBarStyle}"/>
                </DataGrid.Resources>


                Then create all of this styles in styles file (if you don't have it, check how you can create and use one!!):
                (add the normal one, the horizontal and the vertical!



                Normal:



                <!--scroll bar style (normal/large one)-->
                <Style x:Key="ScrollBarStyle" TargetType="{x:Type ScrollBar}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="OverridesDefaultStyle" Value="true"/>
                <Style.Triggers>
                <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="30"/>
                <Setter Property="MinHeight" Value="0"/>
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
                </Trigger>
                <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="30"/>
                <Setter Property="MinWidth" Value="0"/>
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
                </Trigger>
                </Style.Triggers>
                </Style>


                And for horizontal:



                 <!--horizontal scrollbar itself template (normal)-->
                <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
                <Grid >
                <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="30"/>
                <ColumnDefinition Width="0.00001*"/>
                <ColumnDefinition MaxWidth="30"/>
                </Grid.ColumnDefinitions>
                <Border
                Grid.ColumnSpan="3"
                CornerRadius="0"
                Background="#F0F0F0" />
                <RepeatButton
                Grid.Column="0"
                Style="{StaticResource ScrollBarLineButton}"
                Width="Auto"
                Command="ScrollBar.LineLeftCommand"
                Content="M 4 0 L 4 8 L 0 4 Z" />
                <Track
                Name="PART_Track"
                Grid.Column="1"
                IsDirectionReversed="False">
                <Track.DecreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                <Thumb
                Style="{StaticResource ScrollBarThumb}"
                Margin="1,0,1,0"
                Background="{DynamicResource NormalBrush}"
                BorderBrush="Transparent" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton
                Grid.Column="3"
                Style="{StaticResource ScrollBarLineButton}"
                Width="Auto"
                Command="ScrollBar.LineRightCommand"
                Content="M 0 0 L 4 4 L 0 8 Z"/>
                </Grid>
                </ControlTemplate>


                And for vertical:



                 <!--vertical scrollbar itself template (normal)-->
                <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
                <Grid >
                <Grid.RowDefinitions>
                <RowDefinition MaxHeight="30"/>
                <RowDefinition Height="0.00001*"/>
                <RowDefinition MaxHeight="30"/>
                </Grid.RowDefinitions>
                <Border
                Grid.RowSpan="3"
                CornerRadius="0"
                Background="#F0F0F0" />
                <RepeatButton
                Grid.Row="0"
                Style="{StaticResource ScrollBarLineButton}"
                Height="Auto"
                Command="ScrollBar.LineUpCommand"
                Content="M 0 4 L 8 4 L 4 0 Z" />
                <Track
                Name="PART_Track"
                Grid.Row="1"
                IsDirectionReversed="true">
                <Track.DecreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                <Thumb
                Style="{StaticResource ScrollBarThumb}"
                Margin="0,1,0,1"
                Background="{DynamicResource NormalBrush}"
                BorderBrush="Transparent" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                <RepeatButton
                Style="{StaticResource ScrollBarPageButton}"
                Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>
                </Track>
                <RepeatButton
                Grid.Row="3"
                Style="{StaticResource ScrollBarLineButton}"
                Height="Auto"
                Command="ScrollBar.LineDownCommand"
                Content="M 0 0 L 4 4 L 8 0 Z"/>
                </Grid>
                </ControlTemplate>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 at 12:28









                Catarina Ferreira

                5691521




                5691521






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434265%2fhow-to-change-wpf-scrollviewer-repeatbutton-height-and-width%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    Alexandru Averescu

                    Trompette piccolo