Tag Archives: Silverlight

Solution for media failed to load in Sharepoint 2010

Spent over 3 hours trying to figure out why some links in my content query were opening in silverlight player. Decided to remove the silver light player and disabled media player…it did not work. Finally I found a JS file in the layouts folder and commented out couple of lines. The links now open in windows media player or what ever player the file is associated with. No more silverlight player !

Location: 14/templates/layouts/MediaPlayer.js
Find : var links=rootElement.getElementsByTagName("a");
 Replace with : var links;

If you are using a content query webpart with xsl stylesheets, you can just check a check box to do the same. “Play media in new window”

Microsoft LightSwitch

Microsoft Visual Studio LightSwitch gives you a simpler and faster way to create professional-quality Silverlight business applications for the desktop, the Web, and the cloud.

It offers little customization, but has a good template to create and modify SQL data.

Silverlight Tab control with Tab Items on left

<UserControl xmlns:controls=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls”
    x:Class=”SilverlightApplication18.MainPage”
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml
    xmlns:toolkit=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit”           
    Width=”400″ Height=”300″>
    <Grid x:Name=”LayoutRoot” Background=”White”>
        <controls:TabControl Margin=”10″ TabStripPlacement=”Left”>
            <controls:TabItem  >
                <controls:TabItem.Header>
                    <toolkit:LayoutTransformer >
                        <TextBlock Text=”Tab1″/>
                        <toolkit:LayoutTransformer.LayoutTransform>
                            <RotateTransform Angle=”-90″></RotateTransform>
                        </toolkit:LayoutTransformer.LayoutTransform>
                    </toolkit:LayoutTransformer>
                </controls:TabItem.Header>
                <TextBlock  Margin=”10″ Text=”some content in Tab1″/>              
            </controls:TabItem>
            <controls:TabItem   >
                <controls:TabItem.Header>
                    <toolkit:LayoutTransformer >
                        <TextBlock Text=”Tab2″/>
                        <toolkit:LayoutTransformer.LayoutTransform>
                            <RotateTransform Angle=”-90″></RotateTransform>
                        </toolkit:LayoutTransformer.LayoutTransform>
                    </toolkit:LayoutTransformer>
                </controls:TabItem.Header>
                <TextBlock Margin=”10″ Text=”some content in Tab2″/>              
            </controls:TabItem>
        </controls:TabControl>
    </Grid>
</UserControl>

Silverlight Text Animations

This is a super cool addon for silverlight that does a lot of cool animations.

Link to Page

Silverlight Combobox with Selected Item, Selected Value

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;

namespace Ravi.UI.Silverlight
{
///

/// Custom combobox because databinding doesn’t work correctly
///

public class ComboBox : System.Windows.Controls.ComboBox
{
#region Constructor

///

/// Constructor
///

public ComboBox()
{
this.Loaded += new RoutedEventHandler(ComboBox_Loaded);
this.SelectionChanged += new SelectionChangedEventHandler(ComboBox_SelectionChanged);
}

#endregion

#region Events

///

/// Loaded Event
///

/// /// void ComboBox_Loaded(object sender, RoutedEventArgs e)
{
SetSelectionFromValue();
}

private object _selection;

void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems.Count > 0)
{
_selection = e.AddedItems[0];
SelectedValue = GetMemberValue(_selection);
}
else
{
_selection = null;
SelectedValue = null;
}
}