Hello,
I want to style a vertical scrollbar for my textbox.
I am NOT allowed to add/use a style that is automatically used for all textboxes,
or scrollviewers, because I am not allowed to override anything common.
So I need a style with a key/name I can use for each textbox (or not).
Here my XAML code for styling the textbox:
<Style x:Key="PortalTextBox" TargetType="{x:Type TextBox}">
<setter property="OverridesDefaultStyle" value="true" />
<setter property="AllowDrop" value="true" />
<setter property="MinWidth" value="0" />
<setter property="MinHeight" value="0" />
<setter property="FocusVisualStyle" value="{x:Null}" />
<setter property="Template">
<setter.value>
<controltemplate targettype="{x:Type TextBox}">
<!--<scrollviewer focusable="false" removed="Transparent" x:name="PART_ContentHost" horizontalscrollbarvisibility="Hidden" verticalscrollbarvisibility="Hidden" style="{StaticResource {ComponentResourceKey ResourceId=PortalScrollViewer, TypeInTargetAssembly=SiControls:SiCResourceKeys}}" xmlns:x="#unknown" />-->
<!--<scrollcontentpresenter x:name="PART_ScrollContentPresenter" cancontentscroll="{TemplateBinding CanContentScroll}" canhorizontallyscroll="False" canverticallyscroll="False" contenttemplate="{TemplateBinding ContentTemplate}" content="{TemplateBinding Content}" grid.column="0" margin="{TemplateBinding Padding}" grid.row="0" xmlns:x="#unknown" />-->
<scrollbar x:name="PART_VerticalScrollBar" automationproperties.automationid="VerticalScrollBar" cursor="Arrow" grid.column="1" minimum="0" grid.row="0" visibility="{TemplateBinding VerticalScrollBarVisibility}" value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" viewportsize="{TemplateBinding ActualHeight}" style="{StaticResource {ComponentResourceKey ResourceId=PortalVerticalScrollBarStyle, TypeInTargetAssembly=SiControls:SiCResourceKeys}}" xmlns:x="#unknown" />
</controltemplate>
</setter.value>
</setter>
</Style>
I have already Styles for PortalVerticalScrollBarStyle and PortalHorizontalScrollBarStyle which are working (on a ScrollViewer).
I try to style the Textbox then:
<textbox x:name="txtAdditionalInstructions" horizontalalignment="Stretch" verticalalignment="Stretch" uselayoutrounding="True" fontsize="16" text="{Binding CurrentOrder.AdditionalInstructions, ElementName=AddExtraInformation}" height="322" acceptsreturn="True" acceptstab="True" margin="4,0,0,0" borderthickness="0" horizontalscrollbarvisibility="Hidden" verticalscrollbarvisibility="Auto" width="316" textwrapping="Wrap" style="{DynamicResource {ComponentResourceKey ResourceId=PortalTextBox, TypeInTargetAssembly=SiControls:SiCResourceKeys}}" xmlns:x="#unknown"></textbox>
But somehow it is not working.
I am also not sure for the texbox how the PART_Scroll.. stuff must look like.
Any idea what I am doing wrong? Thanks a lot!