Q:

How do I scroll so a control is visible after expanding a Expander

I have several Expander controls in a wpf usercontrol.
When I expand the Expanders I want to automatically scroll so that the whole Expander is visible, if possible. Or atleast so the newly expanded Expander is as far 'up' as possible.
When i do it now on the bottom one it expands below the window edge and I cant see the controls in the expander without manually scrolling to them.
And i want to do this from XAML and not the codebehind.
It that possible?
Im using a MVVM pattern.
Im assuming that i have to use a Trigger on the Expander but i have no idea how to preform the BringToView functionality
Highlevel layout:
<ScrollViewer>
  <UserControl>
    <Grid>
      <Expander>
        ...
      </Expander>
      <Expander>
        ...
      </Expander>
      <Expander>
        ...
      </Expander>
    </Grid>
  </UserControl>
</ScrollViewer>

A:

Handle Expanded event and call BringIntoView() method:
private void Expander_Expanded(object sender, RoutedEventArgs e)
{
    ((Expander)sender).BringIntoView();
}

Please note that you should use StackPanel or something else instead of Grid:
<ScrollViewer Name="sv">
    <UserControl>
        <StackPanel>
            <Expander>
                <Border Height="1000" Background="Red"/>
            </Expander>
            <Expander>
                <Border Height="1000" Background="Blue"/>
            </Expander>
            <Expander Expanded="Expander_Expanded">
                <Border Height="1000" Background="Green"/>
            </Expander>
        </StackPanel>
    </UserControl>
</ScrollViewer>

Edit
You might want to use this attached property:
public static class ExpanderEx
{
    public static readonly DependencyProperty BringIntoViewOnExpandProperty =
                           DependencyProperty.RegisterAttached("BringIntoViewOnExpand", 
                                typeof(bool), typeof(ExpanderEx), 
                                new PropertyMetadata(false, OnBringIntoViewOnExpandChanged));

    public static bool GetBringIntoViewOnExpand(DependencyObject obj)
    {
        return (bool)obj.GetValue(BringIntoViewOnExpandProperty);
    }
    public static void SetBringIntoViewOnExpand(DependencyObject obj, bool value)
    {
        obj.SetValue(BringIntoViewOnExpandProperty, value);
    }  
    private static void OnBringIntoViewOnExpandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        if (d is Expander)
        {
            Expander obj = (Expander)d;
            if (e.NewValue.Equals(true)) 
                obj.Expanded += Obj_Expanded; 
            else
                obj.Expanded -= Obj_Expanded;
        }
    }

    private static void Obj_Expanded(object sender, RoutedEventArgs e)
    {
        ((Expander)sender).BringIntoView();
    }
}

and in Xaml:
<ScrollViewer Name="sv">
    <UserControl>
        <StackPanel>
            <Expander local:ExpanderEx.BringIntoViewOnExpand="True">
                <Border Height="1000" Background="Red"/>
            </Expander>
            <Expander local:ExpanderEx.BringIntoViewOnExpand="True">
                <Border Height="1000" Background="Blue"/>
            </Expander>
            <Expander local:ExpanderEx.BringIntoViewOnExpand="True">
                <Border Height="1000" Background="Green"/>
            </Expander>
        </StackPanel>
    </UserControl>
</ScrollViewer>

