I also ran into this problem. In my case, I need a single-line editor. I understand this is already implemented in the next release cycle, but I cannot delay until then. I was able to get it down to one-line using WordWrapMode and KeyDown handling, but the scrollbars were still there.
I first tried the suggestion of using an implicit style resource to collapse the scrollbars. This made them hidden but just left some empty space instead (which isn't any better).
I ended up using Snoop to dig into the visual tree and figure out the structure here. Since those scrollbars (and a corner box) are embedded in a Grid, simply collapsing them is not enough. I was however able to write a simple control that inherits from SyntaxEditor and hacks through the visual tree to fully hide the scrollbars.
Your mileage may vary. Also, if the visual tree structure changes at all then this code might break. Then again, it shouldn't be needed after the next release:
internal class SingleLineSyntaxEditor : ActiproSoftware.Windows.Controls.SyntaxEditor.SyntaxEditor
{
private static TChild[] GetChildren<TChild>(DependencyObject parent) where TChild : DependencyObject
{
var list = new List<TChild>();
var cnt = VisualTreeHelper.GetChildrenCount(parent);
for (var ix = 0; ix < cnt; ix++)
{
var child = VisualTreeHelper.GetChild(parent, ix) as TChild;
if (child == null)
continue;
list.Add(child);
}
return list.ToArray();
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var adorner = GetChildren<AdornerDecorator>(this).FirstOrDefault();
if (adorner == null)
return;
var outerBorder = adorner.Child;
if (outerBorder == null)
return;
var viewHost = GetChildren<EditorViewHost>(outerBorder).FirstOrDefault();
if (viewHost == null)
return;
var view = GetChildren<EditorView>(viewHost).FirstOrDefault();
if (view == null)
return;
var outerGrid = view.Content as Grid;
if (outerGrid == null)
return;
var innerGrid = GetChildren<Grid>(outerGrid).FirstOrDefault();
if (innerGrid == null)
return;
var allOuterGridChildren = GetChildren<UIElement>(outerGrid);
var peers = allOuterGridChildren.Except(new[] {innerGrid}).ToArray();
foreach (var peer in peers)
{
peer.SetValue(VisibilityProperty, Visibility.Collapsed);
}
innerGrid.SetValue(Grid.RowProperty, 0);
innerGrid.SetValue(Grid.ColumnProperty, 0);
innerGrid.SetValue(Grid.RowSpanProperty, 4);
innerGrid.SetValue(Grid.ColumnSpanProperty, 4);
}
}