Skip to content

Commit ae6d86c

Browse files
committed
fixed vertical scrolling
1 parent 5121a34 commit ae6d86c

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

CutCode/App.xaml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,9 @@
4747
<Setter.Value>
4848
<ControlTemplate TargetType="{x:Type Thumb}">
4949
<Grid x:Name="Grid">
50-
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent"/>
5150
<Border x:Name="Rectangle1" CornerRadius="5" HorizontalAlignment="Stretch"
5251
VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}"/>
5352
</Grid>
54-
<ControlTemplate.Triggers>
55-
<Trigger Property="Tag" Value="Horizontal">
56-
<Setter TargetName="Rectangle1" Property="Width" Value="Auto"/>
57-
<Setter TargetName="Rectangle1" Property="Height" Value="7"/>
58-
</Trigger>
59-
</ControlTemplate.Triggers>
6053
</ControlTemplate>
6154
</Setter.Value>
6255
</Setter>
@@ -67,16 +60,9 @@
6760
<Setter.Value>
6861
<ControlTemplate TargetType="{x:Type Thumb}">
6962
<Grid x:Name="Grid">
70-
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent"/>
7163
<Border x:Name="Rectangle1" CornerRadius="5" HorizontalAlignment="Stretch"
7264
VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}"/>
7365
</Grid>
74-
<ControlTemplate.Triggers>
75-
<Trigger Property="Tag" Value="Horizontal">
76-
<Setter TargetName="Rectangle1" Property="Width" Value="Auto"/>
77-
<Setter TargetName="Rectangle1" Property="Height" Value="7"/>
78-
</Trigger>
79-
</ControlTemplate.Triggers>
8066
</ControlTemplate>
8167
</Setter.Value>
8268
</Setter>
@@ -142,9 +128,8 @@
142128
</Style>
143129

144130
<!-- ScrollViewer -->
145-
<Style x:Key="ScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
131+
<Style x:Key="ScrollViewerStyle" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource {x:Type ScrollViewer}}">
146132
<Setter Property="OverridesDefaultStyle" Value="True"/>
147-
<Setter Property="FlowDirection" Value="LeftToRight"/>
148133
<Setter Property="Template">
149134
<Setter.Value>
150135
<ControlTemplate TargetType="{x:Type ScrollViewer}">

CutCode/Controllers/BindableAvalonEditor.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ public class BindableAvalonEditor : ICSharpCode.AvalonEdit.TextEditor, INotifyPr
1717
protected override void OnTextChanged(EventArgs e)
1818
{
1919
base.OnTextChanged(e);
20-
Text = Document.Text;
20+
Text = Document.Text;
21+
22+
double vertOffset = (this.TextArea.TextView.DefaultLineHeight) * this.Document.LineCount;
23+
this.ScrollToVerticalOffset(vertOffset);
2124
}
2225
public new string Text
2326
{
@@ -42,7 +45,7 @@ protected override void OnTextChanged(EventArgs e)
4245
DefaultValue = "",
4346
BindsTwoWayByDefault = true,
4447
PropertyChangedCallback = OnDependencyPropertyChanged
45-
}
48+
}
4649
);
4750

4851
protected static void OnDependencyPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)

CutCode/Views/AddView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@
133133
ShowLineNumbers="True"
134134
LineNumbersForeground="{Binding textBoxForeground}"
135135
ScrollViewer.CanContentScroll="True"
136-
ScrollViewer.HorizontalScrollBarVisibility="Visible"
137-
ScrollViewer.VerticalScrollBarVisibility="Visible"
136+
ScrollViewer.HorizontalScrollBarVisibility="Auto"
137+
ScrollViewer.VerticalScrollBarVisibility="Auto"
138138
Text="{Binding code}"
139139
SyntaxHighlighting="{Binding CurrentLang, Converter={StaticResource HighlightingDefinitionConverter}}"/>
140140
</Border>

0 commit comments

Comments
 (0)