This post has been migrated from www.experimentsincode.com, we apologise if some of the images or content is missing

This post has been migrated, original date 08 Aug 2008 This week I have been working on a new Sheer XAML application for Sitecore. The ability to add applications to the Sitecore client is a powerful tool,  however I noticed that there isn’t a huge amount of information on how to create these applications and this probably puts off a lot of developers. I hope to document some useful bit’s and pieces over the next few weeks but I thought I would start with a simple extension function. If you are dynamically changing the UI of the Sheer application through code you need to send the new HTML to the browser. All the Sitecore controls descend form Sitecore.Web.UI.WebControl. This allows us to create a simple extension function that can be used by any of the Sitecore controls to send back their new HTML output.

24 public static void RefreshHtml(this Sitecore.Web.UI.WebControl control)

25 {

26 Sitecore.Context.ClientPage.ClientResponse.SetOuterHtml(control.ID, control);

27 }

Then to simply update any control in your XAML application you simply call the refresh method:

15 Sitecore.Web.UI.HtmlControls.Listview view = new Sitecore.Web.UI.HtmlControls.Listview();

16 view.RefreshHtml();