Using silverlight slider inside MS CRM 2011

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Scroller.MainPage"
Background="#FFF6F8FA">

<grid x:Name="LayoutRoot" Background="#FFF6F8FA">
<slider x:Name="slider1" Margin="0,0,0,0" ValueChanged="silder1_ValueChanged" Background="Transparent"/>
</Grid>
</UserControl>

------------------------------------------ XAML ------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace Scroller
{
public partial class MainPage : UserControl
{
public MainPage()
{
// Required to initialize variables
InitializeComponent();
}

private void silder1_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs e)
{
// TODO: Add event handler implementation here.
ScriptObject Xrm = (ScriptObject)HtmlPage.Window.GetProperty("Xrm");
ScriptObject Page = (ScriptObject)Xrm.GetProperty("Page");
ScriptObject attrib = (ScriptObject)Page.Invoke("getAttribute", new object[] { "new_testcount" });
attrib.Invoke("setValue", new object[] { slider1.Value });
}

}
}

------------------------------------------ C# Code ------------------------------------------

After you build the silverlight application project create new web resource inside MS CRM 2011.

1. Create an entity.
2. Create field named 'new_testcount' under created entity.
3. Put 'new_testcount' inside the created entity's form.
4. Put created silverlight web resource on that form

enjoy rich UI of silver light ....

Comments