//Insert an image into the RichTextBox private void btnImage_Click(object sender, RoutedEventArgs e) { InlineUIContainer container = new InlineUIContainer(); container.Child = TextControl.createImageFromUri(new Uri("/SilverlightTextEditor;component/images/Desert.jpg", UriKind.RelativeOrAbsolute), 200, 150); rtb.Selection.Insert(container); ReturnFocus(); }
//Make the RichTextBox read-only public void btnRO_Checked(object sender, RoutedEventArgs e) { rtb.IsReadOnly = !rtb.IsReadOnly; //Set the button image based on the state of the toggle button. if (rtb.IsReadOnly) { btnRO.Content = TextControl.createImageFromUri(new Uri("/SilverlightTextEditor;component/images/view.png", UriKind.RelativeOrAbsolute), 29, 32); } else { btnRO.Content = TextControl.createImageFromUri(new Uri("/SilverlightTextEditor;component/images/edit.png", UriKind.RelativeOrAbsolute), 29, 32); } ReturnFocus(); }