Silverlight Plugin Crashes - Customer Designer Class - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Silverlight Plugin Crashes - Customer Designer Class

  • Silverlight Plugin Crashes - Customer Designer Class
  • I added a few more custom designer class fields to the CoverFlow sample:
    RotationY="Binding RotationY"
    DistanceBetweenItems="Binding DistanceBetweenItems"
    DistanceFromSelectedItem="Binding DistanceFromSelectedItem"
    OffsetX="Binding OffSetX"

    The silverlight control shows up fine when loading the page normal, but when editing the page itself the page freezes for a moment and I receive a message saying silverlight plugin crashed (FF 3.6), what could be causing this?
  • 220206_projectproperties.png
    Hello Kristian,

    Thank you for using our services.

    Can you please enable Silverlight debugging from the web application project's properties (as in attached image)? This will allow you to see the actual exception being thrown from the Silverligh control. You can also put a break point on the Application_UnhandledException method in App.xaml.cs and see the exception when the control breaks in page edit mode.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  • Ah, in my designer when you put the control in place all of the setting i allow the user to change are initially set to 0 and some of the end up breaking the control, e.g ImageHeight, ImageWidth.

    I tried setting a value in coverflowdesigner.ascx but they still show up as 0, how would i setup an inital value? 


    <label for="ImageHeight">Image Height</label
    <input type="text" id="ImageHeight" class="sfTxt" value="300" /> 



  • Hello Kristian,

    Thank you for getting back to me.

    For this you will have to take an approach similar to the one used for passing the images collection. Bellow are the steps you have to take to pass settings to the Silverlight control:

    1) Expose public properties in the CoverFlowWidget control which will set the image width and height:
    [Category("CoverFlow Settings")]
    public double ImageHeight get; set;
    [Category("CoverFlow Settings")]
    public double ImageWidth get; set;

    2) When the collection of images is constructed add those settings to the hash table representing this collection:
    private List<Hashtable> GetImages()
        List<Hashtable> results = new List<Hashtable>();
        //get  IQueryable of images from the Fluent API.
        var images = App.WorkWith().Images()
            (w) => w.Album.Title == this.AlbumTitle &&
                   w.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
        var authority = this.GetAuthorityUrl();
        foreach (Telerik.Sitefinity.Libraries.Model.Image v in images)
            Hashtable table = new Hashtable();
            table.Add("Url", authority + v.MediaUrl);
            table.Add("Title", v.Title.ToString());
            table.Add("Width", this.ImageWidth.ToString());
            table.Add("Height", this.ImageHeight.ToString());
        return results;

    3) In the control template of the CoverFlowWidget alter the call to SetItem method to pass the settings to the cover flow:
    <script type="text/javascript">
        function pluginLoaded(sender, args)    // HTML version
            var imagesField = $get('<%= imagesField.ClientID %>');
            var imagesArr = Sys.Serialization.JavaScriptSerializer.deserialize(imagesField.value);
            slCtl = sender.getHost();
            for (idx in imagesArr)
                slCtl.Content.mainPage.SetItem(imagesArr[idx]['Title'], imagesArr[idx]['Url'], imagesArr[idx]['Width'], imagesArr[idx]['Height']);

    4) Change the MainPage class and the SitefinityImage class in the Silverlight project so that the SetItem method gets the images' width and heght:
    public partial class MainPage : UserControl
        public MainPage()
        public void SetItem(string title, string url, string width, string height)
            this.coverFlow.Items.Add(new SitefinityImage(title, url, width, height));
        public void SetMethod(string test)
    public class SitefinityImage
        public string URL get; set;
        public string Title get; set;
        public double Width get; set;
        public double Height get; set;
        public SitefinityImage(string title, string url, string width,string height)
            this.Title = title;
            this.URL = url;
            this.Width = double.Parse(width);
            this.Height = double.Parse(height);

    5) Finally change the XAML so that you set the height and width from the binder:
    <telerik:RadCoverFlow x:Name="coverFlow" IsReflectionEnabled="True">
                    <!--<TextBlock Text="Binding Title" />-->
                    <Image Width="Binding Width" Height="Binding Height" Source="Binding URL" />

    Finally build the solution and go to the page editor to set the properties exposed.

    Best wishes,
    Radoslav Georgiev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.