3

How to add images to text? I use AvalonEdit.

It must be like this:

enter image description here

XAML

<Button Click="ImageOpenDialog">/></Button>

<avalonEdit:TextEditor
            Name="textEditor"
            FontFamily="Consolas"
            FontSize="10pt"
            SyntaxHighlighting="C#"
        >Welcome to AvalonEdit!
        </avalonEdit:TextEditor>

C#

public void ImageOpenDialog(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = ""; // Default file name
            dlg.DefaultExt = ".jpg"; // Default file extension
            dlg.Filter = "Text documents|*.jpg"; // Filter files by extension

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

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;

            }
        }

It received the name of the image.

What to do next?

code211218
  • 127
  • 2
  • 6

0 Answers0