本文整理汇总了C#中XPCollection.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# XPCollection.IndexOf方法的具体用法?C# XPCollection.IndexOf怎么用?C# XPCollection.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPCollection
的用法示例。
在下文中一共展示了XPCollection.IndexOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadValueCore
protected override void ReadValueCore()
{
base.ReadValueCore();
if (PropertyValue is XPBaseCollection)
{
// отписка от старого обработчика
Control.ItemCheck -= new DevExpress.XtraEditors.Controls.ItemCheckEventHandler(control_ItemCheck);
checkedItems = (XPBaseCollection)PropertyValue;
// дополнительные условия
CriteriaOperator criteria = null;
if (!string.IsNullOrEmpty(Model.DataSourceCriteria))
{
criteria = CriteriaOperator.Parse(Model.DataSourceCriteria);
}
if (!string.IsNullOrEmpty(Model.DataSourceCriteriaProperty))
{
CriteriaOperator criteria2 = null;
IMemberInfo propWithCriteria = MemberInfo.Owner.FindMember(Model.DataSourceCriteriaProperty);
criteria2 = (CriteriaOperator)propWithCriteria.GetValue(this.CurrentObject);
if (!ReferenceEquals(criteria2, null))
{
criteria = !ReferenceEquals(criteria, null) ? CriteriaOperator.And(criteria, criteria2) : criteria2;
}
}
// коллекция данных для списка
XPCollection dataSource = new XPCollection(
checkedItems.Session,
MemberInfo.ListElementType,
!ReferenceEquals(criteria, null) ? CriteriaOperator.And(checkedItems.Criteria, criteria) : checkedItems.Criteria,
checkedItems.Sorting.ToArray<SortProperty>());
IModelClass classInfo = application.Model.BOModel.GetClass(MemberInfo.ListElementTypeInfo.Type);
if (checkedItems.Sorting.Count > 0)
{
dataSource.Sorting = checkedItems.Sorting;
}
else if (checkedItems.Sorting.Count == 0 && !String.IsNullOrEmpty(classInfo.DefaultProperty))
{
dataSource.Sorting.Add(new SortProperty(classInfo.DefaultProperty, DevExpress.Xpo.DB.SortingDirection.Ascending));
}
Control.DataSource = dataSource;
Control.DisplayMember = classInfo.DefaultProperty;
//Выполняем условие для отображения текста в контроле.
IModelPropertyEditorDisplayItem displayItem = Model as IModelPropertyEditorDisplayItem;
if (displayItem != null)
{
if (!ReferenceEquals(displayItem.DisplayItemCriteriaProperty, null))
{
IMemberInfo propWithCriteria = MemberInfo.Owner.FindMember(displayItem.DisplayItemCriteriaProperty);
Control.ItemTextCriteria = (CriteriaOperator)propWithCriteria.GetValue(this.CurrentObject);
}
if (!String.IsNullOrWhiteSpace(displayItem.DisplayItemCriteriaString))
{
Control.ItemTextCriteriaString = (displayItem.DisplayItemCriteriaString);
}
}
foreach (object obj in checkedItems)
{
Control.SetItemChecked(dataSource.IndexOf(obj), true);
}
Control.ItemCheck += new DevExpress.XtraEditors.Controls.ItemCheckEventHandler(control_ItemCheck);
}
}