Social Icons

twitter google plus linkedin rss feed

Pages

11.1.12

Scroll bars appear in SharePoint 2010 when rendering Silverlights (Part 2)

Yes, every time you fix the height or the width of the web part it shows those ugly scrollbars.

This is not the first time I go through this, but I think this time I have solved it for good or until we get the next version of SharePoint next year…. The problem was the way I was creating the Silverlight object I was using an inline CSS style. It looked a bit like:
<object id='silverlightHost' style='height: 600px; width: 350px; margin: 0; padding: 0;' data='data:application/x-silverlight-2,' type='application/x-silverlight-2'>

After a thousand try / error experiments don’t ever think I am capable of creating a SharePoint 2010 OOTB Silverlight Web Part and copying it I changed the first line of the object to:
<object id='silverlightHost' height='600px' width='350px' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' style='display:block' class='ms-dlgDisable'>
And that does the trick.

No comments:

Post a Comment

6.1.12

Creating Events in Silverlight

I have read it’s impossible in a couple of places, i don’t know if it was in the previous versions, but at least since Silverlight 3 is possible… and even more… easy.

Here is an event I use to check when an item has moved.

        #region Events
        public delegate void PositionChangeHandler(Object Sender);

        public event PositionChangeHandler PositionChangedEvent;

        protected virtual void OnPositionChanged()
        {
            if (PositionChangedEvent != null)
                PositionChangedEvent(this);
        }
        #endregion

And then in the method where I am updating the position of the item:
OnPositionChanged();

After that we can easily hook to the event from the other classes:
ParentObjective.PositionChangedEvent += new Objective.PositionChangeHandler(RelatedObjectives_PositionChangedEvent);

Nice and easy.

No comments:

Post a Comment