I want to write an HTML Editor. For this I want to have a MenuItem "New", which opens a WPF WebBrowser Control in a Dockpanel when it is clicked. Since now, I implement this function with CodeBehind. So my XML Code looks like this:
<Window x:Class="WpfApplication4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="661.94" Width="781.716">
    <DockPanel x:Name="DockPanel1" HorizontalAlignment="Left" Height="629" 
               LastChildFill="False" VerticalAlignment="Top" Width="772">
        <Menu DockPanel.Dock="Top" HorizontalAlignment="Right" Width="772">
            <MenuItem Header="_Webseite">
                <MenuItem Header="_Neu" Click="Neu_Click" />
                <MenuItem Header="_Öffnen" Click="Oeffnen_Click"/>
                <MenuItem Header="_Speichern" Click="Speichern_Click"/>
                <Separator HorizontalAlignment="Left" Width="145"/>
                <MenuItem Header="_Schließen" HorizontalAlignment="Left" Width="145"/>
            </MenuItem>
            <MenuItem Header="_Tools">
                <MenuItem Header="_Button" Click="Select_Button"> </MenuItem>
            </MenuItem>
        </Menu>
        <StackPanel></StackPanel>
    </DockPanel>
And in the Code behind there is the following function implemented:
public partial class MainWindow : Window
{
    public static IHTMLDocument2 doc;
    public volatile WebBrowser webBrowser;
    public MainWindow()
    {
        InitializeComponent();
    }
    private void Neu_Click(object sender, RoutedEventArgs e)
    {
        // create new WebBrowser for editing
        webBrowser = new WebBrowser();
        DockPanel.SetDock(webBrowser, Dock.Top);
        this.DockPanel1.Children.Add(webBrowser);
        string text = "<html><body></body></html>";
        File.WriteAllText(@"C:\tmp\file.html", text);
        webBrowser.Navigate("file:///C:/tmp/file.html");
        doc = webBrowser.Document as IHTMLDocument2;
        doc.designMode = "On";
    }
But now I want to separate the View and the Model by using the MVVM pattern. Can anyone help me how to do it? I have real problems to understand the MVVM pattern with my Application.
Thanks for helping!