博客园网站地址
http://www.dxper.net/documents/
000208D5-0000-0000-C000-000000000046
Excel -> CSV
http://dl.vmall.com/c0z3pqoxo3
EXcel -> CSV
GemBox
http://download.csdn.net/detail/zhengshengpeng1125/5658835
<
Window
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg
=
"http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe
=
"http://schemas.devexpress.com/winfx/2008/xaml/editors"
x:Class
=
"WpfApplication18.MainWindow"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.Resources
>
<
Style
TargetType
=
"{x:Type dxg:GridColumn}"
>
<!--列头居中-->
<
Setter
Property
=
"HorizontalHeaderContentAlignment"
Value
=
"Center"
/>
<!--列值居中-->
<
Setter
Property
=
"EditSettings"
>
<
Setter.Value
>
<
dxe:TextEditSettings
HorizontalContentAlignment
=
"Center"
/>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Window.Resources
>
<
Grid
>
<
dxg:GridControl
ItemsSource
=
"{Binding students}"
>
<
dxg:GridControl.Columns
>
<
dxg:GridColumn
FieldName
=
"id"
/>
<
dxg:GridColumn
FieldName
=
"name"
/>
</
dxg:GridControl.Columns
>
<
dxg:GridControl.View
>
<
dxg:TableView
/>
</
dxg:GridControl.View
>
</
dxg:GridControl
>
</
Grid
>
</
Window
>
http://www.cnblogs.com/-ShiL/p/Star201310290255.html
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DevExpress.XtraEditors.DXErrorProvider; namespace MyDXGridSample { public class Person : object, IDXDataErrorInfo { public Person(string firstName, string lastName, string address, string phoneNumber, string email) { this.FirstName = firstName; this.LastName = lastName; this.Address = address; this.PhoneNumber = phoneNumber; this.Email = email; } public string FirstName { get; set; } public string LastName { get; set; } public string Address { get; set; } public string PhoneNumber { get; set; } public string Email { get; set; } public bool Gender { get; set; } #region IDXDataErrorInfo Members void IDXDataErrorInfo.GetPropertyError(string propertyName, ErrorInfo info) { switch (propertyName) { case "FirstName": case "LastName": if (IsStringEmpty(propertyName == "FirstName" ? FirstName : LastName)) { SetErrorInfo(info, propertyName + " field can't be empty", ErrorType.Critical); } break; case "Address": if (IsStringEmpty(Address)) { SetErrorInfo(info, "Address hasn't been entered", ErrorType.Information); } break; case "Email": if (IsStringEmpty(Email)) { SetErrorInfo(info, "Email hasn't been entered", ErrorType.Information); } else if (Email != "none" && !IsEmailCorrect(Email)) { SetErrorInfo(info, "Wrong email address", ErrorType.Warning); } break; } } void IDXDataErrorInfo.GetError(ErrorInfo info) { if (IsStringEmpty(PhoneNumber) && (Email == "none" || !IsEmailCorrect(Email))) SetErrorInfo(info, "Either Phone Number or Email should be specified", ErrorType.Information); } #endregion bool IsStringEmpty(string str) { return str == null || str.Trim().Length == 0; } bool IsEmailCorrect(string email) { return email == null || (email.IndexOf("@") >= 1 && email.Length > email.IndexOf("@") + 1); } void SetErrorInfo(ErrorInfo info, string errorText, ErrorType errorType) { info.ErrorText = errorText; info.ErrorType = errorType; //DXErrorProvider.GetErrorIcon += new GetErrorIconEventHandler(DXErrorProvider_GetErrorIcon); } void DXErrorProvider_GetErrorIcon(GetErrorIconEventArgs e) { throw new NotImplementedException(); } } }
posted on 2014-05-29 21:14 JackSlaterYu 阅读(740) 评论(0) 编辑 收藏 举报