【C#】Devexpress .NET从8.1迁移至18.1的兼容性处理
转载请注明原文地址:http://www.cnblogs.com/litou/p/12111771.html
有一系统使用的是VS2008 .NET 2下的DevExpress 8.1,现需要升级到VS2010 .NET 4下的DevExpress 18.1,因为DevExpress版本的变化,代码需要做兼容性处理,目前发现的问题和解决办法如下:
一、版本转换
1.1、项目升级到.NET 4由VS2010完成
1.2、DevExpress版本升级由DevExpress Project Converter完成
二、编译错误
2.1、DevExpress.Data.Filtering.GroupOperator的Operands,类型由ArrayList改为DevExpress.Data.Filtering.CriteriaOperatorCollection
2.2、DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs的RowHandle已移除,改为使用ListSourceRowIndex处理(详见https://www.devexpress.com/Support/Center/Question/Details/T108839/why-the-customcolumndisplaytexteventargs-rowhandle-property-no-longer-exists-in-gridview)
2.3、DevExpress.XtraCharts.XYDiagram的BackColor,改为DefaultPane.BackColor(详见https://www.devexpress.com/Support/Center/Question/Details/Q35555/change-background-color-of-xydiagram-pane-graph)
2.4、DevExpress.XtraCharts.PercentOptions的ValuePercentPrecision,改名为PercentageAccuracy(详见https://www.devexpress.com/Support/Center/Question/Details/AS10911/pointoptions-rename-the-valuepercentprecision-property-to-percentageaccuracy-and-set-the)
2.5、DevExpress.XtraPivotGrid.PivotGridHitInfo不再包含FieldCellViewInfo,原FieldCellViewInfo的Field用DevExpress.XtraPivotGrid.PivotGridHitInfo的Field代替(详见https://www.devexpress.com/Support/Center/Question/Details/Q159088/how-to-determine-whether-the-current-field-value-is-a-column-field-value)
2.6、DevExpress.XtraScheduler的Appointment已经变更为接口,其实例可通过DevExpress.XtraScheduler.Compatibility.StaticAppointmentFactory.CreateAppointment或DevExpress.XtraScheduler.SchedulerDataStorage.CreateAppointment构建(详见https://www.devexpress.com/Support/Center/Question/Details/T306810/how-to-resolve-issues-related-to-changes-in-schedulercontrol-s-public-api-after)
三、布局问题
3.1、窗体变大,控件变大且位置发生变化。该问题在双字符集操作系统下由于XtraForm的Bug引起。
解决办法:删除Designer文件中XtraForm的AutoScaleDimensions和AutoScaleMode赋值(详见https://www.devexpress.com/Support/Center/Question/Details/B133111/controls-width-changed-when-update-from-v8-2-to-v8-3)
3.2、LayoutControl内控件与边框距离变大。
解决办法:设置LayoutControl的OptionsView.UseSkinIndents为false(详见https://www.devexpress.com/Support/Center/Question/Details/B139369/every-layoutcontrolgroup-has-unexpected-padding-value-after-update-to-9-2-4)
3.3、皮肤效果丢失。
解决办法:添加引用库DevExpress.BonusSkins,在所有控件创建之前,执行一次DevExpress.UserSkins.BonusSkins.Register()(详见https://www.devexpress.com/Support/Center/Question/Details/T666943/waitform-how-to-use-the-caramel-skin)
最后附上Dexpress .NET各版本和.NET Framework的对应关系表