Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Wpf.Ui/Controls/ComboBox/ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Decorator
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Margin="{TemplateBinding Padding}"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter.Value>
Expand Down
5 changes: 2 additions & 3 deletions src/Wpf.Ui/Controls/NumberBox/NumberBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@
IsTabStop="False"
Foreground="{TemplateBinding Foreground}" />
<Grid Grid.Column="1" Margin="{TemplateBinding Padding}">
<Decorator
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
Margin="0"
VerticalAlignment="Center"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}" />
<TextBlock
x:Name="PlaceholderTextBox"
Expand Down
10 changes: 4 additions & 6 deletions src/Wpf.Ui/Controls/PasswordBox/PasswordBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Decorator
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
Margin="0"
VerticalAlignment="Center"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</Grid>
</Border>
Expand Down Expand Up @@ -174,10 +173,9 @@
TextElement.Foreground="{TemplateBinding Foreground}" />

<Grid Grid.Column="1" Margin="{TemplateBinding Padding}">
<Decorator
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
Margin="0"
VerticalAlignment="Center"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}" />
<TextBlock
x:Name="PlaceholderTextBox"
Expand Down
26 changes: 3 additions & 23 deletions src/Wpf.Ui/Controls/TextBox/TextBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@
<Thickness x:Key="TextBoxClearButtonPadding">0,0,0,0</Thickness>
<system:Double x:Key="TextBoxClearButtonHeight">24</system:Double>

<!-- TODO: Rework TextBox ScrollViewer -->
<Style x:Key="DefaultTextBoxScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid>
<ScrollContentPresenter Margin="0" CanContentScroll="{TemplateBinding CanContentScroll}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="DefaultTextBoxStyle" TargetType="{x:Type TextBox}">
<!-- Universal WPF UI focus -->
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
Expand Down Expand Up @@ -87,12 +70,11 @@
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
VerticalAlignment="Center"
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
Style="{StaticResource DefaultTextBoxScrollViewerStyle}"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
</Grid>
Expand Down Expand Up @@ -171,12 +153,11 @@
<Grid Grid.Column="1" Margin="{TemplateBinding Padding}">
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
VerticalAlignment="Center"
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
Style="{StaticResource DefaultTextBoxScrollViewerStyle}"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
<TextBlock
Expand Down Expand Up @@ -309,12 +290,11 @@
<Grid Margin="{TemplateBinding Padding}">
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
VerticalAlignment="Center"
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
Style="{StaticResource DefaultTextBoxScrollViewerStyle}"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
</Grid>
Expand Down
26 changes: 26 additions & 0 deletions src/Wpf.Ui/Resources/DefaultTextBoxScrollViewerStyle.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<!-- TODO: Rework TextBox ScrollViewer -->
<Style x:Key="DefaultTextBoxScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="CanContentScroll" Value="False" />
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
<Setter Property="IsDeferredScrollingEnabled" Value="False" />
<Setter Property="VerticalScrollBarVisibility" Value="Hidden" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid>
<ScrollContentPresenter Margin="0" CanContentScroll="{TemplateBinding CanContentScroll}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
1 change: 1 addition & 0 deletions src/Wpf.Ui/Resources/Wpf.Ui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/Palette.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/DefaultContextMenu.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/DefaultFocusVisualStyle.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Resources/DefaultTextBoxScrollViewerStyle.xaml" />

<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Controls/Anchor/Anchor.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Controls/AutoSuggestBox/AutoSuggestBox.xaml" />
Expand Down