Пример #1
0
		GroupInfo[] GetGroupInfos(int rowHandle) {
			int rowLevel = GridControl.GetRowLevelByRowHandle(rowHandle);
			GroupInfo[] groupInfo = new GroupInfo[rowLevel + 1];
			int currentGroupRowHandle = rowHandle;
			for(int i = rowLevel; i >= 0; i--) {
				groupInfo[i] = new GroupInfo() {
					Value = GridControl.GetGroupRowValue(currentGroupRowHandle),
					FieldName = GridControl.SortInfo[i].FieldName
				};
				currentGroupRowHandle = GridControl.GetParentRowHandle(currentGroupRowHandle);
			}
			return groupInfo;
		}
Пример #2
0
		bool CanMoveSelectedRowsToGroup(DragDropManagerBase sourceManager, GroupInfo[] groupInfos, DependencyObject hitElement) {
			if(GetRowElement(hitElement) == null)
				return false;
			foreach(object obj in sourceManager.DraggingRows) {
				if(!ItemsSource.Contains(obj))
					return true;
				foreach(GroupInfo groupInfo in groupInfos) {
					object value;
					if(groupInfo.FieldName.Contains(".")) {
						ComplexPropertyDescriptor complexDescr = new ComplexPropertyDescriptor(obj, groupInfo.FieldName);
						value = complexDescr.GetValue(obj);
					} else
						value = TypeDescriptor.GetProperties(obj)[groupInfo.FieldName].GetValue(obj);
					if(!object.Equals(value, groupInfo.Value))
						return true;
				}
			}
			return false;
		}