My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
5 hours ago: If you are a developer in Berlin and need to improve your English, I'm looking for groups to teach after work: http://tanguay.info/itenglish.
6 hours ago: As far as I'm concerned, the singularity is already here, every time I wake up twitter tells me something amazing was created while I slept.
6 hours ago: We're not suffering from information overload, we're suffering from faulty filtering.
7 hours ago: Classic literature for free as nicely formatted 1-page or 2-page PDF downloads: http://www.planetebook.com/free-ebooks.asp.
7 hours ago: Yes, when you pour coffee, "a lightning storm of neuronal activity occurs almost across the entire brain": http://is.gd/eWO1T @pholdings.
23 hours ago: If you put two spaces after a period or use underlining for emphasis, you were born before 1980.
24 hours ago: Word of the day: infovore, n. an animal with a voracious appetite for information.
yesterday: It's said that on average people use less than 10% of their brain, but I think on average computers use less than 1% of their CPU.
2 days ago: Saturday fun: team drawing on two computers with six-year-old in a shared google doc diagram.
2 days ago: Someday I want to produce a developer podcast called "What's that?" but for now "the developer's life" is a nice genre: http://is.gd/eTURO.
3 days ago: Here's a use-case for datapod format, recording human-readable data that later can be used as a datasource: http://is.gd/eSsLg @pholdings.
WPF CODE EXAMPLE created on Sunday, February 14, 2010 permalink
How to make a scrollable StackPanel that changes its content but keeps scroll position
This example shows how you can full rebuild and replace a StackPanel but first save the position of the scrollbar before and setting it back to that position afterward, to the user it looks as if only the content changed.
XAML:
<Window x:Class="Testsv2343.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="310" Width="300">
    <StackPanel Margin="10">
        <Border Background="#ddd" CornerRadius="5" Padding="10">
            <ContentControl x:Name="TheForm"/>
        </Border>
        <StackPanel Orientation="Horizontal">
            <StackPanel HorizontalAlignment="Left" Margin="0 5 5 5">
                <Button Content="English" Click="Button_Click_English"/>
            </StackPanel>
            <StackPanel HorizontalAlignment="Left" Margin="0 5 5 5">
                <Button Content="German" Click="Button_Click_German"/>
            </StackPanel>
        </StackPanel>
        <TextBlock Text="{Binding Message}"/>
    </StackPanel>
</Window>
Code Behind:
using System.Windows;
using System.Windows.Controls;
using System.ComponentModel;

namespace Testsv2343
{
    public partial class Window1 : Window, INotifyPropertyChanged
    {
        #region ViewModelProperty: Message
        private string _message;
        public string Message
        {
            get
            {
                return _message;
            }

            set
            {
                _message = value;
                OnPropertyChanged("Message");
            }
        }
        
NO_GRAPHIC: customImages/itemTypes/codeExamples/endregion.*

        private ScrollViewer scrollViewer;
        private double scrollBarPosition = 0;

        private string englishLine = "this is line ";
        private string germanLine = "das ist Zeile ";

        public Window1()
        {
            InitializeComponent();
            DataContext = this;

            CreateForm(englishLine);

        }

        #region INotifiedProperty Block
        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        
NO_GRAPHIC: customImages/itemTypes/codeExamples/endregion.*

        void CreateForm(string text)
        {

            StackPanel sp = new StackPanel();

            for (int i = 0; i < 100; i++)
            {
                TextBlock tb = new TextBlock();
                tb.Text = text + i.ToString();
                sp.Children.Add(tb);
            }

            scrollViewer = new ScrollViewer();
            scrollViewer.Content = sp;
            scrollViewer.Height = 200;
            scrollViewer.ScrollToVerticalOffset(scrollBarPosition);

            TheForm.Content = scrollViewer;
        }

        private void Button_Click_English(object sender, RoutedEventArgs e)
        {
            scrollBarPosition = scrollViewer.VerticalOffset;
            CreateForm(englishLine);
        }

        private void Button_Click_German(object sender, RoutedEventArgs e)
        {
            scrollBarPosition = scrollViewer.VerticalOffset;
            CreateForm(germanLine);
        }

    }
}
need markup?