How to open loal file in editor

Oct 9, 2013 at 5:00 AM
Hi

I am sorry I am new to wpf and willing to use this wpf html editor
can any one help me how to load local file in editor

Editor.ContentHtml = ("C:\Program Files\sb\new\template\airplanes1.eml");
Apr 1, 2014 at 12:58 PM
    private void ButtonOpenFile_Click(object sender, RoutedEventArgs e)
    {
        // init the container for the Html
        string contents = string.Empty;

        // Configure open file dialog box
        Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

        // Show open file dialog box
        Nullable<bool> result = dlg.ShowDialog();

        // Process open file dialog box results
        if (result == true)
        {
            // init the input stream
            Stream stream = null;
            // look to see if the file contains any contents and stream
            if ((stream = dlg.OpenFile()) != null)
            {
                using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                {
                    // get the contents as text
                    contents = reader.ReadToEnd();
                }
            }
            // close the input stream
            if (stream != null) stream.Close();

            // if the contents where successfully read write to document
            if (contents != String.Empty)
            {
                Editor.ContentHtml = contents;
            }
        }
    }