bool failed = false;
//Final Check of FirstIndex
- while (colView.InternalItemSource.IsHeader(firstIndex) ||
+ if (colView.InternalItemSource.Count - 1 < firstIndex)
+ {
+ StepCandidate = 0F;
+ failed = true;
+ }
+
+ while (!failed &&
+ (colView.InternalItemSource.IsHeader(firstIndex) ||
colView.InternalItemSource.IsGroupHeader(firstIndex) ||
- colView.InternalItemSource.IsGroupFooter(firstIndex))
+ colView.InternalItemSource.IsGroupFooter(firstIndex)))
{
- if (colView.InternalItemSource.IsFooter(firstIndex))
+ if (colView.InternalItemSource.IsFooter(firstIndex)
+ || ((colView.InternalItemSource.Count - 1) <= firstIndex))
{
StepCandidate = 0F;
failed = true;
// Insert Single item.
if (source == null) throw new ArgumentNullException(nameof(source));
if (colView == null) return;
- if (isSourceEmpty)
+ if (isSourceEmpty || StepCandidate == 0)
{
Initialize(colView);
}
// Insert Group
if (source == null) throw new ArgumentNullException(nameof(source));
if (colView == null) return;
- if (isSourceEmpty)
+ if (isSourceEmpty || StepCandidate == 0)
{
Initialize(colView);
}
bool failed = false;
//Final Check of FirstIndex
- while (colView.InternalItemSource.IsHeader(firstIndex) ||
+
+ if (colView.InternalItemSource.Count - 1 < firstIndex)
+ {
+ StepCandidate = 0F;
+ failed = true;
+ }
+
+ while (!failed &&
+ (colView.InternalItemSource.IsHeader(firstIndex) ||
colView.InternalItemSource.IsGroupHeader(firstIndex) ||
- colView.InternalItemSource.IsGroupFooter(firstIndex))
+ colView.InternalItemSource.IsGroupFooter(firstIndex)))
{
+
if (colView.InternalItemSource.IsFooter(firstIndex)
|| ((colView.InternalItemSource.Count - 1) <= firstIndex))
{
if (source == null) throw new ArgumentNullException(nameof(source));
if (colView == null) return;
- if (isSourceEmpty)
+ if (isSourceEmpty || StepCandidate == 0)
{
Initialize(colView);
}
if (source == null) throw new ArgumentNullException(nameof(source));
if (colView == null) return;
- if (isSourceEmpty)
+ if (isSourceEmpty || StepCandidate == 0)
{
Initialize(colView);
}