Question: I'm using a the TreeView control and it scrolls automatically to left-align TreeViewItem when one of them is clicked. I've gone looking at my Styles and ControlTemplates, but I haven't found anything. Is there a default ControlTemplate that causes this? I want to disable it.

Answer: 
The items scroll because the ScrollViewer calls BringIntoView() on them. So one way to avoid scrolling is to suppress the handling of the RequestBringIntoView event. You can try that out quickly by subclassing TreeView and instantiating this control instead:

```
public class NoScrollTreeView : TreeView
{
    public class NoScrollTreeViewItem : TreeViewItem
    {
        public NoScrollTreeViewItem() : base()
        {
            this.RequestBringIntoView += delegate (object sender, RequestBringIntoViewEventArgs e) {
                e.Handled = true;
            };
        }

        protected override DependencyObject GetContainerForItemOverride()
        {
            return new NoScrollTreeViewItem();
        }
    }
    protected override DependencyObject GetContainerForItemOverride()
    {
        return new NoScrollTreeViewItem();
    }
}

```
after spending some hours on this problem i found a solution that works for me.

brians solution to prevent the RequestBringIntoView event on a TreeViewItem from bubbling was the first step. unfortunately this also stops a treeviewitem to be shown if you change the selected item programmatically by

```
yourtreeview.SelectedItem = yourtreeviewitem

```

so, for me the solution is to modify the controltemplate of the treeview as follows:

```
<Style x:Key="{x:Type TreeView}" TargetType="TreeView">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TreeView">
                    <Border Name="Border" BorderThickness="0" Padding="0" Margin="1">
                        <ScrollViewer Focusable="False" CanContentScroll="False" Padding="0">
                            <Components:AutoScrollPreventer Margin="0">
                                <ItemsPresenter/>
                            </Components:AutoScrollPreventer>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

```

the "autoscrollpreventer" is:

```
using System;
using System.Windows;
using System.Windows.Controls;

namespace LiveContext.Designer.GUI.Components {
    public class AutoScrollPreventer : StackPanel
    {
    public AutoScrollPreventer() {

        this.RequestBringIntoView += delegate(object sender, RequestBringIntoViewEventArgs e)
        {
            // stop this event from bubbling so that a scrollviewer doesn't try to BringIntoView..
            e.Handled = true;
        };

    }
}

```

}

hope it helps..