Changing the src property of an ImageInline

2 posts, 0 answers
  1. Christopher
    Christopher avatar
    1 posts
    Member since:
    Jul 2012

    Posted 29 Oct 2012 Link to this post

    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?

    Chris Covert
  2. Petya
    Petya avatar
    983 posts

    Posted 31 Oct 2012 Link to this post

    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,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top