Resize Silverlight Web Resource based on page size in CRM 2011 RRS feed

  • Question

  • Hi,

    I have a silverlight web resource added to a entity.when i resize the entity form the controls should also get resized based on the browser window size of the form.

    The silverlight works fine when tested from within the silverlight project and it is not resizing when calling from entity form.

    For resizing i have written the following code

    this.SizeChanged += new SizeChangedEventHandler(Layout_SizeChanged);

    void Layout_SizeChanged(object sender, SizeChangedEventArgs e)
                double aspectRatio = e.NewSize.Width / e.NewSize.Height;
                if (aspectRatio < (Layout.Width / Layout.Height))
                    LayoutScale.ScaleX = LayoutScale.ScaleY = e.NewSize.Width / (Layout.Width);
                    LayoutScale.ScaleX = LayoutScale.ScaleY = e.NewSize.Height / (Layout.Height);

    Tuesday, September 17, 2013 12:48 PM

All replies

  • Hi,

    The Silverlight controls take size as per the parent control. So don't give width and height to the Silverlight control.

    Please try and let me know how it goes.

    Also have a look on below.


    Hope this helps!


    Tuesday, September 17, 2013 5:06 PM
  • Hi,

    Yes,I have already put controls in canvas with auto width and height.but that only works when it runs outside the CRM entity form.

    I tried to change the property "Automatically expand to use Available space" of the html web resource which host the silverlight(.xap file) in the Entity form to TRUE.In this case it do changes size with respect to the browser window but for some limited space and after that also the size does not change(Even the normal control also stops to resize at this point).  

    Wednesday, September 18, 2013 4:58 AM
  • Hi,

    Please post the complete UI Xaml file. Did you try by putting Html file on form?


    Wednesday, September 18, 2013 5:15 AM