This is a migrated thread and some comments may be shown as answers.

Changing the src property of an ImageInline

1 Answer 99 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 29 Oct 2012, 05:51 PM
In the application I'm currently developing for, we are using the the WPF RadRichTextBox as an Html editor, in which documents are synced to a server and accessed from many different computers.

In order to handle embedded images (ImageInlines), we associate each image with a content id number, which is stored on the server.  My problem comes into effect when the user downloads a document (along with it's embedded images) from the server, since the content id number is stored in place of the src attribute on the Html <image> tag. The Telerik control parses the image tag fine, and simple displays an image placeholder due to the content id being an invalid path, so I loop through the Document's ImageInlines and replace the src attribute with a proper filepath:
           
IEnumerable<ImageInline> inlines = document.EnumerateChildrenOfType<ImageInline>();
foreach (ImageInline image in inlines)
{
    image.UriSource = new Uri(GetLocalPath(image.UriSource.AbsolutePath);
}

The problem then is that the RichTextBox control doesn't seem to update to show the image at the given path (even though I have verified, by exporting and inspecting the Html, that the src attribute points to a valid image file).  Is there some sort of "force update" that I need to perform, or perhaps a step I'm missing? Or is there possibly just a better way of doing something along these lines?

Thanks,
Chris Covert

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 31 Oct 2012, 04:54 PM
Hi Chris,

I tested this scenario but was unable to reproduce the behavior you are observing. Please find attached a sample solution demonstrating that a change in the UriSource of an image takes affect immediately. 

That said, I suggest you open a support ticket and send us a sample solution with the mentioned by you implementation, so we can investigate further. Thank you in advance!
 
All the best,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Christopher
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or