Sliverlight学习笔记七DataGrid控件。Silverlight学习笔记七之Silverlight的分页与表单(DataPager,DataForm控件)

立即同一省是DataGrid,绑定数据源

随即无异节省上DataPager,DataForm控件

意义使下图:

意义使图

图片 1

图片 2

 

DataPager

1.DataGridDemo.xaml

 

<UserControl
xmlns:datagrid=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data” 
x:Class=”Silverlight.Common.View.DataGridDemo”
   
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
    xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″
   
xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″
                
xmlns:dataform=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit”
             
xmlns:input=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit”
             xmlns:sys=”clr-namespace:System;assembly=mscorlib”>

图片 3

    <StackPanel>
        <ContentControl Content=”DataGrid” />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition  Height=”310″/>
                <RowDefinition  Height=”25″/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition  Width=”180″/>
                <ColumnDefinition  Width=”840″/>
                <ColumnDefinition  Width=”*”/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column=”0″>
                <CheckBox Content=”不可编辑” x:Name=”IsEditable”
IsChecked=”{Binding IsReadOnly, ElementName=dataGrid, Mode=TwoWay}” 
Margin=”4″ />
                <CheckBox Content=”否可再改列的显得顺序”
IsChecked=”{Binding CanUserReorderColumns, ElementName=dataGrid,
Mode=TwoWay}” Margin=”4″ />
                <CheckBox Content=”列宽是否只是易” IsChecked=”{Binding
CanUserResizeColumns, ElementName=dataGrid, Mode=TwoWay}” Margin=”4″
/>
                <CheckBox Content=”是否只是单击列标题来对列排序”
IsChecked=”{Binding CanUserSortColumns, ElementName=dataGrid,
Mode=TwoWay}” Margin=”4″ />
                <TextBlock  Text=”无法水平滚动的列数” Margin=”4″
/>
                <input:NumericUpDown Width=”100″
HorizontalAlignment=”Left” Minimum=”0″ Margin=”4″ Value=”{Binding
FrozenColumnCount, ElementName=dataGrid, Mode=TwoWay}” />
                <CheckBox x:Name=”cbGroupping”
Content=”是否分组显示”  Margin=”4″ Click=”OnClick” />
                <CheckBox Content=”数据格式验证” IsChecked=”{Binding
IsValid, ElementName=dataGrid, Mode=TwoWay}” Margin=”4″ />
                <TextBlock  Text=”何时显示行之详细信息部分:”
Margin=”4″ />
                <ComboBox HorizontalAlignment=”Left” Width=”auto”
SelectedItem=”{Binding RowDetailsVisibilityMode, ElementName=dataGrid,
Mode=TwoWay}” Margin=”4″ SelectedIndex=”2″>
                    <sys:String>Collapsed</sys:String>
                    <sys:String>Visible</sys:String>
                   
<sys:String>VisibleWhenSelected</sys:String>
                </ComboBox>
                <TextBlock Text=”选择作为:” Margin=”4″ />
                <ComboBox HorizontalAlignment=”Left” Width=”70″
SelectedItem=”{Binding SelectionMode, ElementName=dataGrid,
Mode=TwoWay}” Margin=”4″ SelectedIndex=”1″>
                    <sys:String>Single</sys:String>
                    <sys:String>Extended</sys:String>
                </ComboBox>
            </StackPanel>
            <datagrid:DataGrid x:Name=”dataGrid”  Width=”820″
Height=”310″ ColumnWidth=”100″  ItemsSource=”{Binding}”
HorizontalAlignment=”Stretch” VerticalAlignment=”Top” Margin=”4″
MaxHeight=”300″ Grid.Column=”1″>
                <datagrid:DataGrid.RowDetailsTemplate>
                    <DataTemplate>
                        <StackPanel Background=”LightBlue”>
                            <StackPanel
Orientation=”Horizontal”>
                                <TextBlock Text=”This item has
details.” />
                            </StackPanel>
                            <StackPanel
Orientation=”Horizontal”>
                                <TextBlock Text=”Here is some data: ”
/>
                                <TextBlock Text=”{Binding Name}”
/>
                                <TextBlock Text=” ” />
                                <TextBlock Text=”{Binding Password}”
/>
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </datagrid:DataGrid.RowDetailsTemplate>
            </datagrid:DataGrid>
            <datagrid:DataPager Width=”820″ Height=”24″ Grid.Row=”1″
Margin=”0,-15,0,0″ Grid.Column=”1″ Source=”{Binding}” PageSize=”10″
/>
            <StackPanel Grid.Column=”2″>
     
                    <dataform:DataForm x:Name=”dataForm”  Margin=”4″
Grid.Column=”2″ ItemsSource=”{Binding}” >
                    </dataform:DataForm>

DataForm

            </StackPanel>
        </Grid>
    </StackPanel>
</UserControl>

 

 

1.DataPagerDemo.xaml

2.DataGridDemo.cs

<UserControl x:Class=”Silverlight.Common.View.DataPagerDemo”
    
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
   
xmlns:data=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data”
   
xmlns:input=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit”>
    <Grid Background=”White”>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition  Height=”Auto”/>
                <RowDefinition Height=”200″ />
                <RowDefinition Height=”200″ />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width=”200″ MinWidth=”200″ />
                <ColumnDefinition Width=”500″ />
            </Grid.ColumnDefinitions>
            <ContentControl  Content=”显示样式:” />
            <ContentControl  Content=”数据” Grid.Column=”1″ />
            <data:DataGrid Grid.Column=”1″ IsReadOnly=”False”
Grid.Row=”1″ ItemsSource=”{Binding}” Margin=”5″ />
            <ListBox ItemsSource=”{Binding}” Grid.Row=”2″
Grid.Column=”1″ Margin=”5″>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation=”Horizontal”>
                            <TextBlock Text=”{Binding Name}”/>
                            <TextBlock Text=” – ” />
                            <TextBlock Text=”{Binding CodeFaa}”
/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

 

            <StackPanel Grid.Row=”1″ Grid.RowSpan=”2″>
                <TextBlock  Text=”FirstLastNumeric样式:” />
                <data:DataPager x:Name=”dataPager”
DisplayMode=”FirstLastNumeric” Margin=”0,0,0,4″
HorizontalAlignment=”Center” Source=”{Binding}”
NumericButtonCount=”{Binding Value, ElementName=numericButtonCount}”
AutoEllipsis=”{Binding IsChecked, ElementName=autoEllipsis}” 
IsTotalItemCountFixed=”{Binding IsChecked,
ElementName=totalItemCountFixed}” />
                <TextBlock  Text=”FirstLastPreviousNext样式:”
/>
                <data:DataPager DisplayMode=”FirstLastPreviousNext”
Margin=”0,0,0,4″ HorizontalAlignment=”Center” Source=”{Binding}”
NumericButtonCount=”{Binding Value, ElementName=numericButtonCount}”
AutoEllipsis=”{Binding IsChecked, ElementName=autoEllipsis}”
IsTotalItemCountFixed=”{Binding IsChecked,
ElementName=totalItemCountFixed}” />
                <TextBlock  Text=”FirstLastPreviousNextNumeric样式:”
/>
                <data:DataPager
DisplayMode=”FirstLastPreviousNextNumeric” Margin=”0,0,0,4″
HorizontalAlignment=”Center” Source=”{Binding}”
NumericButtonCount=”{Binding Value, ElementName=numericButtonCount}”
AutoEllipsis=”{Binding IsChecked, ElementName=autoEllipsis}”
IsTotalItemCountFixed=”{Binding IsChecked,
ElementName=totalItemCountFixed}” />
                <TextBlock  Text=”Numeric样式:” />
                <data:DataPager DisplayMode=”Numeric”
Margin=”0,0,0,4″ HorizontalAlignment=”Center” Source=”{Binding}”
NumericButtonCount=”{Binding Value, ElementName=numericButtonCount}”
AutoEllipsis=”{Binding IsChecked, ElementName=autoEllipsis}”
IsTotalItemCountFixed=”{Binding IsChecked,
ElementName=totalItemCountFixed}” />
                <TextBlock  Text=”PreviousNext样式:” />
                <data:DataPager DisplayMode=”PreviousNext”
Margin=”0,0,0,4″ HorizontalAlignment=”Center” Source=”{Binding}”
NumericButtonCount=”{Binding Value, ElementName=numericButtonCount}”
AutoEllipsis=”{Binding IsChecked, ElementName=autoEllipsis}”
IsTotalItemCountFixed=”{Binding IsChecked,
ElementName=totalItemCountFixed}” />
                <TextBlock  Text=”PreviousNextNumeric样式:” />
                <data:DataPager DisplayMode=”PreviousNextNumeric”
Margin=”0,0,0,4″ HorizontalAlignment=”Center” Source=”{Binding}”
NumericButtonCount=”{Binding Value, ElementName=numericButtonCount}”
AutoEllipsis=”{Binding IsChecked, ElementName=autoEllipsis}”
IsTotalItemCountFixed=”{Binding IsChecked,
ElementName=totalItemCountFixed}” />
                <CheckBox x:Name=”autoEllipsis”
Content=”AutoEllipsis” Margin=”4″ />
                <CheckBox x:Name=”totalItemCountFixed”
Content=”IsTotalItemCountFixed属性” IsChecked=”True” Margin=”4″ />
                <input:NumericUpDown x:Name=”numpageSize”
ValueChanging=”numpageSize_ValueChanging”></input:NumericUpDown>
                <Grid Height=”0″>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Text=”NumericButtonCount:”
VerticalAlignment=”Center” Grid.Row=”0″ Grid.Column=”0″ Margin=”4″
/>
                    <input:NumericUpDown x:Name=”numericButtonCount”
Value=”5″ Minimum=”0″ Maximum=”20″ VerticalAlignment=”Center”
Grid.Row=”0″ Grid.Column=”1″ Margin=”4″ />
                    <TextBlock Text=”PageSize:”
VerticalAlignment=”Center” Grid.Row=”1″ Grid.Column=”0″ Margin=”4″
/>
                    <input:NumericUpDown Value=”{Binding PageSize,
Mode=TwoWay}” Minimum=”1″ VerticalAlignment=”Center” Grid.Row=”1″
Grid.Column=”1″ Margin=”4″ />
                </Grid>
            </StackPanel>
        </Grid>

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 Silverlight.Common.Core;

    </Grid>
</UserControl>

using System.Windows.Data;

 

namespace Silverlight.Common.View
{
    public partial class DataGridDemo : UserControl
    {
        public DataGridDemo()
        {
            InitializeComponent();

2.DataPagerDemo.cs

    //绑定数据源,赋值
            PagedCollectionView pcv = new
PagedCollectionView(UserList.GetUserList());
            DataContext = pcv;
        }

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;
using Silverlight.Common.Core;

        private void OnClick(object sender, RoutedEventArgs e)
        {
            if ((bool)this.cbGroupping.IsChecked)
            {

namespace Silverlight.Common.View
{
    public partial class DataPagerDemo : UserControl
    {
        public DataPagerDemo()
        {
            InitializeComponent();
            if (UserList.GetUserList().Count > 0)
            {
                PagedCollectionView pcv = new
PagedCollectionView(UserList.GetUserList());
                pcv.PageSize = 2;
                DataContext = pcv;
            }

      //分组显示
                PagedCollectionView Groupping = new
PagedCollectionView(UserList.GetUserList());
                Groupping.GroupDescriptions.Add(new
PropertyGroupDescription(“Password”));
                Groupping.GroupDescriptions.Add(new
PropertyGroupDescription(“Name”));
                DataContext = Groupping;
            }

            else {
            MessageBox.Show(“没有数”);
            }
         
        }

            else
            {
                DataContext = UserList.GetUserList();
            }
        }
    }
}

        private void numpageSize_ValueChanging(object sender,
RoutedPropertyChangingEventArgs<double> e)
        {
            if (this.numpageSize.Value>0)
            {
                this.dataPager.PageSize
=Convert.ToInt32(this.numpageSize.Value);
            }
        }
    }
}

 

 

3.User.cs

3.DataFormDemo.xaml

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

 <UserControl
x:Class=”Silverlight.Common.View.DataFormDemo”
    
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
   
xmlns:dataform=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit”
   
xmlns:input=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit”
    xmlns:sys=”clr-namespace:System;assembly=mscorlib”>
    <StackPanel>
        <ContentControl Content=”DataForm” />
        <StackPanel>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width=”Auto” />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column=”0″>
                    <CheckBox Content=”AutoCommit”
IsChecked=”{Binding AutoCommit, ElementName=dataForm, Mode=TwoWay}”
Margin=”4″ />
                    <CheckBox Content=”AutoEdit” IsChecked=”{Binding
AutoEdit, ElementName=dataForm, Mode=TwoWay}” Margin=”4″ />
                    <TextBlock Text=”CommandButtonsVisibility” 
Margin=”4″ />
                    <ComboBox SelectedItem=”{Binding
CommandButtonsVisibility, ElementName=dataForm, Mode=TwoWay}”
SelectedIndex=”0″ Margin=”4″>
                        <sys:String>All</sys:String>
                        <sys:String>Add</sys:String>
                        <sys:String>Delete</sys:String>
                        <sys:String>Edit</sys:String>
                       
<sys:String>Navigation</sys:String>
                        <sys:String>None</sys:String>
                    </ComboBox>
                    <CheckBox Content=”IsReadOnly”
x:Name=”cbIsEditable” Click=”IsEditable_Click” Margin=”4″ />
                </StackPanel>
                <dataform:DataForm  x:Name=”dataForm” Width=”350″
ItemsSource=”{Binding}” HorizontalAlignment=”Left” MaxWidth=”500″
Margin=”4″ Grid.Column=”1″ />
            </Grid>
        </StackPanel>
    </StackPanel>
</UserControl>

namespace Silverlight.Common.Core
{
    public class User
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public virtual int UserID { get; set; }

 

        /// <summary>
        /// 用户名
        /// </summary>
        public virtual string UserName { get; set; }

 

        /// <summary>
        /// 用户姓名
        /// </summary>
        public virtual string Name { get; set; }

4.DataFormDemo.cs

        /// <summary>
        /// 用户密码
        /// </summary>
        public virtual string Password { get; set; }

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;
using Silverlight.Common.Core;

        /// <summary>
        /// 用户描述
        /// </summary>
        public virtual string Description { get; set; }

namespace Silverlight.Common.View
{
    public partial class DataFormDemo : UserControl
    {
        public DataFormDemo()
        {
            InitializeComponent();
            DataContext = UserList.GetUserList();
        }

        /// <summary>
        /// 是否启用
        /// </summary>
        public virtual bool IsEnabled { get; set; }

        private void IsEditable_Click(object sender, RoutedEventArgs
e)
        {
            if ((bool)this.cbIsEditable.IsChecked)
            {
                this.dataForm.IsReadOnly = true;
            }

        /// <summary>
        /// 密码恢复问题
        /// </summary>
        public virtual string Question { get; set; }

            else {
                this.dataForm.IsReadOnly = false;
            }
        }
    }
}

        /// <summary>
        /// 密码恢复答案
        /// </summary>
        public virtual string Answer { get; set; }
    }
}

 

 

5.User.cs

4.UserList.cs

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

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

namespace Silverlight.Common.Core
{
    public class User
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public virtual int UserID { get; set; }

namespace Silverlight.Common.Core
{
    public static class UserList
    {
        public static IList<User> GetUserList()
        {
            IList<User> userList = new List<User>();
            userList.Add(new User {
Answer=”我之故里在啊?”,Description=”超级管理员权限”,IsEnabled=true,Name=”吴建强”,Password=”11111″,Question=”山西省神池县”,UserID=1,UserName=”admin”});
            userList.Add(new User { Answer = “我顶爱的国度?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “sfsgfsd”, Question = “韩国”, UserID = 2, UserName = “lxt”
});
            userList.Add(new User { Answer = “我无限欢喜的人口?”,
Description = “普通用户权限”, IsEnabled = true, Name = “李秀婷”,
Password = “11111”, Question = “山西省神池县”, UserID = 3, UserName =
“wjq” });
            userList.Add(new User { Answer = “我极其喜爱的大腕?”,
Description = “普通用户权限”, IsEnabled = true, Name = “权相宇,李连杰”,
Password = “11111”, Question = “权相宇,李连杰”, UserID = 4, UserName =
“qxy” });
            userList.Add(new User { Answer = “我最轻看之影?”,
Description = “普通用户权限”, IsEnabled = true, Name = “李连杰”,
Password = “11111”, Question = “精武英雄”, UserID = 5, UserName = “lxj”
});
            userList.Add(new User { Answer = “我无限易看之电视剧?”,
Description = “普通用户权限”, IsEnabled = true, Name = “权相宇”,
Password = “11111”, Question = “《悲伤恋歌》”, UserID = 6, UserName =
“admin” });
            userList.Add(new User { Answer = “我的想望?”, Description =
“普通用户权限”, IsEnabled = true, Name = “吴建强”, Password = “11111”,
Question = “成为亿万富翁”, UserID = 7, UserName = “llj” });
            userList.Add(new User { Answer = “我最喜欢事?”, Description
= “普通用户权限”, IsEnabled = true, Name = “吴建强”, Password = “11111”,
Question = “编程”, UserID = 8, UserName = “admin” });
            userList.Add(new User { Answer = “我的故乡在哪?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 9, UserName =
“admin” });
            userList.Add(new User { Answer = “我之邻里在哪?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 10, UserName =
“admin” });
            userList.Add(new User { Answer = “我之家乡在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 11, UserName =
“admin” });
            userList.Add(new User { Answer = “我无比喜欢事?”, Description
= “普通用户权限”, IsEnabled = true, Name = “吴建强”, Password = “11111”,
Question = “编程”, UserID = 12, UserName = “admin” });
            userList.Add(new User { Answer = “我的出生地在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 13, UserName =
“admin” });
            userList.Add(new User { Answer = “我的里在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 14, UserName =
“admin” });
            userList.Add(new User { Answer = “我的桑梓在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 15, UserName =
“admin” });
            return userList;
        }
    }
}

        /// <summary>
        /// 用户名
        /// </summary>
        public virtual string UserName { get; set; }

 

        /// <summary>
        /// 用户姓名
        /// </summary>
        public virtual string Name { get; set; }

横流:其中的一致局部关键性能已在左边列有,并且点击按钮就会看到其的成效

        /// <summary>
        /// 用户密码
        /// </summary>
        public virtual string Password { get; set; }

  DataForm是因此来显示所选中的数

        /// <summary>
        /// 用户描述
        /// </summary>
        public virtual string Description { get; set; }

  DataPager用来分页,其中的PageSize是每页显示的条数。

        /// <summary>
        /// 是否启用
        /// </summary>
        public virtual bool IsEnabled { get; set; }

  此DataGrid自带多少中验证

        /// <summary>
        /// 密码恢复问题
        /// </summary>
        public virtual string Question { get; set; }

  源代码下载:http://files.cnblogs.com/salam/Silverlight.Common.rar

        /// <summary>
        /// 密码恢复答案
        /// </summary>
        public virtual string Answer { get; set; }
    }
}

 

6.UserList.cs

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

namespace Silverlight.Common.Core
{
    public static class UserList
    {
        public static IList<User> GetUserList()
        {
            IList<User> userList = new List<User>();
            userList.Add(new User {
Answer=”我之家乡在哪?”,Description=”超级管理员权限”,IsEnabled=true,Name=”吴建强”,Password=”11111″,Question=”山西省神池县”,UserID=1,UserName=”admin”});
            userList.Add(new User { Answer = “我顶欢喜的国?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “sfsgfsd”, Question = “韩国”, UserID = 2, UserName = “lxt”
});
            userList.Add(new User { Answer = “我最爱的人?”,
Description = “普通用户权限”, IsEnabled = true, Name = “李秀婷”,
Password = “11111”, Question = “山西省神池县”, UserID = 3, UserName =
“wjq” });
            userList.Add(new User { Answer = “我最好欣赏的大腕?”,
Description = “普通用户权限”, IsEnabled = true, Name = “权相宇,李连杰”,
Password = “11111”, Question = “权相宇,李连杰”, UserID = 4, UserName =
“qxy” });
            userList.Add(new User { Answer = “我无比爱看之影片?”,
Description = “普通用户权限”, IsEnabled = true, Name = “李连杰”,
Password = “11111”, Question = “精武英雄”, UserID = 5, UserName = “lxj”
});
            userList.Add(new User { Answer = “我极其爱看之电视剧?”,
Description = “普通用户权限”, IsEnabled = true, Name = “权相宇”,
Password = “11111”, Question = “《悲伤恋歌》”, UserID = 6, UserName =
“admin” });
            userList.Add(new User { Answer = “我的指望?”, Description =
“普通用户权限”, IsEnabled = true, Name = “吴建强”, Password = “11111”,
Question = “成为亿万富翁”, UserID = 7, UserName = “llj” });
            userList.Add(new User { Answer = “我最喜欢事?”, Description
= “普通用户权限”, IsEnabled = true, Name = “吴建强”, Password = “11111”,
Question = “编程”, UserID = 8, UserName = “admin” });
            userList.Add(new User { Answer = “我之乡在哪?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 9, UserName =
“admin” });
            userList.Add(new User { Answer = “我的桑梓在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 10, UserName =
“admin” });
            userList.Add(new User { Answer = “我之乡在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 11, UserName =
“admin” });
            userList.Add(new User { Answer = “我最喜欢事?”, Description
= “普通用户权限”, IsEnabled = true, Name = “吴建强”, Password = “11111”,
Question = “编程”, UserID = 12, UserName = “admin” });
            userList.Add(new User { Answer = “我之里在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 13, UserName =
“admin” });
            userList.Add(new User { Answer = “我的故土在啊?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 14, UserName =
“admin” });
            userList.Add(new User { Answer = “我之故园在哪?”,
Description = “普通用户权限”, IsEnabled = true, Name = “吴建强”,
Password = “11111”, Question = “山西省神池县”, UserID = 15, UserName =
“admin” });
            return userList;
        }
    }
}

 

流淌:使用DataPager无需我们当写分页代码,这样大大减少了俺们的代码量,只待绑定数据源。

   
DataForm可以用数据保存及数据库被,这个事例中从未实现这个意义,往后会面相继完善。

  源代码下:http://files.cnblogs.com/salam/Silverlight.Common.rar

相关文章