Silverlight dataGrid Simple Example:

Silverlight dataGrid Simple Example:

Use the following Code.

Output:


xaml code:

Use the following code inside your xaml

  <sdk:DataGrid AutoGenerateColumns="True" Height="201" HorizontalAlignment="Left" Margin="10,10,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="167" />

C# code:


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.Data;

namespace samp
{
    public partial class MainPage : UserControl
    {
          public MainPage()
          {
              InitializeComponent();

              loaddata();
          }

          private void loaddata()
          {
              List<Data> lobj = new List<Data>();
              lobj.Add(new Data() {UserID="0001"});
              lobj.Add(new Data() { UserID = "0001" });
              lobj.Add(new Data() { UserID = "0001" });
              lobj.Add(new Data() { UserID = "0001" });
              dataGrid1.ItemsSource = lobj;
          }
    }

    public class Data
    {
        public string UserID { get; set; }
    }

}

Comments

Popular posts from this blog

Upload Single/Multiple file by using the REST API and jQuery SharePoint 2013

A type named 'SP.Data. could not be resolved by the model error

Add content type to SharePoint List/Library using REST API