I have a WPF MVVM application, in which ScrollViewer contains a user control with multiple Expanders
<UserControl>
<Expander>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
...
</Grid.RowDefinitions>
<Expander Grid.Row="0" />
<Expander Grid.Row="1" />
...
</Grid>
</Expander>
</UserControl>
How could I make expanded Expander to scroll into view so it's content is visible?
Handle the Expanded.Expanded
event in the code behind of the usercontrol and then call `Expander.BringIntoView()'.
Note: there's nothing wrong with using code behind for VIEW-specific things, and thus this does not break MVVM, IMO.