Theming Scroll SyntaxEditor

SyntaxEditor for WPF Forum

Posted 7 years ago by Vlad
Version: 12.2.0570
Avatar

Hi! 

How can i customize ScrollViewer and ScrollBar styles? 

see this picture 

Comments (3)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Vlad,

They are regular WPF ScrollBars so you can make an implicit Style that targets them to change their appearance.  And the square between them is a ScrollBarBlock control.  You can make an implicit Style for that which sets its Background to something else.


Actipro Software Support

Posted 7 years ago by Vlad
Avatar

Thanks for your answer. But i steel have a questions:

 1. I override default style of WPF ScrollBar. It workd, but not completely:

<Style TargetType="{x:Type ScrollBar}">
        <Setter Property="Background" Value="{StaticResource ScrollBar.Background}}" />
        <Setter Property="ContextMenu.Visibility" Value="Collapsed" />
        <Setter Property="MinWidth" Value="{StaticResource ScrollBar.MinWidth}" />
        <Setter Property="Width" Value="{StaticResource ScrollBar.Width}" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="ClipToBounds" Value="False" />
        <Setter Property="Opacity" Value="0.3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Border Margin="{StaticResource ScrollBar.Margin}" Background="{TemplateBinding Background}">
                        <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
                            <Track.DecreaseRepeatButton>
                                <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButtonStyle}" />
                            </Track.DecreaseRepeatButton>
                            <Track.IncreaseRepeatButton>
                                <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButtonStyle}" />
                            </Track.IncreaseRepeatButton>
                            <Track.Thumb>
                                <Thumb Margin="1,0" Style="{StaticResource ScrollBarThumbVertical}" />
                            </Track.Thumb>
                        </Track>
                    </Border>               
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

 For example, I can change Background, but Template does not apply

 
2. How can i apply custom ComboBox style to NavigableSymbolSelector?

I found this thread, but have you example how to use it? 

And when i extract style of NavigableSymbolSelector in Expression Blend 4, it works, but combobox bindings are lost

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Vlad,

1) I just added this to my app's Resources and it worked fine for replacing the template:

<Style TargetType="ScrollBar">
	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate TargetType="ScrollBar">
				<Rectangle MinHeight="20" MinWidth="20" Fill="Red" />
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style>

If that doesn't work for you then you probably have some other style defined that is overriding it.

2) You can't reliably copy styles from Blend.  You should copy them from our default styles directly if you are a customer.

But anyhow, if you are just trying to update how the ComboBox looks, make a Style whose x:Key="{x:Static themes:SharedResourceKeys.ToolBarEmbeddedComboBoxStyleKey}" and targets ComboBox and put that in your app Resources.  That should get it working.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.