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"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
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?
<li> <label for="ImageHeight">Image Height</label> <input type="text" id="ImageHeight" class="sfTxt" value="300" /> </li>
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; private List<Hashtable> GetImages() List<Hashtable> results = new List<Hashtable>(); //get IQueryable of images from the Fluent API. var images = App.WorkWith().Images() .Where( (w) => w.Album.Title == this.AlbumTitle && w.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live) .Get(); 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()); results.Add(table); return results;<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']); </script>public partial class MainPage : UserControl public MainPage() InitializeComponent(); [ScriptableMember] public void SetItem(string title, string url, string width, string height) this.coverFlow.Items.Add(new SitefinityImage(title, url, width, height)); [ScriptableMember] public void SetMethod(string test) MessageBox.Show("debug"); 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); <telerik:RadCoverFlow x:Name="coverFlow" IsReflectionEnabled="True"> <telerik:RadCoverFlow.ItemTemplate> <DataTemplate> <StackPanel> <!--<TextBlock Text="Binding Title" />--> <Image Width="Binding Width" Height="Binding Height" Source="Binding URL" /> </StackPanel> </DataTemplate> </telerik:RadCoverFlow.ItemTemplate></telerik:RadCoverFlow>