<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://xceed.com/CS/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tag 'SharePoint 2010'</title><link>http://xceed.com/CS/search/SearchResults.aspx?o=DateDescending&amp;tag=SharePoint+2010&amp;orTags=0</link><description>Search results matching tag 'SharePoint 2010'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Debug Build: 61120.2)</generator><item><title>Using Xceed DataGrid for Silverlight in SharePoint 2010</title><link>http://xceed.com/CS/blogs/componentinsider/archive/2010/12/16/using-xceed-datagrid-for-silverlight-in-sharepoint-2010.aspx</link><pubDate>Thu, 16 Dec 2010 18:46:00 GMT</pubDate><guid isPermaLink="false">14592c03-f9d0-4f6b-b4cd-71e0e1b1f679:29487</guid><dc:creator>Odi [Xceed]</dc:creator><description>&lt;P&gt;This is a guest blog post written by Johnny Tordgeman from &lt;A href="http://www.g-s.co.il/"&gt;Guardian Information Systems&lt;/A&gt;. He has his own &lt;A href="http://blogs.microsoft.co.il/blogs/johnnyt"&gt;blog&lt;/A&gt;, check it out.&lt;/P&gt;

&lt;P&gt;---&lt;/P&gt;

&lt;P&gt;Hey everyone, my name is Johnny Tordgeman and I will be posting some guest posts here on SharePoint 2010 integration with Xceed DataGrid for Silverlight. I would like to thank Odi for giving me the opportunity to show everyone how easy it is to combine Xceed DataGrid for Silverlight with the SharePoint 2010 platform.&lt;/P&gt;

&lt;P&gt;In this first post I’m going to show the basic connection of a SharePoint list with the datagrid by building a simple web part that will show all the fields of the default Tasks list using&amp;nbsp;Xceed’s datagrid.&lt;/P&gt;

&lt;P&gt;To keep things simple, I will only concentrate on the Silverlight&amp;nbsp;portion for this web part and display it using SharePoint’s Silverlight web part, but on a later post we will add a custom web part to render our Silverlight application and pass parameters such as the list we want to show from SharePoint.&lt;/P&gt;&lt;P&gt;[Ed. note: If you are going to try to run the Silverlight web part on your development machine, see the note at the end of this post]&lt;/P&gt;

&lt;P&gt;To get started, create a new Silverlight project and name it SLSPDataGrid then uncheck the “Host the Silverlight application in a new Web site” box and click OK.&lt;/P&gt;

&lt;P&gt;&lt;BR&gt;&lt;IMG src="http://xceed.com/CS/photos/odi/images/29488/original.aspx"&gt;&lt;/P&gt;

&lt;P&gt;To make this example as simple as possible we will use SharePoint’s REST web service to get the data from our Tasks list.&lt;/P&gt;

&lt;P&gt;Right click on the project name and select “Add Service Reference”. You will get the following screen:&lt;/P&gt;

&lt;P&gt;&lt;IMG style="width:635px;height:514px;" src="http://xceed.com/CS/photos/odi/images/29489/original.aspx" width="635" height="514"&gt;&lt;/P&gt;

&lt;P&gt;&lt;BR&gt;In the address box type in the address of your SharePoint site and add "/_vti_bin/ListData.svc" to it.&lt;/P&gt;

&lt;P&gt;For example, if your site is &lt;A href="http://jtordgeman"&gt;http://jtordgeman&lt;/A&gt; the address box should read: &lt;A href="http://jtordgeman/_vti_bin/ListData.svc"&gt;http://jtordgeman/_vti_bin/ListData.svc&lt;/A&gt;. [Ed. note: If you have trouble accessing this .svc file, see this solution: &lt;A href="http://blog.hompus.nl/2010/03/26/could-not-load-type-idataserviceupdateprovider-when-using-rest-with-sharepoint-2010/"&gt;http://blog.hompus.nl/2010/03/26/could-not-load-type-idataserviceupdateprovider-when-using-rest-with-sharepoint-2010/&lt;/A&gt;]&lt;/P&gt;

&lt;P&gt;Change the namespace to SharePointContext and click OK.&lt;/P&gt;

&lt;P&gt;Next, let’s add the Xceed datagrid dll to our project. Right click on "References" and choose "Add Reference", then click on “Browse” tab and navigate to where Xceed is installed. Click on "Bin" and then add "Xceed.Silverlight.DataGrid.v1.0.dll".&lt;BR&gt;&lt;BR&gt;Your solution should look similar to this:&lt;BR&gt;&lt;BR&gt;&lt;IMG src="http://xceed.com/CS/photos/odi/images/29490/original.aspx"&gt;&lt;/P&gt;

&lt;P&gt;In MainPage.xaml add the following line to the UserControl declaration:&lt;BR&gt;&lt;BR&gt;

&lt;SPAN style="font-family:Courier;"&gt;

xmlns:sldg="http://schemas.xceed.com/silverlight/xaml/datagrid"&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="font-family:Courier;"&gt;

&lt;/SPAN&gt;

&lt;P&gt;Now add the control under LayoutRoot using the sldg namespace. Your MainPage.xaml file should look like this:&lt;/P&gt;

&lt;SPAN style="font-family:Courier;"&gt;

&lt;P&gt;&amp;lt;UserControl x:Class="SLSPDataGrid.MainPage"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="&lt;A href="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;http://schemas.microsoft.com/winfx/2006/xaml/presentation&lt;/A&gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:x="&lt;A href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/A&gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:d="&lt;A href="http://schemas.microsoft.com/expression/blend/2008"&gt;http://schemas.microsoft.com/expression/blend/2008&lt;/A&gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:mc="&lt;A href="http://schemas.openxmlformats.org/markup-compatibility/2006"&gt;http://schemas.openxmlformats.org/markup-compatibility/2006&lt;/A&gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mc:Ignorable="d"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:sldg="&lt;A href="http://schemas.xceed.com/silverlight/xaml/datagrid"&gt;http://schemas.xceed.com/silverlight/xaml/datagrid&lt;/A&gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d:DesignHeight="300" d:DesignWidth="400"&amp;gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Grid x:Name="LayoutRoot" Background="White"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sldg:DataGridControl x:Name="dataGrid" ItemsSource="{Binding}"/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Grid&amp;gt;&lt;BR&gt;&amp;lt;/UserControl&amp;gt;&lt;/P&gt;
&lt;/SPAN&gt;
&lt;P&gt;We have added the control to our UI layer, so all we need now is to set its data. Switch to MainPage.xaml.cs file and following using statements:&lt;/P&gt;

&lt;SPAN style="font-family:Courier;"&gt;

&lt;P&gt;using System.Data.Services.Client;&lt;BR&gt;using SLSPDataGrid.SharePointContext;&lt;/P&gt;

&lt;/SPAN&gt;

&lt;P&gt;Inside the MainPage constructor register the Loaded event by typing the following line under InitializeComponent():&lt;/P&gt;

&lt;SPAN style="font-family:Courier;"&gt;

&lt;P&gt;this.Loaded += new RoutedEventHandler(MainPage_Loaded);&lt;/P&gt;

&lt;/SPAN&gt;

&lt;P&gt;Finally, type the following method to your code:&lt;/P&gt;

&lt;SPAN style="font-family:Courier;"&gt;

&lt;P&gt;void MainPage_Loaded(object sender, RoutedEventArgs e)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp; SharePointContext.HomeDataContext _context = new SharePointContext.HomeDataContext(new Uri("&lt;A href="http://jtordgeman/_vti_bin/ListData.svc/"&gt;http://jtordgeman/_vti_bin/ListData.svc/&lt;/A&gt;", UriKind.Absolute));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp; this.DataContext = _context.Tasks.IncludeTotalCount();&lt;BR&gt;}&lt;/P&gt;

&lt;/SPAN&gt;

&lt;P&gt;A few things to note:&lt;BR&gt;&lt;BR&gt;1)&amp;nbsp;Your context name might be different then mine (HomeDataContext). It’s best to type SharePointContext. And check in the intellisense for your context name.&lt;BR&gt;2)&amp;nbsp;The url that you pass to the context instance must be the same one you typed when we added the service reference.&lt;/P&gt;

&lt;P&gt;Build your project, upload the .xap file to a dir in your SharePoint site and add the Silverlight web part to a page. Provide the web part with the address for your xap file and… you’re all done! You should see all the fields of the task list in your Xceed datagrid, with smooth scrolling, and automatic background data virtualization&amp;nbsp;(in case you have hundreds or thousands of tasks) already enabled.&lt;/P&gt;

&lt;P&gt;Please feel free to contact me on Twitter (@jtordgeman) or on my blog with any question you might have, and I’ll see you on the next post :)&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;Note: You will need to add a clientaccesspolicy.xml or crossdomain.xml file to the root of your SharePoint website if you don't use the Silverlight web part on the same server as SharePoint (for example if SharePoint is hosted on &lt;A href="http://mysharepoint.com"&gt;http://mysharepoint.com&lt;/A&gt; and you query it from a silverlight app hosted on &lt;A href="http://mysharepoint2.com"&gt;http://mysharepoint2.com&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;</description></item></channel></rss>