float Current = 0.0F;
IGroupableItemSource source = colView.InternalItemSource;
GroupInfo currentGroup = null;
+ object currentParent = null;
for (int i = 0; i < count; i++)
{
}
else
{
- //GroupHeader must always exist in group usage.
- if (source.IsGroupHeader(i))
+ if (source.GetGroupParent(i) != currentParent)
{
+ currentParent = source.GetGroupParent(i);
+ float currentSize = (source.IsGroupHeader(i)? groupHeaderSize :
+ (source.IsGroupFooter(i)? groupFooterSize: StepCandidate));
currentGroup = new GroupInfo()
{
GroupParent = source.GetGroupParent(i),
StartIndex = i,
Count = 1,
- GroupSize = groupHeaderSize,
+ GroupSize = currentSize,
GroupPosition = Current
};
groups.Add(currentGroup);
- Current += groupHeaderSize;
+ Current += currentSize;
}
//optional
else if (source.IsGroupFooter(i))
else
{
currentGroup.Count++;
- int index = i - currentGroup.StartIndex - 1; // groupHeader must always exist.
+ int index = i - currentGroup.StartIndex - ((colView.GroupHeaderTemplate != null)? 1: 0);
if ((index % spanSize) == 0)
{
currentGroup.GroupSize += StepCandidate;
Initialize(colView);
}
- float currentSize = 0;
+ float currentSize = StepCandidate;
// Will be null if not a group.
IGroupableItemSource gSource = source as IGroupableItemSource;
object groupParent = gSource.GetGroupParent(startIndex);
int parentIndex = gSource.GetPosition(groupParent);
if (gSource.HasHeader) parentIndex--;
- int groupStartIndex = 0;
- if (gSource.IsGroupHeader(startIndex))
- {
- groupStartIndex = startIndex;
- }
- else
- {
- //exception case!
- throw new Exception("Inserted wrong groups!");
- }
+
+ // We guess here that range inserted from GroupStartIndex.
+ int groupStartIndex = startIndex;
for (int current = startIndex; current - startIndex < count; current++)
{
if (groupStartIndex == current)
{
//create new groupInfo!
+ currentSize = (gSource.IsGroupHeader(current)? groupHeaderSize :
+ (gSource.IsGroupFooter(current)? groupFooterSize: currentSize));
groupInfo = new GroupInfo()
{
GroupParent = groupParent,
StartIndex = current,
Count = 1,
- GroupSize = groupHeaderSize,
+ GroupSize = StepCandidate,
};
- currentSize += groupHeaderSize;
+ currentSize += StepCandidate;
}
else
}
else
{
- int index = current - groupInfo.StartIndex - 1; // groupHeader must always exist.
+ int index = current - groupStartIndex - ((colView.GroupHeaderTemplate != null)? 1: 0);
if ((index % spanSize) == 0)
{
groupInfo.GroupSize += StepCandidate;
}
else
{
- int pureIndex = index - myGroup.StartIndex - 1;
+ int pureIndex = index - myGroup.StartIndex - ((colView.GroupHeaderTemplate != null)? 1: 0);
int division = pureIndex / spanSize;
int remainder = pureIndex % spanSize;
if (division < 0) division = 0;
float Current = IsHorizontal? Padding.Start : Padding.Top;
IGroupableItemSource source = colView.InternalItemSource;
GroupInfo currentGroup = null;
+ object currentParent = null;
for (int i = 0; i < count; i++)
{
if (colView.SizingStrategy == ItemSizingStrategy.MeasureAll)
}
if (isGrouped)
{
- if (i == 0 && hasHeader)
+ if (source.IsHeader(i))
{
//ItemPosition.Add(Current);
Current += headerSize;
}
- else if (i == count - 1 && hasFooter)
+ else if (source.IsFooter(i))
{
//ItemPosition.Add(Current);
Current += footerSize;
else
{
//GroupHeader must always exist in group usage.
- if (source.IsGroupHeader(i))
+ //if (source.IsGroupHeader(i))
+ if (source.GetGroupParent(i) != currentParent)
{
+ currentParent = source.GetGroupParent(i);
+ float currentSize = (source.IsGroupHeader(i)? groupHeaderSize :
+ (source.IsGroupFooter(i)? groupFooterSize: StepCandidate));
currentGroup = new GroupInfo()
{
- GroupParent = source.GetGroupParent(i),
+ GroupParent = currentParent,
//hasHeader = true,
//hasFooter = false,
StartIndex = i,
Count = 1,
- GroupSize = groupHeaderSize,
+ GroupSize = currentSize,
GroupPosition = Current
};
if (colView.SizingStrategy == ItemSizingStrategy.MeasureAll)
currentGroup.ItemPosition.Add(0);
groups.Add(currentGroup);
- Current += groupHeaderSize;
+ if (source.IsGroupHeader(i)) Current += currentSize;
}
//optional
else if (source.IsGroupFooter(i))
object groupParent = gSource.GetGroupParent(startIndex);
int parentIndex = gSource.GetPosition(groupParent);
if (gSource.HasHeader) parentIndex--;
- int groupStartIndex = 0;
- if (gSource.IsGroupHeader(startIndex))
- {
- groupStartIndex = startIndex;
- }
- else
- {
- //exception case!
- throw new Exception("Inserted wrong groups!");
- }
+
+ // We guess here that range inserted from GroupStartIndex.
+ int groupStartIndex = startIndex;
for (int current = startIndex; current - startIndex < count; current++)
{
// if group parent, add new gorupinfo
if (groupStartIndex == current)
{
+ currentSize = (gSource.IsGroupHeader(current)? groupHeaderSize :
+ (gSource.IsGroupFooter(current)? groupFooterSize: currentSize));
//create new groupInfo!
groupInfo = new GroupInfo()
{
GroupParent = groupParent,
StartIndex = current,
Count = 1,
- GroupSize = groupHeaderSize,
+ GroupSize = currentSize,
};
}